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.
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 -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.databuddy.cc/v1/websites/{website_id}/analytics"curl -H "x-api-key: YOUR_API_KEY" \
"https://api.databuddy.cc/v1/websites/{website_id}/analytics"Notes:
Scopes
Grant only what you need. Prefer resource-scoped access where possible.
What each scope unlocks
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
All API key usage is logged for security and compliance:
Logs include IP addresses, user agents, and timestamps for security monitoring.
Best practices
How is this guide?