Error reference
All errors return a consistent JSON body:
{ "error": "Human-readable description of what went wrong." }
Some 400 errors include additional context:
{
"error": "Unknown document type: \"xyz\"",
"available_types": ["invoice", "medical_consultation", "..."]
}
HTTP status codes
| Code | Meaning |
|------|---------|
| 201 | Job created successfully |
| 200 | Request successful |
| 400 | Bad request — validation error |
| 401 | Invalid or missing API key |
| 402 | Insufficient credits |
| 404 | Resource not found |
| 409 | Conflict — job not complete yet (result endpoint) |
| 429 | Limit exceeded (e.g. schema limit) |
| 500 | Internal server error |
Common errors and fixes
file is required
You forgot to attach the file in the form data. Make sure you're sending multipart/form-data with a file field.
extract is required
You forgot the extract field. It must be a JSON string with a fields object.
fields must be an object
You passed fields as an array. Change ["name", "date"] to {"name": "description", "date": "description"}.
fields cannot be empty
The fields object has no keys. Add at least one field.
Maximum 50 fields per request
Reduce the number of fields. If you need more, split into multiple jobs.
File too large. Maximum size is 50MB.
Compress or split the file before submitting.
Insufficient credits
Top up via Dashboard → Billing, or wait for the monthly free reset.
Invalid API key
Check that you're sending Authorization: Bearer exdoc_live_... with a valid, non-revoked key.
Job not complete (409)
You called the /result endpoint before the job finished. Poll /jobs/:id until status is done first.
Handling errors in code
const res = await fetch('https://exdocapi.cheapehai.shop/api/v1/extract', {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}` },
body: form
})
if (!res.ok) {
const { error } = await res.json()
switch (res.status) {
case 402: return redirectToBilling()
case 401: return promptForNewKey()
case 400: return showValidationError(error)
default: throw new Error(error)
}
}
Failed jobs
A job with status: "failed" has an error field:
{
"id": "a1b2c3d4-...",
"status": "failed",
"error": "Could not reach processing worker: connection timeout"
}
Common causes:
- Worker timeout — resubmit the job
- Corrupted file — re-upload a clean copy
- Unreadable scan — use higher resolution (300 DPI)
- No file stored — check that file upload succeeded