Authentication

Authentication is passed in the Authorization header with a value set to :{token}, base64 encoded. You can find a token to use on the “Account” page (in the “API Key” section) on your dashboard or by running this command:

$ heroku auth:token
01234567-89ab-cdef-0123-456789abcdef

If you are using curl and the Heroku toolbelt, then curl can handle authentication details by reading the netrc file as demonstrated in the reference. The computation is included here for demonstration purposes.

Here’s how to generate the header value with Bash and store it in the $TUTORIAL_KEY var:

Wrap-up

This tutorial demonstrates how to call the Heroku Platform API from Bash and using curl, but you can transfer this approach to whatever language and environment you favor. The tutorial focused specifically on creating, updating and deleting apps. The API has many more resources available, including add-ons, config vars and domains. They all work quite similarly to apps and detailed information can be found in the API reference.