DNS hosting choices - how to programmatically update DNS settings
Amazon web services provides such a service,  called Route53. You can actually use REST calls,  but it is much easier to use their command line tools or bindings for PHP,  Python or JavaScript. 

Here is an entry point to get you started, the route53 change resource record sets call can be used to update or insert  one or many records on a domain.
 https://docs.aws.amazon.com/cli/latest/reference/route53/change-resource-record-sets.html

Of course you need to create an account, set up permissions and delegate name servers to route53.

It's also not free,  but fairly cheap at $0.50 for first 25 domains, then $0.10 after.  All charges per month.