Possible to programatically generate API tokens?

Like the title says, is it possible to perform the operations described on this page in a programmatic way?

I am asking because as part of our deployment strategy, we need to update the client’s DNS and doing so would be much more secure if each client could have their own token instead of using a shared one.

Thanks!