Error Response Format
All API errors return a consistent JSON structure:HTTP Status Codes
| Status | Category | Description |
|---|---|---|
400 | Client Error | Bad request - check your request format |
401 | Authentication | Missing or invalid API key |
403 | Authorization | Key doesn’t have access to this resource |
404 | Not Found | Knowledge base or resource doesn’t exist |
429 | Rate Limit | Too many requests or cap exceeded |
500 | Server Error | Internal error - retry later |
503 | Unavailable | Service temporarily unavailable |
Common Errors
Authentication Errors (401)
Authorization: Bearer header.
Authorization Errors (403)
Not Found Errors (404)
Rate Limit Errors (429)
Validation Errors (400)
Server Errors (500, 503)
Error Handling Best Practices
1
Check Status Codes First
Always check the HTTP status code before parsing the response body.
2
Parse Error Response
Extract the
error code and message for logging and user feedback.3
Implement Retry Logic
For
429 and 5xx errors, implement exponential backoff with jitter.4
Handle Cap Exceeded Gracefully
When
query_cap_exceeded, inform users and provide upgrade options.5
Log Errors
Log error details for debugging, but never log API keys.
Example Error Handler
Need Help?
If you encounter persistent errors or unexpected behavior, contact support at [email protected] with:- The error code and message
- Your request details (without the API key)
- Timestamp of the error