Error Response Format
All Databuddy API errors follow a consistent JSON structure:Always
false for error responsesHuman-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Unique identifier for the request. Include this when contacting support.
Array of detailed error information, typically for validation errors
HTTP Status Codes
Databuddy uses standard HTTP status codes:Request succeeded
Invalid request parameters or malformed data
Missing or invalid authentication credentials
Authenticated but lacking required permissions
Requested resource does not exist
Rate limit exceeded
Server error (contact support if persistent)
Error Codes
Authentication Errors
AUTH_REQUIRED
Authentication is required but no credentials were providedSolution: Include an API key in the
x-api-key header or Authorization headerINVALID_API_KEY
The provided API key is invalid, expired, or revokedSolution: Verify your API key is correct and hasn’t been revoked. Create a new key if needed.
ACCESS_DENIED
Authenticated but the API key lacks required scopes or permissionsSolution: Ensure your API key has the necessary scopes (e.g.,
read:data for queries)Validation Errors
VALIDATION_ERROR
One or more request parameters are invalidDetails: Check the
details array for field-specific errorsExample:MISSING_PARAMETER
A required parameter is missing from the requestSolution: Check the endpoint documentation for required parameters
MISSING_PROJECT_ID
No project identifier provided (website_id, schedule_id, link_id, or organization_id)Solution: Include a project identifier in the query string
MISSING_WEBSITE_ID
The
website_id parameter is required but was not providedSolution: Add ?website_id=your_website_id to the request URLResource Errors
NOT_FOUND
The requested resource does not existSolution: Verify the resource ID is correct and the resource hasn’t been deleted
UNAUTHORIZED
Not authorized to access this resourceSolution: Verify you have access to the organization or website
FORBIDDEN
Access to this resource is forbiddenSolution: Check that your API key or user account has the required permissions
CONFLICT
The request conflicts with the current state of the resourceSolution: Check if the resource already exists or has been modified
Rate Limit Errors
RATE_LIMIT_EXCEEDED
Too many requests in a short periodResponse includes:
limit: The rate limit that was exceededremaining: Remaining requests (0)reset: When the limit resetsretryAfter: Seconds to wait before retrying
Query Errors
QUERY_ERROR
The query could not be executedSolution: Check query syntax, filters, and parameters
COMPILATION_ERROR
The query could not be compiledSolution: Verify query structure matches expected format
UNKNOWN_QUERY_TYPE
The specified query type does not existSolution: Use
/v1/query/types to list valid query typesExample:INVALID_DATE_PRESET
The specified date preset is not validSolution: Use one of:
today, yesterday, last7days, last30days, thisMonth, lastMonth, thisYearServer Errors
INTERNAL_SERVER_ERROR
An unexpected error occurred on the serverSolution: Retry the request. If the error persists, contact support with the
requestIdThe service is temporarily unavailableSolution: Retry with exponential backoff
Handling Errors
Error Handling Best Practices
TypeScript Error Types
Validation Error Handling
Validation errors include helpful suggestions:Debugging Tips
1. Use Request IDs
Every response includes arequestId. Save these for debugging:
2. Enable Detailed Logging
3. Check Query Types
List available query types:4. Validate Dates
Use YYYY-MM-DD format or ISO 8601:Common Error Scenarios
Scenario 1: Invalid API Key
Request:Scenario 2: Missing Required Scope
Request: API key with onlywrite:links scope trying to query analytics
Response:
read:data scope to your API key.
Scenario 3: Validation Error
Request:Getting Help
If you encounter persistent errors:- Check the documentation for the specific endpoint
- Review error details in the response
- Test with the interactive API docs at https://api.databuddy.cc/
- Contact support with your
requestId