Error Response Structure
All API errors return a JSON response:HTTP Status Codes
Success Codes (2xx)
| Status | Description | When Used |
|---|---|---|
| 200 OK | Request succeeded | Successful GET, POST |
| 201 Created | Resource created | Successful creation |
| 204 No Content | Success, no body | Successful DELETE |
Client Error Codes (4xx)
| Status | Description |
|---|---|
| 400 Bad Request | Malformed request syntax or invalid parameters |
| 401 Unauthorised | Missing or invalid API key |
| 403 Forbidden | Valid API key but insufficient permissions |
| 404 Not Found | Requested resource does not exist |
| 422 Unprocessable Entity | Request body validation failed |
| 429 Too Many Requests | Usage limit exceeded |
Server Error Codes (5xx)
| Status | Description |
|---|---|
| 500 Internal Server Error | Unexpected server error |
| 503 Service Unavailable | Service temporarily unavailable |
Error Handling with the SDK
The SDK returns typed responses that may contain either a success or error response:Error Handling with HTTP
Retry Strategy
Implement exponential backoff for transient errors (429, 5xx):Best Practices
Always Handle Errors
Always Handle Errors
Never assume API calls will succeed:
Use Specific Error Handlers
Use Specific Error Handlers
Handle different status codes appropriately:
Implement Timeouts
Implement Timeouts
Set reasonable timeouts: