Parsing

Send a PDF, image or text and get JSON that matches your schema.

MethodPathWhat it does
POST/api/v1/parseParse a document
GET/api/v1/parse/jobs/{job_id}Get parse job
GET/api/v1/parse/jobsList parse jobs
GET/api/v1/parse/webhook-secretRead the parse webhook secret
POST/api/v1/parse/webhook-secretRotate the parse webhook secret

Parse a document

POST/api/v1/parse

Extract keys from a PDF, PNG, JPEG, or text document. Upload the file as multipart/form-data, send it as base64 in a JSON body, or send plain text in the text parameter. Add export to also get the result as an Excel or CSV file, or citations to get the page and box each value was read from. The bytes are discarded after the request.

Request body (multipart/form-data or JSON)

file / file_base64 / textfile | stringRequired: Yes, exactly one
The document. Send exactly one of these three. PDF, PNG, JPEG, and UTF-8 text files (.txt, .md, .csv, .eml) work. Free workspaces allow 10 MB per document; Starter and Pro allow 25 MB; Business allows 100 MB.
  • file: The raw document as a multipart upload, for example -F file=@invoice.pdf.
  • file_base64: The same file as a standard base64 string in a JSON body.
  • text: Plain text of the document, such as an invoice email, in a JSON body or as a multipart field (-F "text=<invoice.txt"). 1 credit per started 3,000 characters.
filenamestringRequired: No
Names the document: the document column and export.filename. Defaults to the uploaded file's name, or "text" for text; set it when you send base64. Paths are stripped, control characters removed, at most 120 characters.
schemastring | objectRequired: No
The JSON key is schema. Send the slug of a saved schema, or a schema definition for this call only. In multipart, send the slug, or the definition as a JSON string. Without it, the model picks the keys.
export"xlsx" | "csv"Required: No
Adds an export property with the result as an Excel or CSV file in base64. The JSON data is always returned. Case does not matter. Leave it out for JSON only; any other value, json included, is 400 and spends nothing.
citationsbooleanRequired: No
Adds a citations object that says where each value was read. In multipart, send "true" or "false". Leave it out, or send false, for the plain result. It does not change the cost.
strictbooleanRequired: No
Only matters for long documents, which are read in chunks of pages. By default a chunk that cannot be read leaves a partial result (see Partial results). With true, any chunk that cannot be read fails the whole parse with 502 CHUNK_FAILED and no credits are used. In multipart, send "true" or "false".
  • Send exactly one of file (multipart), file_base64 (base64), or text. Free workspaces allow 10 MB per document; Starter and Pro allow 25 MB; Business allows 100 MB. The type is read from the file bytes, not the name, so a .csv or .eml file is read as text. A missing, doubled, or rejected document is turned away before it spends credits.
  • schema is optional (that is the JSON key name; it names a saved schema or carries an inline schema). A string must be the slug of a schema saved in this workspace (lowercase letters, digits, underscores; hyphens in the string are treated as underscores). An object is used for this call only. An unknown slug, or an object that fails the schema rules, is rejected before it spends credits.
  • A 200 has status "ok", credits_used, credits_remaining, and values, the extracted data. Dates inside values are yyyy-mm-dd. A value the model cannot find is null, except that a key the schema types as an array is always an array, [] when there are no rows. The shape is the same with or without export; xlsx and csv only add the export property. See Excel and CSV export below.
  • The workspace's plan sets a monthly credit allotment, shared by the API, MCP, and the Playground. One credit is one page: an image is 1 page, a PDF costs its page count, and text costs 1 credit per started 3,000 characters (at least 1). export and citations do not change the cost. Each plan's allotment and pages per document are on the pricing page. A document over the pages per document limit returns 400 with pages and max_pages, and spends nothing. A 402 does not spend. A failed parse returns status "error", message, credits_used, and credits_remaining, and the 402 also includes credits_required and upgrade.
  • With citations true, a 200 also has citations, keyed by the path of each non-null value, such as "Invoice Number" or "Line Items[0].Amount". Each entry has page (from 1), text (the printed text the value was read from), bbox ([x0, y0, x1, y1] as fractions of the page from the top left, or null), status, and source. status is verified when the text was found on the page, fuzzy for a close match, mismatch when the found text does not hold the value, other_page when it was found on a different page, ambiguous when the quoted text is at several places on the page and nothing says which one holds the value, and unverified when it could not be checked. A value the model gave no quote for is never verified: it is fuzzy when it was found once beside the other cells of its row, and unverified otherwise. A date is verified only when a date can be read from the matched text. source is text_layer for a box measured from the PDF's own text, model for a box read from a scan or image, or null. Text documents get no boxes. See Citations below.
  • A long document is read in chunks of pages. The 200 then has warnings, a list that is empty when nothing was noticed. Each warning has code, message, and, when it concerns pages, pages ([first, last], from 1). Codes: CHUNK_FAILED (those pages could not be read) and EMPTY_CHUNK (the model returned nothing for those pages).
  • Partial results: when some pages could not be read, the 200 has status "partial" instead of "ok", failed_page_ranges (a list of [first, last] page ranges that are missing from values), and a CHUNK_FAILED warning for each. values holds what the other pages gave. Only the pages that were read are charged: credits_used counts them and the rest are refunded. Send strict true to get a 502 with code CHUNK_FAILED and failed_page_ranges instead, and no charge. If no page could be read the parse fails as a model error.
  • Each workspace may parse once per second. A second parse inside that second is 429, does not spend credits, and does not call the model. The 429 body includes retry_after and no job_id, because the burst gate runs before any ParseJob row is created. REST also sends Retry-After. Your X-Job-Id is not claimed on a burst refusal, so the same key can be retried after retry_after.
  • Every parse that starts returns job_id in the JSON body and X-Job-Id on the response, including failures after the job row is created and 504 timeouts, so you can poll GET /api/v1/parse/jobs/{job_id}. X-Job-Id on the request is optional. When you send it, it must be a UUID (versions 1 through 5) and acts as an idempotency key for this workspace for about 24 hours: the same key with the same request returns the original job_id without a new run or charge. A replay of that key inside the one-second burst window can return 429 first, with Retry-After; retrying after Retry-After returns the original job. The same key with a different request (document, schema, citations or strict) returns 409 with failure_code IDEMPOTENCY_KEY_REUSED. Prefer: respond-async keeps the id even if the HTTP connection drops; without Prefer, send your own X-Job-Id before a long sync parse so a timeout still leaves you an id to poll.
  • Prefer: respond-async returns 202 Accepted immediately with job_id, X-Job-Id, and Location pointing at the job URL. Poll until job_status is succeeded or failed, or send X-Webhook-Url: <https URL> with it to get one signed parse.job.finished POST when the job ends (see Webhook events on the Inboxes page). X-Webhook-Url without Prefer: respond-async returns 400, and from a key not made by the workspace owner 403. A retry with the same X-Job-Id and the same request returns that same 202 (no second charge). A failure before any charge releases the key so a later retry can run. A failure after the charge keeps the key: the same key returns that failed job for about 24 hours, so use a new UUID to try again.
