How to create API token automatically?

Hi there,

I’m trying to find a way to programatically create API tokens for various organizations. I’ve read through the following Github issues:

https://github.com/grafana/grafana/issues/2431
https://github.com/grafana/grafana/issues/2218#issuecomment-117041541
https://github.com/grafana/grafana/issues/1789

So it appears you can use basic auth to authenticate to the API. However, is there a way to generate an API token after using Basic Auth?

See this answer: How to get the API key from REST API or other scripts?