Every API request is authenticated with an API key that belongs to one application. Send it as a bearer token:
curl https://api.bentocal.com/au/v1/users/user_123 \
-H "Authorization: Bearer $BENTOCAL_TEST_KEY"Key format
Keys look like bc_{mode}_{region}_{32 characters}, for example bc_test_au_7Hq2Lm9XvT4kPz8RwN3bYc6JfD1sGa5E.
| Part | Meaning |
|---|---|
bc_ | Marks a BentoCal key, which helps secret scanners find leaked keys. |
test / live | test for keys created while the application is in development, live for keys created in production. |
au | The region the application lives in. The key only works on that region's base URL. |
The mode is a label for you: it's set when the key is created and doesn't change if you later switch the application's environment. When an application goes to production, create a new key (it starts bc_live_) and revoke the old one.
Create a key
- Open your application in the console and go to the API keys tab.
- Click Create API key and give it a Name so you can tell keys apart, for example "Production server".
- Copy the key from the Save your API key dialog, store it in your secrets manager, tick I've saved this key somewhere safe and click Done.
The full key is only shown once. BentoCal stores a hash of it, plus its prefix and last four characters so you can recognise it in the list. If you lose a key, revoke it and create a new one.
Rotate a key
An application can have several active keys, so you can rotate without downtime:
- Create a new key.
- Deploy it to your servers.
- Check the old key's Last used time on the API keys tab stops moving.
- Revoke the old key.
Revoke a key
Click Revoke next to the key on the API keys tab. Requests with it fail with 401 unauthorized straight away. Revoking can't be undone.
Authentication errors
| Status | Code | Cause |
|---|---|---|
| 401 | unauthorized | The Authorization header is missing or malformed, or the key is unknown or revoked. |
| 400 | wrong_region | The key belongs to another region. Use the base URL of the region your application lives in. See Regions and base URLs. |
| 403 | forbidden | The application is disabled (Settings → General → Status). |
| 403 | company_suspended | The company account is suspended. Contact support. |
See Errors for the full list.