Get all subpages by template via rest API

Hello!

I have a lot of nested and sub-nested pages under one general page.
I want to retrieve via the rest API all nested/sub-nested pages with a specific template.
Is it possible?

Cheers!

You probably need a custom api endpoint