Providing your API key
Include your API key in theX-API-Key header (case-insensitive):
API key scope
- API keys are bound to your organization
- All operations and resources are scoped to your organization
- Token costs are deducted from your organization’s balance
Security best practices
Never expose your API key in client-side code
Never expose your API key in client-side code
API keys should only be used in server-side applications. Never include them in JavaScript that runs in the browser.
Use environment variables
Use environment variables
Store your API key in environment variables rather than hardcoding it in your source code.
Rotate keys regularly
Rotate keys regularly
Create new API keys periodically and revoke old ones. You can manage keys in your dashboard.
Use separate keys for different environments
Use separate keys for different environments
Create separate API keys for development, staging, and production environments.
Error responses
| Status Code | Message | Description |
|---|---|---|
| 401 | API key is required | No API key was provided in the request |
| 401 | Invalid or expired API key | The API key is invalid or has been revoked |
