Authentication
Send your API key with every request. Put it in the authorization header after
the word Bearer. Replace YOUR_API_KEY with your key. Keys start with sk_.
authorization: Bearer YOUR_API_KEYKeys
- Create and manage keys in the dashboard on the API keys page. WorkOS issues each key. A key belongs to a workspace or to one member of a workspace.
- WorkOS manages key permissions, revoking, and rotation. Use the same dashboard page.
Hobby includes one workspace member. Adding a teammate requires Pro or above. The sole Hobby member can manage workspace API keys.
Keep your key safe
Use these rules to protect your key:
- Keep it in a secret manager or a local environment file.
- Never put it in source code, URLs, screenshots, support messages, or logs.
Benchmark returns 401 UNAUTHORIZED when it rejects a missing or invalid key.
Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHORIZED | The key is missing or not valid. |
| 402 | INSUFFICIENT_CREDITS | The workspace does not have enough spendable credits. Pricing details |
| 402 | USAGE_CAPPED | The workspace reached its monthly spending limit. Pricing details |
| 403 | FORBIDDEN | The key is not allowed to do this. |
| 403 | PLAN_UPGRADE_REQUIRED | A read-only plan cannot start a refresh. The response includes upgradeUrl for the workspace billing page. |
| 403 | SUBSCRIPTION_INACTIVE | A paid operation needs a current plan. Renew or choose a plan in the workspace billing page. |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests. Wait, then try again. |