Sub facets via REST API

I’m building for a custom app builder via the REST API and I have this on every product I have in my index:
Skjermbilde 2020-05-27 kl. 14.23.19
I want to somehow nest this, it would be:
Country -> Region -> SubRegion

But I have no idea how to do this? How would I relate these to each other?
In my app I have a section called “Most popular regions” but to actually get the information about that region from my database I need to include the country, and if I want to get SubRegion I need both region and country in that request.

Would this be possible to get out in a API request with Algolia or do I need to build this via integromat or something similar to combine different datasets?

One solution maybe:
I get the region facets -> the user clicks on one -> I make a request to Algolia -> I get the country facet of the products belonging to that region? Since a region can only belong to one country.
Would this be possible?

Hi there,

To search hierarchically on some facets, Algolia offer a hierarchical menu widget, you can read more about how to format your record so you can use it on your frontend:

Hope that helps,