The Nutrient Data Extraction API parse endpoint extracts structured content from a document and returns either typed spatial elements with bounding boxes or a whole-document Markdown representation:
POST https://api.nutrient.io/extraction/parseRequest formats
You can send documents to the parse endpoint in three ways.
Multipart form upload
Upload a file directly with optional processing instructions.
curl -X POST https://api.nutrient.io/extraction/parse \ -H "Authorization: Bearer your_api_key_goes_here" \ -F "file=@document.pdf" \ -F 'instructions={"mode":"understand","output":{"format":"spatial"}}'import requests
response = requests.post( "https://api.nutrient.io/extraction/parse", headers={"Authorization": "Bearer your_api_key_goes_here"}, files={"file": open("document.pdf", "rb")}, data={ "instructions": '{"mode":"understand","output":{"format":"spatial"}}' },)
print(response.json())import fs from "node:fs";
const form = new FormData();form.append("file", await fs.openAsBlob("document.pdf"), "document.pdf");form.append( "instructions", JSON.stringify({ mode: "understand", output: { format: "spatial" } }),);
const response = await fetch("https://api.nutrient.io/extraction/parse", { method: "POST", headers: { Authorization: "Bearer your_api_key_goes_here" }, body: form,});
const result = await response.json();console.log(result);The JavaScript samples use fs.openAsBlob, which requires Node 19.8 or later.
When instructions is omitted, the API defaults to understand mode with spatial element output.
JSON body with URL
Process a document hosted at a public URL without uploading a file.
curl -X POST https://api.nutrient.io/extraction/parse \ -H "Authorization: Bearer your_api_key_goes_here" \ -H "Content-Type: application/json" \ -d '{ "url": "https://storage.example.com/invoice.pdf", "mode": "understand", "output": { "format": "spatial" } }'import requests
response = requests.post( "https://api.nutrient.io/extraction/parse", headers={ "Authorization": "Bearer your_api_key_goes_here", "Content-Type": "application/json", }, json={ "url": "https://storage.example.com/invoice.pdf", "mode": "understand", "output": {"format": "spatial"}, },)
print(response.json())const response = await fetch("https://api.nutrient.io/extraction/parse", { method: "POST", headers: { Authorization: "Bearer your_api_key_goes_here", "Content-Type": "application/json", }, body: JSON.stringify({ url: "https://storage.example.com/invoice.pdf", mode: "understand", output: { format: "spatial" }, }),});
const result = await response.json();console.log(result);Raw binary upload
Send a file directly as the request body with the appropriate Content-Type header.
curl -X POST https://api.nutrient.io/extraction/parse \ -H "Authorization: Bearer your_api_key_goes_here" \ -H "Content-Type: application/pdf" \ --data-binary @document.pdfimport requests
with open("document.pdf", "rb") as f: response = requests.post( "https://api.nutrient.io/extraction/parse", headers={ "Authorization": "Bearer your_api_key_goes_here", "Content-Type": "application/pdf", }, data=f.read(), )
print(response.json())import fs from "node:fs";
const fileBuffer = fs.readFileSync("document.pdf");
const response = await fetch("https://api.nutrient.io/extraction/parse", { method: "POST", headers: { Authorization: "Bearer your_api_key_goes_here", "Content-Type": "application/pdf", }, body: fileBuffer,});
const result = await response.json();console.log(result);Parse cheat sheet
Use this table to avoid mixing request fields and response paths.
| Goal | Request content type | Request shape | Response path |
|---|---|---|---|
| File upload to Markdown | multipart/form-data | file=@document.pdf plus instructions={"mode":"text","output":{"format":"markdown"}} | Markdown: output.markdown; page count: metrics.pagesProcessed |
| File upload to spatial elements | multipart/form-data | file=@document.pdf plus instructions={"mode":"understand","output":{"format":"spatial"}} | Elements: output.elements[]; page number: output.elements[].page.pageNumber; page count: metrics.pagesProcessed |
| File upload with word-level data | multipart/form-data | file=@document.pdf plus instructions={"mode":"understand","output":{"format":"spatial","includeWords":true}} | Words: output.elements[].words[] or output.elements[].cells[].words[] |
| URL input to Markdown | application/json | { "url": "https://.../document.pdf", "mode": "text", "output": { "format": "markdown" } } | Markdown: output.markdown; page count: metrics.pagesProcessed |
| URL input to spatial elements | application/json | { "url": "https://.../document.pdf", "mode": "understand", "output": { "format": "spatial" } } | Elements: output.elements[]; page number: output.elements[].page.pageNumber; page count: metrics.pagesProcessed |
| Raw binary upload | Document Multipurpose Internet Mail Extensions (MIME) type, such as application/pdf | Request body is the file bytes. No instructions field; the API uses the default understand spatial output. | Elements: output.elements[]; page count: metrics.pagesProcessed |
| Table cells | Any spatial request | Set output.format to spatial | output.elements[] where type == "table", then cells[] |
| Chart data | Any spatial request | Set mode to understand or agentic, and output.format to spatial | output.elements[] where type == "chart", then htmlTable, summary, or text |
| QR code or barcode payloads | Any spatial request | Set mode to understand or agentic, and output.format to spatial | output.elements[] where type == "barcode", then value and format |
Request field reminders:
- Use
output.format, notoutputFormat,output.markdown, or a top-levelmarkdownrequest field. configuration.outputFormatis a response field, not a request field.- Spatial output is a flat list at
output.elements[]. Page information is nested on each element atelement.page, and coordinates are atelement.bounds. - Markdown output is returned at
output.markdownin the JSON response.
Processing modes
The mode parameter controls the extraction pipeline.
| Mode | Description | Speed | Cost |
|---|---|---|---|
auto | Routes each page to structure, understand, or agentic | Varies | $0.0015–$0.018 per page |
text | Fast Markdown extraction via Document Engine. No optical character recognition (OCR) or artificial intelligence (AI) augmentation. | Fastest | $0.001 per page |
structure | OCR-based structured extraction with spatial element output | Fast | $0.0015 per page |
understand | Full extraction pipeline with AI augmentation for richer results | Slower | $0.009 per page |
agentic | Vision language model (VLM)-augmented extraction for complex documents | Slowest | $0.018 per page |
Start with auto and select it explicitly. The API uses understand when you omit mode. Refer to the processing modes guide for a detailed comparison.
Output formats
The output.format parameter controls what the API returns.
| Format | Description | Returns |
|---|---|---|
spatial | Typed document elements with bounding boxes and confidence scores. Not available with text mode. | output.elements[] |
markdown | Whole-document Markdown representation | output.markdown |
The default format depends on the mode: text defaults to markdown; auto, structure, understand, and agentic default to spatial.
When output.format is spatial, you can also set output.includeWords: true to include word-level OCR data nested inside paragraph and table cell elements.
Response structure
Every successful response includes:
{ "status": 200, "requestId": "req_e5f6g7h8", "output": { ... }, "metrics": { "processingTimeMs": 4200, "pagesProcessed": 1 }, "usage": { "global_usd": { "cost": "0.01062", "currency": "USD", "includedBalance": "72.40", "walletBalance": "0.00" } }, "configuration": { "mode": "understand", "outputFormat": "spatial" }}requestId— Unique identifier for debugging and support requests.output— Contains eitherelements(spatial format) ormarkdown(Markdown format).metrics— Processing time and pages processed.usage— The cost of this request in US dollars, and your remaining monthly usage and wallet balance. Accounts still on a credits plan getdata_extraction_creditsinstead, in credits.configuration— The mode and output format that were used.
Run asynchronously
For long documents, or when the caller can’t hold a connection open, send the same request to POST /extraction/parse/async. It answers 202 with a stored run you poll for the result. Refer to the run asynchronously guide.
Next steps
- Processing modes — Compare
autorouting and the four explicit processing modes. - Extract document elements — Spatial output with typed elements and bounding boxes.
- Extract Markdown — Whole-document Markdown output.
- Coordinate spaces — Understand units, bounding boxes, and how to map coordinates to rendered pages.
- Multilingual extraction — Process documents in other languages.
- Error handling — HTTP status codes and error response format.