Documentation
Error Codes Reference
Comprehensive reference for API error codes and how to handle them
Error Response Format
Most API errors return a JSON body with an error code, message, and optional details for debugging. The exact shape depends on which layer raised the error — see below.
Error Body Shapes
Errors raised by middleware (for example, rate limiting) use the richer envelope with a structured error object and a request_id:
{ "error": { "code": "RATE_LIMIT_ERROR", "message": "Rate limit exceeded: 100 calls per 60 seconds", "details": {} }, "request_id": "550e8400-e29b-41d4-a716-446655440000"}Errors raised by the framework via HTTPException (validation failures, permission errors, 404s, most business-rule errors) use FastAPI's default { "detail": ... } shape. detail may be a string or an object depending on the endpoint:
{ "detail": "Rule not found"}
// or, for structured errors:{ "detail": { "code": "VALIDATION_ERROR", "message": "Invalid request parameters", "field": "limit" }}When a request_id is present, always include it when contacting support for faster debugging.
HTTP Status Codes
200OKRequest succeeded
201CreatedResource created successfully
204No ContentRequest succeeded, no content to return (typically for DELETE)
400Bad RequestInvalid request syntax or parameters
401UnauthorizedMissing or invalid API key
403ForbiddenValid API key but insufficient permissions or scope
404Not FoundResource does not exist or you don't have access
409ConflictResource already exists (e.g., duplicate upload)
402Payment RequiredSubscription is past due or payment required
422Unprocessable EntityRequest is well-formed but contains validation errors or violates business rules
429Too Many RequestsRate limit exceeded. Check Retry-After header.
500Internal Server ErrorServer error. Retry with exponential backoff.
503Service UnavailableAI provider error, upstream service failure, or temporary overload. Retry after a short delay.
504Gateway TimeoutOperation timed out. Retry with a smaller batch size or simpler query.
Application Error Codes
The codes below are the most common ones you will encounter. Individual endpoints may emit additional endpoint-specific codes (for example, custom extraction schemas, cloud storage, and billing flows each define their own set) — consult the relevant endpoint reference for the full list.
Authentication Errors
INVALID_API_KEYThe API key provided is invalid or malformed
Solution: Check that you're using a valid API key from your dashboard
EXPIRED_API_KEYThe API key has expired
Solution: Generate a new API key from your dashboard
DEACTIVATED_API_KEYThe API key has been deactivated
Solution: Generate a new API key from your dashboard
AUTHZ_ERRORAPI key lacks required authorization for this operation
Solution: Create a new API key with the required scope
Upload Errors
HTTP_413File exceeds maximum size limit or storage quota exceeded
Solution: Reduce file size. Check the message for details.
Quota Errors
STORAGE_QUOTA_EXCEEDEDAccount storage limit reached
Solution: Delete unused files or upgrade your plan
RATE_LIMIT_ERRORToo many API requests in the time window
Solution: Implement exponential backoff and respect Retry-After
USAGE_LIMIT_EXCEEDEDMonthly API call or processing limit reached
Solution: Wait for next billing cycle or upgrade plan
Processing Errors
IMAGE_PROCESSING_ERRORImage processing or analysis failed
Solution: Check file integrity and try re-uploading
VLM_PROVIDER_ERRORAI vision provider encountered an error during analysis
Solution: Retry the request. If the error persists, the provider may be temporarily unavailable.
TIMEOUTOperation timed out
Solution: Retry with smaller batch size or simpler query
Error Handling Best Practices
import requestsimport timeimport random
def api_request_with_retry(method, url, max_retries=3, **kwargs): """Make API request with exponential backoff.""" for attempt in range(max_retries): response = requests.request(method, url, **kwargs)
if response.status_code == 200: return response.json()
if response.status_code == 429: # Rate limited - use Retry-After header retry_after = int(response.headers.get('Retry-After', 5)) print(f"Rate limited. Waiting {retry_after}s...") time.sleep(retry_after) continue
if response.status_code >= 500: # Server error - exponential backoff wait_time = (2 ** attempt) + (random.random() * 0.5) print(f"Server error. Retrying in {wait_time:.1f}s...") time.sleep(wait_time) continue
# Client error - don't retry data = response.json() error = data.get('error', {}) raise APIError( code=error.get('code'), message=error.get('message'), request_id=data.get('request_id') )
raise MaxRetriesExceeded(f"Failed after {max_retries} attempts")
