Authentication
All Labs API endpoints require authentication using a Bearer token.Getting an API Key
- Log in to the Labs Portal
- Navigate to API Keys in the sidebar
- Click Create New Key
- Give your key a descriptive name (e.g., “Production Training”, “Development”)
- Copy the key immediately—it won’t be shown again
Using Your API Key
Include the key in theAuthorization header:
Environment Variables
Store your API key in environment variables:Rate Limits
API keys have rate limits based on your subscription. Rate limit information is included in response headers:| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per window |
X-RateLimit-Remaining | Requests remaining in current window |
X-RateLimit-Reset | Unix timestamp when window resets |
Handling Rate Limits
Error Responses
Authentication errors return a 401 status:- Missing
Authorizationheader - Incorrect key format (should be
Bearer <key>) - Expired or revoked key
- Key doesn’t have access to requested collection
Key Management
Multiple Keys
Create separate keys for different environments:- Production: High rate limits, monitored usage
- Development: Lower limits, for testing
- CI/CD: Dedicated key for automated testing
Revoking Keys
If a key is compromised:- Go to API Keys in the Labs Portal
- Find the compromised key
- Click Revoke
- Create a new key and update your systems
Revocation is immediate. Any requests using the revoked key will fail.