Error Response Format
All errors return JSON with a consistent structure:Common Status Codes
Status Code | Description | When It Occurs |
---|---|---|
400 | Bad Request | Invalid request parameters or validation errors |
401 | Unauthorized | Missing or invalid API key/authentication |
403 | Forbidden | Valid authentication but insufficient permissions |
404 | Not Found | Resource not found |
413 | Payload Too Large | File upload exceeds size limit |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Unexpected server error |
Error Examples
Validation Error (400)
Authentication Error (401)
Permission Error (403)
Rate Limit Error (429)
When you exceed rate limits, the API returns additional information:File Upload Error (413)
Server Error (500)
Best Practices
Error Handling in Code
Retry Logic
Implement exponential backoff for rate limit and server errors:- 429 (Rate Limited): Wait based on
resetTime
or implement exponential backoff - 500/502/503: Retry with exponential backoff (max 5 attempts)
- 400/401/403/404: Don’t retry - fix the request first
Check the
X-RateLimit-*
headers to proactively avoid rate limits rather than handling them reactively.