Extraction endpoint
Updated
Endpoint#
POST https://api.docxtract.io/v3.1/documents
Authorization: Bearer {api_key}
Content-Type: multipart/form-data
Note
There is no
/api prefix. api/ is the server's document root, not part of
the public path. https://api.docxtract.io/api/v3.1/... returns 404.Request#
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | PDF, JPG, or PNG. Max 10 MB, max 150 pages. |
options | string | No | JSON-encoded options — see Options |
options is a JSON string in a form field, not nested multipart data:
-F 'options={"model":"invoice","store_db":true}'
Response#
{
"success": true,
"data": { "vendor": "ABC Suppliers Pvt Ltd", "total": 5900.00 },
"processing_time_ms": 5577,
"model_used": "invoice",
"pages": 1
}
With store_db: true the response also carries "extraction_id": "abc123".
Metadata sits at the root level beside data, not nested under a meta key.
| Field | Notes |
|---|---|
data | Extracted fields. Shape varies by document type — see below |
processing_time_ms | The AI call duration where measurable, otherwise total wall clock |
model_used | Prompt template actually applied |
pages | Page count discovered in the result |
extraction_id | Stored-result id. Present only when store_db is true, which is not the default |
Note
The field is
extraction_id, not id. Older documentation said id; that was
wrong.document_type and confidence are not returned at root in v3.1, though v3 did return them.
The data object#
data is an open map whose shape depends on the document type. Only the envelope is stable.
invoice→ vendor, GSTIN, invoice number, totals,line_items[]passport→ name, passport number, date of birthbank_statement→ account details and a row list
Write your integration to read the fields you need defensively rather than assuming a fixed schema. A prompt template can be revised, which can add or rename fields.
Two response codes for success#
| Status | Meaning |
|---|---|
200 | Extraction complete. data holds the result. |
202 | Document was split for multi-page processing. data holds a chunk manifest, not a result. |
Warning
A PDF over 3 pages returns
202, and you cannot opt out. Code that checks
only success === true will treat the chunk manifest as extracted data and appear to work
while returning nonsense. Always branch on the status code, or use an official SDK, which
handles both paths in one call.Errors#
{
"success": false,
"error": {
"code": "invalid_file_type",
"message": "Unsupported file type. Accepted types: PDF, JPG, PNG",
"details": { "uploaded_type": "image/gif" }
}
}
Branch on error.code — it is stable. Message wording is not. See Error codes.
Something wrong or missing on this page? Tell us.