Overview
The Composite Analytics API uses API keys to authenticate requests. You can view and manage your API keys in the Analytics Dashboard.Start with
pk_ and are safe to use in client-side code (browsers, mobile apps)Authentication Methods
SDK Authentication
The easiest way to authenticate is using the Composite SDK:HTTP Header Authentication
For direct API calls, include your API key in theAuthorization header:
API Key Types
Public Keys (pk_)
Public keys have limited permissions suitable for client-side use:
| Permission | Allowed |
|---|---|
| Send events | ✅ |
| Send session recordings | ✅ |
| Identify users | ✅ |
| Read own user profile | ✅ |
| Read project configuration | ✅ |
| Access admin endpoints | ❌ |
| Read other users’ data | ❌ |
| Modify project settings | ❌ |
Rate Limiting
API keys are subject to rate limits:| Key Type | Requests/Second | Requests/Day | Burst Limit |
|---|---|---|---|
| Public | 1,000 | 100,000,000 | 10,000 |
| Secret | 10,000 | 1,000,000,000 | 100,000 |
Rate Limit Headers
The API returns rate limit information in response headers:Handling Rate Limits
Implement exponential backoff when rate limited:Troubleshooting
401 Unauthorized Error
401 Unauthorized Error
403 Forbidden Error
403 Forbidden Error
Your API key doesn’t have permission for this operation:
- Public keys cannot access admin endpoints
- Check the key’s permission settings in the dashboard
- Use a secret key for server-side operations
429 Too Many Requests
429 Too Many Requests
You’ve exceeded the rate limit:
- Implement exponential backoff
- Batch your requests when possible
- Consider upgrading your plan for higher limits
- Check the Retry-After header for when to retry
API Key Not Working in Production
API Key Not Working in Production
Common issues and solutions:
- Ensure environment variables are set in production
- Check for typos or extra whitespace in the key
- Verify the key is for the correct environment (test vs live)
- Confirm the key has the necessary permissions