Authenticate with retrain.ai API

Generate a Token

The first step in the client credentials flow is to fetch a token. You can then use this token to make subsequent authenticated requests to the API you're using.
To fetch a token, you need to make a POST request to generate_token call:

ParameterDescription
client_id The Client ID that you received during generate the Client ID & Client Secret account setup.
client_secretThe Client Secret that you received during generate the Client ID & Client Secret account setup.

Token expiration

Tokens expire automatically after a period of 60 minutes and may be reactivated again at any time.

Cache your token

The response to your token request will contain an access_token, which is an encoded JSON Web Token (see http://jwt.io for reference). We recommend caching this token and not fetching a new one before every API request.

Use your token

Retrain APIs that require OAuth 2.0 authentication accept their token in an authentication header:

authentication: Bearer<ACCESS_TOKEN>