Authentication
Authenticate your API requests using API keys. Learn about key types, security best practices, and how to handle authentication errors.
API Keys
The Trakkr API uses API keys to authenticate requests. You can view and manage your API keys from your account settings.
Key Format
API keys sk_live_
Full read/write access to all brands your account can access.
Using Your API Key
Include your API key in the Authorization header as a Bearer token:
All API requests must include a valid API key. Requests without authentication or with an invalid key will return a 401 Unauthorized error.
Environment Variables
We strongly recommend storing your API key in an environment variable rather than hardcoding it in your application:
Security Best Practices
Use environment variables
Never commit API keys to version control. Use .env files and add them to .gitignore.
Rotate keys regularly
Periodically regenerate your API keys, especially if you suspect they may have been compromised.
Use separate keys per environment
Create different API keys for development, staging, and production environments.
Server-side only
Only make API requests from server-side code. Never expose your API key in client-side JavaScript, mobile apps, or browser extensions.
Authentication Errors
If authentication fails, the API returns a 401 Unauthorized status code with details about the error:
| Status | Error Message | Description |
|---|---|---|
401 | Missing API key | No Authorization header was provided |
403 | Invalid API key | The API key doesn't exist or has been revoked |
