To access the Hava API you will first need to generate an API token that can be passed through in an Authorization header. API tokens all have admin rights to your account so make sure you keep them secure and never store them in publicly accessible places, such as client side code or Github repositories.
To generate and use tokens you must have access to the public API in your plan, currently available on the business plan. To create a token you can head to the Account Settings section in your Hava account.
From this screen you can create new tokens, view existing tokens and view the time since they were last used. You may also remove API tokens entirely from this screen.
You can click ‘Create Token’ at the top right to create a new access token.
Give the token a descriptive name and click ‘Create’ to generate and save your new token.
This will be the only time you’ll be able to see your token so make sure you copy it before closing the dialog. You’re now all set to use the API!
The token needs to be passed with each request to the API, and all requests must be made over SSH. All other requests will fail.
For example, you can use cURL to access the command line by storing the your key as an environment variable called
HAVA_API_KEY and making a request:
curl https://api.hava.io/environments -H "Authorization: Bearer $HAVA_API_KEY"
Check out the full API spec to see the possible endpoints you can call.