parse_document
Extract structured data from PDFs, images, or Office files into Markdown or spatial JSON with bounding boxes, confidence scores, and reading order—from a local file or URL—for RAG and search indexing.
Instructions
Extract structured data from a document using the Nutrient DWS Data Extraction API. Reads the input file from the local file system or sandbox (if enabled), or fetches it directly from a URL — provide exactly one of filePath or url.
Output formats: • spatial — typed elements (paragraphs, tables, key-value pairs, formulas, pictures, handwriting) with bounding boxes, confidence scores, and reading order. Written to outputPath (the list can be large). • markdown — whole-document Markdown. Returned inline, or written to outputPath when provided (recommended for large documents). Good for RAG and search indexing. • Both at once via formats: ["spatial", "markdown"] — a second format costs no extra credits, so ask for both up front instead of extracting twice.
Processing modes (cost per page): text = fast Markdown, no OCR (1 credit); structure = OCR spatial (1.5 credits); understand = AI-augmented, default (9 credits); agentic = VLM-augmented (18 credits).
Note: markdown output and any extracted content are returned into this conversation and may be logged by the host. For sensitive documents, prefer spatial output to a file plus targeted extract_fields calls.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL of the document to extract from — fetched directly by the API instead of uploading a local file. Exactly one of filePath or url is required. | |
| mode | No | Processing mode (cost/quality trade-off). text: fast Markdown from digital-born documents, no OCR (1 credit/page). structure: OCR-based spatial elements (1.5 credits/page). understand: AI-augmented spatial extraction, the default (9 credits/page). agentic: VLM-augmented for the most complex documents (18 credits/page). | understand |
| format | No | Single output format. Defaults to markdown for text mode and spatial for all other modes. Mutually exclusive with formats. | |
| formats | No | Request multiple output formats in one call, e.g. ["spatial", "markdown"] — both output.elements and output.markdown are returned, billed the same as a single format (no extra credits). Mutually exclusive with format. | |
| filePath | No | Path to the document to extract from (PDF, image, or Office file). Exactly one of filePath or url is required. Resolves to sandbox path if enabled, otherwise resolves to the local file system. | |
| language | No | OCR language(s) — full name (e.g. "german"), ISO code (e.g. "deu"), or array for multilingual docs. Only applies to structure/understand/agentic modes; ignored for text mode. Leave unset for auto-detection. | |
| maxScripts | No | Maximum number of scripts to auto-detect. Only valid when language is left unset (auto-detect), and not in text mode, which does no OCR. Server default: 2. | |
| outputPath | No | Where to write spatial JSON output. Required when spatial is among the requested formats (the element list can be large and is kept out of the conversation). Resolves to sandbox path if enabled. | |
| includeWords | No | Include word-level bounding boxes in spatial output. Server default: false. Ignored for markdown output. | |
| maxLanguages | No | Maximum number of languages to auto-detect. Only valid when language is left unset (auto-detect), and not in text mode, which does no OCR. Server default: 2. | |
| useHtmlTables | No | Markdown only. Render tables as HTML instead of Markdown table syntax. Server default: true. | |
| extractWordsFromPictures | No | Markdown only. Extract words found inside pictures into the Markdown output. Server default: false. | |
| includeHeadersAndFooters | No | Markdown only. Include page headers and footers in the Markdown output. Server default: false. | |
| enableSemanticBlockFormatting | No | Markdown only. Group related content into semantic blocks. Server default: true. |