API Keys
TL;DR
What is an API key?
An API key authenticates server-to-server calls to Databuddy. It supports fine-grained scopes and optional resource scoping to enforce least-privilege access. Keys start with dbdy_ followed by 48 characters.
Create a key
We only display the prefix and first characters (start) later for identification. Never share the full secret.
Use your key
You can authenticate with either header:
curl -X POST "https://api.databuddy.cc/v1/query?website_id={website_id}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id":"summary","parameters":["summary"],"startDate":"2024-01-01","endDate":"2024-01-31"}'curl -X POST "https://api.databuddy.cc/v1/query?website_id={website_id}" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id":"summary","parameters":["summary"],"startDate":"2024-01-01","endDate":"2024-01-31"}'Notes:
Scopes
Grant only what you need. Prefer resource-scoped access where possible.
What each scope unlocks
Link analytics are queried through POST /v1/query with link_id and require read:data with global access, not a links scope.
Listing websites is intentionally gated by read:data (not a separate read:websites scope) because the list is only useful for picking a site to query. Any key that can list sites can already read their analytics.
Resource access
Access can be scoped to:
Example: a key with read:data scoped to a single website can read analytics only for that website, not others in the organization.
Errors
Authentication/authorization failures return structured errors:
{
"success": false,
"error": "Authentication required",
"code": "AUTH_REQUIRED"
}{
"success": false,
"error": "Insufficient permissions",
"code": "FORBIDDEN"
}Rotation and revocation
Actions are available in Organization Settings → API Keys under each key’s detail view.
Rate limits
All API endpoints are rate-limited. See the Rate Limits section in the API Reference. Responses include standard X-RateLimit-* headers where applicable.
Audit Logging
Administrative mutations on API keys are logged: created, updated, revoked, rotated, and deleted. Per-request usage is not logged.
Best practices
How is this guide?