Error Handling
The API uses standard HTTP status codes and returns detailed error messages.
Error Response Format
{
"success": false,
"message": "Human-readable message",
"code": "error_code",
"content": {
"field": "additional_info"
}
}
code and content are optional. Always branch on the HTTP status and success; use code when an endpoint provides a machine-readable reason.
HTTP Status Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource doesn't exist |
| 429 | Too Many Requests - Rate limited |
| 500 | Internal Server Error |
Common Error Codes
| Code | Description |
|---|---|
invalid_request | Request body is malformed |
missing_parameter | Required parameter missing |
invalid_parameter | Parameter value is invalid |
unauthorized | API key issue |
| endpoint-specific message | Too many requests; inspect HTTP 429 and Retry-After |
insufficient_credits | Not enough credits |
resource_not_found | Check/resource not found |