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 responsesobject
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-readablecode:
MISSING_USER_ID- User ID required for operationCONCURRENCY_LIMIT_EXCEEDED- Too many concurrent sessionsINSUFFICIENT_MINUTES- No minutes remaining in accountUSAGE_CHECK_FAILED- Failed to verify usage limitsNO_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:HTTP Status Codes
Rate Limiting
When rate limited (429 status code), you may receive headers indicating:RateLimit-Limit: Maximum number of requests allowedRateLimit-Remaining: Requests remaining in current windowRateLimit-Reset: Seconds until the window resetsRetry-After: Seconds to wait before making another request
Error Handling Best Practices
Always Check Response Status
Check both the HTTP status code and thesuccess field:
Implement Retry Logic for Rate Limits
Don’t Retry 4xx Errors
Notes
- All errors use the standardized format with
success: falseanderroras 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