Error Response Format
When an error occurs, the API returns a consistent error response:HTTP Status Codes
| Status Code | Description |
|---|---|
200 | Success |
201 | Created |
204 | No Content (successful deletion) |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing credentials |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource doesn’t exist |
409 | Conflict - Resource already exists |
422 | Unprocessable Entity - Validation error |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Common Error Codes
Authentication Errors
| Code | Description |
|---|---|
invalid_token | The access token is invalid or expired |
missing_token | No authorization header provided |
insufficient_scope | Token lacks required permissions |
Validation Errors
| Code | Description |
|---|---|
invalid_request | Request body is malformed |
validation_error | One or more fields failed validation |
missing_field | Required field is missing |
Resource Errors
| Code | Description |
|---|---|
not_found | The requested resource doesn’t exist |
already_exists | Resource with this identifier already exists |
conflict | Operation conflicts with current state |
Error Handling Best Practices
1
Check Status Code First
Use the HTTP status code to determine the general category of error.
2
Parse Error Response
Extract the
error.code and error.message for specific handling.3
Log Details
Store the full error response for debugging purposes.
4
Display User-Friendly Messages
Translate error codes into messages appropriate for your users.