Skip to main content

Overview

An Error Response is returned when an API request fails. All endpoints return a standardized JSON error format. What Error Responses Include:
  • Human-readable error message
  • Optional suggestions for resolving the issue
  • Optional machine-readable error codes (for usage enforcement and billing errors)
  • Optional structured details (field validation, usage breakdowns)
  • HTTP status code indicating the error type

Fields

boolean
Always false for error responses
object
Error details object

Error Response Formats

The API uses a consistent error format across all endpoints:

1. Standard Error

Most errors use this format:

2. Usage Enforcement Errors

Usage and billing-related errors include a machine-readable code:
Error codes used:
  • MISSING_USER_ID - User ID required for operation
  • CONCURRENCY_LIMIT_EXCEEDED - Too many concurrent sessions
  • INSUFFICIENT_MINUTES - No minutes remaining in account
  • USAGE_CHECK_FAILED - Failed to verify usage limits
  • NO_SUBSCRIPTION - No active subscription found

3. Field Validation Errors

When request validation fails, the API returns detailed field-level errors:

4. Unexpected Server Errors

When an unexpected error occurs, the global error handler returns:

Field Reference

All error responses follow the structure defined in the Fields section above.

Examples

Bad Request (400)

Not Found (404)

Access Denied (403)

Authentication Error (401)

Validation Error (400) - Business Logic

Validation Error (400) - Field-Level

When request validation fails (e.g., using Joi schemas), the API returns detailed field-level errors:

Usage Enforcement Error (402 / 429)

When usage limits are exceeded:
Concurrency limit exceeded:

HTTP Status Codes

Rate Limiting

When rate limited (429 status code), you may receive headers indicating:
  • RateLimit-Limit: Maximum number of requests allowed
  • RateLimit-Remaining: Requests remaining in current window
  • RateLimit-Reset: Seconds until the window resets
  • Retry-After: Seconds to wait before making another request

Error Handling Best Practices

Always Check Response Status

Check both the HTTP status code and the success field:

Implement Retry Logic for Rate Limits

Don’t Retry 4xx Errors

Notes

  • All errors use the standardized format with success: false and error as an object
  • Error codes are only used for usage enforcement and billing errors
  • Suggestions are optional - not all errors include them
  • Error messages are human-readable and safe to display to users
  • HTTP status codes follow standard REST conventions