POST /api/v1/parse (multipart file upload)
curl -X POST https://doxtract.manoonlabs.com/api/v1/parse \
  -H "Authorization: Bearer mldxt_..." \
  -F file=@invoice.pdf \
  -F schema=invoice

Get parse job

GET/api/v1/parse/jobs/{job_id}

Return a parse job's status and, when it has finished, the stored result for this workspace.

  • job_status is queued, running, succeeded, failed, or expired.
  • A finished succeeded job includes the same values and credits fields as a synchronous 200, with warnings and, for a partial result, failed_page_ranges.
  • A running job whose process stopped is picked up by this call: the chunks that were not finished run now, then the job settles, before the response is sent.
  • Another workspace's id or an unknown id returns 404. A result past the 24-hour window returns 410.
GET /api/v1/parse/jobs/{job_id}
curl -X GET https://doxtract.manoonlabs.com/api/v1/parse/jobs/cm7job \
  -H "Authorization: Bearer mldxt_..."

List parse jobs

GET/api/v1/parse/jobs

List this workspace's parse jobs, newest first. Parsed values are not included.

  • Query parameters: page, page_size (max 100), status, from, to (ISO dates), and client_job_id (the X-Job-Id UUID, exact match in this workspace).
  • Each item has job_id, status, created_at, schema, credits_used, and client_job_id when set.
GET /api/v1/parse/jobs
curl -X GET https://doxtract.manoonlabs.com/api/v1/parse/jobs?page=1 \
  -H "Authorization: Bearer mldxt_..."

Read the parse webhook secret

GET/api/v1/parse/webhook-secret

Read the workspace secret that signs parse.job.finished callbacks, the ones an async parse sends to X-Webhook-Url. REST only.

  • It is made the first time it is read or a parse asks for a callback, and kept until it is rotated.
  • Only a key created by the workspace owner can read it. Other keys get 403 with code not_owner.
  • Check the Doxtract-Signature header of each callback with it, the same way as an inbox webhook.
GET /api/v1/parse/webhook-secret
curl -X GET https://doxtract.manoonlabs.com/api/v1/parse/webhook-secret \
  -H "Authorization: Bearer mldxt_..."

Rotate the parse webhook secret

POST/api/v1/parse/webhook-secret

Replace the secret that signs parse.job.finished callbacks. Callbacks signed with the old secret stop verifying at once. REST only.

  • There is no request body. 200 returns the new secret.
  • Only a key created by the workspace owner can rotate it.
POST /api/v1/parse/webhook-secret
curl -X POST https://doxtract.manoonlabs.com/api/v1/parse/webhook-secret \
  -H "Authorization: Bearer mldxt_..."

The Playground runs the same parse in the browser and returns the same JSON.