Error Handling

The API uses conventional HTTP response codes to indicate the success or failure of requests. This page documents error formats and handling strategies.

Error Response Format

All error responses follow a consistent JSON structure:

{
  "error": "VALIDATION_ERROR",
  "message": "Invalid request parameters",
  "timestamp": "2026-07-10T12:00:00Z",
  "path": "/api/v1/assets",
  "details": [{ "field": "size", "message": "must be at most 100" }]
}
FieldDescription
errorMachine-readable error code
messageHuman-readable error description
timestampWhen the error occurred
pathThe requested endpoint path
detailsAdditional details for validation errors (optional)

HTTP Status Codes

CodeDescription
400Invalid request parameters or malformed request body
401Missing or invalid API key
403API key doesn't have required permissions for this endpoint
404Requested resource doesn't exist
429Rate limit exceeded - retry after the specified time
500Internal server error - please contact support if persists
503Service temporarily unavailable - try again later

Retry Strategy

For transient errors, implement a retry strategy with exponential backoff:

  • For 429 errors, wait for the time specified in the X-RateLimit-Reset header before retrying
  • For 5xx errors, use exponential backoff (1s, 2s, 4s, 8s...) with jitter
  • Set a maximum retry count (e.g., 3-5 attempts) to avoid infinite loops

Rate Limiting

When you exceed the rate limit, the API returns a 429 status code with details about when you can retry:

Use the retryAfter field or X-RateLimit-Reset header to determine when to retry your request.

Validation Errors

For 400 errors, the response includes a details array with specific field-level errors:

Error Handling Best Practices

  • Always check the HTTP status code before parsing the response body
  • Implement exponential backoff for 429 and 5xx errors
  • Log errors with the timestamp and path for debugging
  • Handle specific error codes differently (e.g., 401 triggers re-authentication)

Choose Your Time

Loading...