Authentication
Learn how to authenticate with the Actually Tracking API using client credentials.
Authentication
To authenticate with the Actually Tracking API, you need to use your clientId and clientSecret. Different API endpoints may require different access levels:
- Track API: Default client works with
writemode - Export API: Requires
readorrootmode - Insights API: Requires
readorrootmode - Manage API: Requires
rootmode only
The default client (created with a project) has write mode and does not have access to the Export, Insights, or Manage APIs. You'll need to create additional clients with appropriate access levels.
Headers
Include the following headers with your API requests:
actuallytracking-client-id: Your Actually Tracking client IDactuallytracking-client-secret: Your Actually Tracking client secret
Example
curl 'https://api.actuallytracking.com/insights/{projectId}/metrics' \
-H 'actuallytracking-client-id: YOUR_CLIENT_ID' \
-H 'actuallytracking-client-secret: YOUR_CLIENT_SECRET'Security Best Practices
- Store credentials securely: Never expose your
clientIdandclientSecretin client-side code - Use HTTPS: Always use HTTPS to ensure secure communication
- Rotate credentials: Regularly rotate your API credentials
- Limit access: Give each key only the permissions it needs
Error Responses
If authentication fails, you'll receive a 401 Unauthorized response:
{
"error": "Unauthorized",
"message": "Invalid client credentials"
}Common authentication errors:
- Invalid client ID or secret
- Client doesn't have required permissions (e.g., trying to access Manage API with a non-root client)
- Malformed client ID (must be a valid UUIDv4)
- Client type mismatch (e.g.,
writeclient trying to access Export API)
Client Types
Actually Tracking supports three client types with different access levels:
| Type | Description | Access |
|---|---|---|
write | Write access | Track API only |
read | Read-only access | Export API, Insights API |
root | Full access | All APIs including Manage API |
Note: Root clients have organization-wide access and can manage all resources. Use root clients carefully and store their credentials securely.
Permissions
Instead of a type, you can give a key a list of permissions. It can then do exactly what the list names. Create one in Project settings → Clients → Create client → Custom permissions, or through the Manage API.
| Permission | Allows | Works on |
|---|---|---|
events:write | Track API: send events and update profiles, and report crawler visits | One project |
analytics:read | Export, Insights and revenue APIs, and MCP | One project or every project |
imports:write | Start imports | One project |
dashboards:write | Manage API for dashboards and reports, and the MCP tools that change them | Every project |
references:write | Manage API for references (chart annotations) | Every project |
projects:write | Manage API for projects | Every project |
clients:write | Manage API for keys. A key can only create keys with permissions it has itself | Every project |
funnels:write | Manage API for funnels | One project or every project |
alerts:write | Manage API for alerts | One project or every project |
goals:write | Manage API for goals | One project or every project |
team:write | Manage API for the team: members and viewers | Every project |
A request that needs a permission the key lacks gets a 401 naming it, for example Export: This API key does not have the analytics:read permission.
Keys created with a type keep working exactly as before. In permission terms, write is events:write, read is analytics:read and imports:write on one project, and root is everything except sending events, on every project.
Rate Limiting
The API implements rate limiting to prevent abuse. Rate limits vary by endpoint:
- Track API: Higher limits for event tracking
- Crawler reporting (
/crawl): 1,000 requests per 10 seconds - Export/Insights APIs: 100 requests per 10 seconds
- Manage API: 20 requests per 10 seconds
If you exceed the rate limit, you'll receive a 429 Too Many Requests response. Implement exponential backoff for retries.
Remember to replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with your actual Actually Tracking API credentials.