Document extraction API errors and limits
The docRefinery API limits you three ways: a monthly page quota, submissions per minute and 100 MB per file. Starter allows 100 pages a month and 30 submissions a minute. Failures come back in one of two JSON shapes, and the code field tells you whether a retry can help. GET /v1/usage shows your own limits.
Updated
The two error shapes
Requests refused before they reach an endpoint, for authentication or limits, return error and code. Branch on code, and treat error as a message for people.
{ "error": "Too many submissions.", "code": "rate_limited", "retry_after_seconds": 12 }Errors from an endpoint itself return detail. It is a string for 400, 401, 403, 404 and 409, and a list of issues for 422.
{ "detail": "This PDF could not be read." }{
"detail": [
{ "loc": ["body", "file"], "msg": "field required", "type": "value_error" }
]
}Error codes
| Status | code | Meaning | What to do |
|---|---|---|---|
401 | unauthenticated | The key is missing or wasn't accepted. | Check the Authorization header and that the key is active. Don't retry unchanged. |
403 | forbidden | The account is disabled, or this route isn't open to you. | Don't retry. Contact us if you expected access. |
413 | payload_too_large | The file is over the 100 MB upload limit. | Send a smaller file. |
429 | rate_limited | Too many submissions this minute. | Wait for retry_after_seconds (also sent as Retry-After), then retry. |
429 | quota_exceeded | The document's pages don't fit this month's quota. | Retrying won't help. Wait for resets_at, or talk to us about your plan. |
503 | auth_unavailable | We can't verify credentials right now. | Retry once after 2 seconds. The request was refused before anything ran, so resending the upload is safe. |
Other errors
| Status | When | What to do |
|---|---|---|
400 | On submit, a PDF can't be read because it is damaged or password-protected, so its pages can't be counted. | Fix the file and submit it again. |
404 | The trace_id doesn't exist or belongs to another account. The two look the same on purpose. | Check the trace_id, and that you're using a key from the account that submitted it. |
422 | A request part is invalid. detail lists each issue. | Correct the request. Retrying unchanged won't help. |
When a run fails
A request can succeed and the run still fail later. In that case the poll returns 200 with status: "failed" and a short generic error, and the pages are given back. Check status as well as the HTTP code.
The exception is a document outside the supported types, such as a CV or a letter, which adds a specific code and an explanation written for you to show as it is. To process one of these, build a workflow in the dashboard.
{
"status": "failed",
"error_code": "unsupported_document_type",
"error": "This document was identified as 'Other', which is not a supported document type. …"
}Monthly page quota
Your quota is counted in pages per calendar month and shared by everyone in your organisation and every key. A PDF counts its pages; anything else counts as 1. Pages are charged on submit and given back if the run fails. The free Starter plan includes 100 pages a month. A document that doesn't fit is refused whole with 429 quota_exceeded, and the error includes pages_used, pages_limit and resets_at.
Check your usage
GET /v1/usage returns your plan, what you've used this period, when the quota resets and your rate limit. It works with an API key, so your code can check pages_remaining before sending a large batch.
curl "$DOCREFINERY_API/v1/usage" \
-H "Authorization: Bearer $DOCREFINERY_API_KEY"{
"plan": "free",
"period": "2026-11",
"pages_used": 42,
"pages_limit": 100,
"pages_remaining": 58,
"resets_at": "2026-12-01T00:00:00Z",
"requests_per_minute": 30,
"api_keys_enabled": true
}Rate limit
The rate limit counts document submissions per minute, for the whole account. Starter accounts get 30 a minute, and requests_per_minute in the usage response gives yours. POST responses carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset, so a batch job can slow down before it is refused. Over the limit you get 429 rate_limited with the wait in seconds.
Upload size limit
A file can be up to 100 MB. A larger upload is refused with 413 payload_too_large before it is read, so check the size on your side first and avoid sending a file that can't succeed.
Other limits on Starter
The pricing page lists up to 4 documents processing at once and 7-day data retention on Starter, so collect results promptly. Paid plans are quoted by sales and run more documents in parallel.
When to retry
- Retry after waiting:
429 rate_limited, for as long asretry_after_secondssays. - Retry once after 2 seconds:
503 auth_unavailable. - Don't retry unchanged:
400,401,403,404,413,422and429 quota_exceeded. - Failed run: a poll that reports
failedwon't change. Submit the document again if you want another attempt; the failed run's pages were given back.
Common questions
What is the maximum file size for the docRefinery API?
100 MB per file. A larger upload is refused with 413 payload_too_large before it is read.
How many pages does the free docRefinery plan include?
Starter includes 100 pages a month and 30 submissions a minute. A PDF counts its pages and any other file counts as 1. Pages are given back if a run fails.
What is the difference between rate_limited and quota_exceeded?
Both are 429 responses. rate_limited means too many submissions this minute, so wait for retry_after_seconds and try again. quota_exceeded means the document's pages don't fit this month's quota, so retrying won't help until resets_at.
Do failed runs use up my docRefinery page quota?
No. Pages are charged on submit and given back if the run fails, including when the document turns out to be an unsupported type.
Related
- QuickstartSend your first document to the docRefinery extraction API: get a key, submit a PDF, poll for the result and read checked fields. curl, Python and JavaScript.
- AuthenticationAuthenticate with the docRefinery document extraction API: bearer API keys, who can create them, expiry, revoking, activity logs and what a key can reach.
- Extract a documentExtract data from an invoice with the docRefinery API: submit with curl, Python or JavaScript, poll the run, then read fields, tables and low-confidence flags.
- PricingStarter is free for 100 pages a month, no card needed. Paid plans are custom: subscription or per page. Enterprise adds VPC or on-premises.
Send your first document.
Make a free account and try the API on a file of your own.
100 pages a month free. No credit card, no sales call.