Most requests to the Centaur API require an API key and a bearer token.
To generate a bearer token, issue a POST request to /login using your account email, API password, and API key. If you don't know these values, follow the steps under API Credentials
Bearer tokens expireSince bearer tokens expire after a period of inactivity, we recommend beginning every session by generating a fresh token.
Here is an example cURL request to generate a bearer token:
curl --location --request POST 'https://api.centaurlabs.com/auth/public/v1/login' \
--header 'X-API-KEY: YOUR_API_KEY_HERE' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "YOUR_EMAIL_ADDRESS_HERE",
"api_password": "YOUR_API_PASSWORD_HERE"
}'The response to /login will include a value for token, which is the bearer token you should use to authenticate all subsequent requests:
{
...
"token": "YOUR_TOKEN_HERE"
}Here is an example cURL request to validate your bearer token:
curl --location --request POST 'https://api.centaurlabs.com/auth/public/v1/testToken' \
--header 'X-API-KEY: YOUR_API_KEY_HERE' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json'
You're authenticated!Now that you have a bearer token, you can interact with the rest of our API. All other requests require just an API key and bearer token to authenticate.
