Error Codes
All API errors return a JSON response with adetail field:
Status codes
| Code | Meaning | Common causes |
|---|---|---|
| 400 | Bad Request | Empty message, unsupported file type, invalid parameters |
| 401 | Unauthorized | Missing or invalid API key, expired token |
| 403 | Forbidden | Accessing a resource you don’t own |
| 404 | Not Found | Job, session, template, or attachment doesn’t exist |
| 422 | Validation Error | Request body doesn’t match expected schema |
| 429 | Too Many Requests | Monthly operation limit reached |
| 500 | Internal Server Error | Unexpected server error |
| 504 | Gateway Timeout | AI processing exceeded 10 minutes |
Common errors and fixes
Authentication errors (401)
Authorization: Bearer sk_YOUR_KEY (include the Bearer prefix).
Validation errors (400)
message in your request body.
.pdf, .docx, .txt, .rtf, .md). Convert .doc files to .docx.
Rate limit (429)
usage object in chat responses to monitor remaining operations.
Timeout (504)
/v1/chat/async) for long operations.
Not found (404)
/v1/jobs to list active jobs.
