Skip to main content

Standard Error Response Format

All error responses follow this format:
{
  "error": "Error type",
  "message": "Human-readable error message",
  "details": {
    "field_name": ["Error message for this field"]
  }
}

HTTP Status Codes

  • 200 OK: Request successful
  • 201 Created: Resource created successfully
  • 204 No Content: Request successful, no content to return
  • 400 Bad Request: Invalid request data
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Resource not found
  • 402 Payment Required: Insufficient credits/balance
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Server error

Common Error Responses

401 Unauthorized

{
  "detail": "Authentication credentials were not provided."
}

403 Forbidden

{
  "detail": "You do not have permission to perform this action."
}

404 Not Found

{
  "error": "Not found",
  "message": "The requested resource was not found."
}

400 Validation Error

{
  "field_name": [
    "This field is required.",
    "This field may not be blank."
  ],
  "another_field": [
    "Invalid value."
  ]
}

402 Payment Required

{
  "error": "Insufficient credits",
  "message": "You need 10 credits to perform this action. Current balance: 5 credits",
  "required_credits": 10,
  "current_balance": 5
}