Overview
The Ordinal API uses Bearer token authentication. All API requests must include a valid API key in theAuthorization header.
Workspace-Level AuthenticationAPI keys are scoped to a specific workspace and provide access to all resources within that workspace. If you’re an agency managing multiple client workspaces, you’ll need to create a separate API key for each workspace.
Generating an API Key
Pro Plan RequiredThe Ordinal API is available on the Pro plan or higher. Upgrade your workspace to access API features.
Navigate to Workspace Settings
Go to the API Keys page in your workspace.
Making Authenticated Requests
Include your API key in theAuthorization header with the Bearer prefix:
Authentication Errors
When authentication fails, the API returns specific error codes to help you diagnose the issue.Missing Token
If no authorization header is provided:401 Unauthorized
Invalid or Not Found
If the API key is invalid or doesn’t exist:401 Unauthorized
Rate Limited
If you’ve exceeded the rate limit for your API key:429 Too Many Requests
Revoked Key
If the API key has been revoked:403 Forbidden
Expired Key
If the API key has expired:403 Forbidden
Disabled Key
If the API key has been disabled:403 Forbidden
Insufficient Permissions
If the API key doesn’t have the required permissions:403 Forbidden
Insufficient Credits
If your account has run out of API credits:403 Forbidden
Usage Exceeded
If you’ve exceeded your usage quota:403 Forbidden
Error Code Reference
| Error Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid API key |
TOO_MANY_REQUESTS | 429 | Rate limit exceeded |
FORBIDDEN | 403 | Key revoked, expired, disabled, or insufficient permissions |
Best Practices
Use Environment Variables
Use Environment Variables
Store your API key in environment variables rather than hardcoding it in your application.
Rotate Keys Regularly
Rotate Keys Regularly
Periodically rotate your API keys to minimize the impact of potential key exposure.
Monitor Key Usage
Monitor Key Usage
Regularly review your API key usage in the dashboard to detect any unusual activity.
Revoke Compromised Keys
Revoke Compromised Keys
If you suspect an API key has been compromised, revoke it immediately and generate a new one.
Managing API Keys
Viewing Keys
You can view all your API keys in the workspace settings. Each key shows:- Name and description
- Creation date
- Last used timestamp
Revoking Keys
To revoke an API key:- Navigate to workspace settings
- Find the key you want to revoke
- Click the
...button and select “Revoke” - Confirm the action