Error Response Format
All errors follow a consistent JSON format:Error Codes
Authentication Errors
Validation Errors
Limit Errors
Account Errors
Server Errors
Handling Errors
Rate Limit Headers
When rate limited (429), check these headers:Best Practices
Always check response status
Always check response status
Never assume a request succeeded. Check the HTTP status code before processing the response.
Implement exponential backoff
Implement exponential backoff
For rate limits and server errors, use exponential backoff with jitter to avoid thundering herd.
Log error codes
Log error codes
Log the error code (not just the message) for easier debugging and monitoring.
Handle grace period gracefully
Handle grace period gracefully
If you receive
grace_period, notify users to update their subscription.