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; revert target message not in active history; pre-signed upload expired |
| 409 | Conflict | Revert blocked because a chat job is currently running on the same session |
| 413 | Request Entity Too Large | Request body or export payload above the size cap |
| 422 | Validation Error | Request body doesn’t match expected schema; format value outside the allowed enum; revert target message predates the revert feature |
| 429 | Too Many Requests | Monthly operation limit reached |
| 500 | Internal Server Error | Unexpected server error |
| 504 | Gateway Timeout | AI processing exceeded 30 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)
The synchronous/v1/chat and async /v1/chat/async endpoints both apply a 30-minute wall-clock cap. When the cap is reached, the response carries a short summary and a suggestion to split the work across smaller turns:
/v1/chat/async) for long operations — it streams intermediate progress events as the work runs and supports human-in-the-loop approval. Split large requests into smaller turns (one section per turn).
Request too large (413)
The 413 response covers two distinct cases — caller-too-large and document-too-large for the chosen export format — with a structured JSON detail body so clients can react appropriately. Caller payload exceeds the transport limit:POST /v1/documents/export/email-request instead — the file will be rendered in the background and emailed as a 7-day signed download link. See Email fallback for very large documents.
| Field | Description |
|---|---|
error_code | request_too_large (transport layer) or document_too_large (export cap). |
message_user | Human-readable explanation safe to surface in your UI. |
suggested_action | split_request or email_request. Use to switch your client between paths. |
request_size_mb / document_size_mb | Observed payload size. |
max_size_mb | Configured cap for the format / endpoint. |
format | Export format that triggered the cap (only on document_too_large). |
contact_email | Support contact for follow-up. |
support_event_id | Opaque correlation ID. Share with hello@superdocs.app when reporting an issue. |
Validation errors (422)
format is now a strict enum on /v1/documents/export. Use one of "docx", "pdf", "html", "markdown", "txt". The value "doc" is accepted as a legacy alias and will be removed in a future release.
Not found (404)
/v1/jobs to list active jobs.
Revert conflicts (409)
/v1/jobs/{job_id} or watch the SSE stream until you see final), or cancel it via POST /v1/jobs/{job_id}/cancel before retrying revert.

