Error Responses

Understanding API error responses and status codes.

Standard Error Format

All errors follow a consistent JSON structure:

{
  "title": "Validation error",
  "status": 400,
  "detail": "The field 'email' is required",
  "errors": {
    "email": ["This field is required"]
  }
}

Common HTTP Status Codes

Code Status Description
200 OK Request successful
201 Created Resource created successfully
204 No Content Success with no response body (e.g., DELETE)
400 Bad Request Invalid request data
401 Unauthorized Authentication required or failed
403 Forbidden Insufficient permissions
404 Not Found Resource not found
422 Unprocessable Entity Validation error
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error

Error Examples

Missing Required Field
{
  "title": "The field 'email' is required",
  "status": 400
}
Invalid Data Format
{
  "title": "Invalid email format",
  "status": 422,
  "errors": {
    "email": ["Please enter a valid email address"]
  }
}
Permission Denied
{
  "title": "Access denied",
  "status": 403,
  "detail": "You do not have permission to perform this action"
}
Resource Not Found
{
  "title": "Resource not found",
  "status": 404,
  "detail": "Order with ID 999 does not exist"
}
Rate Limit Exceeded
{
  "title": "Rate limit exceeded",
  "status": 429,
  "detail": "Too many requests. Please try again later.",
  "retry_after": 60
}

Rate Limiting

API requests may be rate-limited based on IP address or access token.

Response Headers
  • X-RateLimit-Limit - Maximum requests per window
  • X-RateLimit-Remaining - Remaining requests in current window
  • X-RateLimit-Reset - Unix timestamp when limit resets
Back to API Home