Overview
The Agency API uses Bearer token authentication with company-scoped API keys. All API requests must include a valid company API key in theAuthorization header.
Company-Level AuthenticationCompany API keys provide access to all workspaces within your company. This is different from workspace API keys, which only provide access to a single workspace.
Key Differences from Workspace API Keys
| Feature | Company API Key | Workspace API Key |
|---|---|---|
| Prefix | ord_c_* | ord_* |
| Scope | All workspaces in company | Single workspace |
| Can create workspaces | Yes | No |
| Can manage workspace API keys | Yes | No |
| Can access posts/profiles | No | Yes |
Generating a Company API Key
Enterprise Plan RequiredCompany API keys are available on the Enterprise plan. Contact sales to upgrade your account.
Making Authenticated Requests
Include your company 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
Wrong Key Type
If you use a workspace API key instead of a company API key:403 Forbidden
Revoked Key
If the company API key has been revoked:403 Forbidden
Rate Limited
If you’ve exceeded the rate limit for your API key:429 Too Many Requests
Error Code Reference
| Error Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid API key |
FORBIDDEN | 403 | Wrong key type, revoked, or insufficient permissions |
TOO_MANY_REQUESTS | 429 | Rate limit exceeded |
Best Practices
Use Environment Variables
Use Environment Variables
Store your company API key in environment variables rather than hardcoding it in your application.
Use Workspace Keys for Workspace Operations
Use Workspace Keys for Workspace Operations
Company API keys cannot access workspace-specific resources like posts and profiles. Use the Agency API to create workspace API keys, then use those keys with the Workspace API.
Rotate Keys Regularly
Rotate Keys Regularly
Periodically rotate your company API keys to minimize the impact of potential key exposure.
Revoke Compromised Keys
Revoke Compromised Keys
If you suspect a company API key has been compromised, revoke it immediately and generate a new one. Remember that this affects all workspaces in your company.
Managing Company API Keys
Viewing Keys
You can view all your company API keys in the company settings. Each key shows:- Name and description
- Creation date
- Last used timestamp
Revoking Keys
To revoke a company API key:- Navigate to company settings
- Find the key you want to revoke
- Click the
...button and select “Revoke” - Confirm the action