Thank you for sharing this. But after a scan through the docs I am not sure if the Dns server can fetch the response from an api.
Sorry for not making the question clear. I want this kind of flow:
The dns server gets a query.
The dns server makes that query to a web api using a get request like /resolve/myawesomedomain.com
The web api responds { "A": 10.10.10.10 }
The dns server responds with that A record
https://unbound.docs.nlnetlabs.nl/en/latest/