Imported from pspdfkit-labs/nutrient-skills (
plugins/nutrient-dws/skills/document-extraction-api/SKILL.md). Install upstream withnpx skills add pspdfkit-labs/nutrient-skills --skill document-extraction-api. Copyright stays with the author (MIT).
Nutrient Data Extraction
Use this skill to build with the Data Extraction API. To process a file in chat, connect the hosted Nutrient MCP plugin for its supported document tasks.
Choose the operation
| Desired result | Use |
|---|---|
| Named fields, such as invoice number, total, and line items, with evidence | extract with a JSON Schema via scripts/extract.py. |
| Whole-document Markdown for RAG, search, or migration | parse with Markdown output via scripts/parse.py. |
| Document layout, bounding boxes, or every detected table | parse with spatial output via scripts/parse.py. |
| The likely document type, such as invoice, receipt, or contract | classify via the Classify API. |
| Where the component documents start and end in a merged file | split via the Split API. |
For RAG chunking of a parsed document, see the sibling grounded-rag-ingestion skill. For
PDF generation, conversion, OCR, redaction, signing, or any /build-based workflow, use the
sibling document-processor-api skill.
Classify or separate a packet
Follow the linked API examples for these operations. The bundled scripts cover parsing and field extraction.
- Use
POST /extraction/classifywith at least two meaningful labels for a direct classification request. The result ranks labels with scores. Route ambiguous results to review. - Use
POST /extraction/splitwhen the workspace has Split enabled. Read the one-based, inclusive page ranges and boundary confidence fromoutput.segments. When you need one PDF per segment, the API can also return a ZIP download. - For a mixed packet, review uncertain boundaries and classify the separated documents. Then extract against the right schema for each type. Keep each segment's original page range with the result so a citation can be traced back to the packet.
- When the user provides the page ranges and only wants pages cut out, use the
document-processor-apiskill instead.
/extraction/extract — schema field extraction with citations
Define the fields you want in a JSON Schema (root type: object); extract returns
output.data with those values and output.metadata with per-field citation metadata
(options.includeCitations defaults on). Accepts a local file or a URL.
For a first run, save the schema from the Extract API examples
as fields.json and use the synthetic sample invoice.
Look for invoice number INV-DEMO-1042 and total 176.00 USD with citations on page 1.
# Pull schema-defined fields from a local invoice, with citations (default)
uv run scripts/extract.py --input invoice.pdf --schema fields.json --out result.json
# From the public sample URL
uv run scripts/extract.py --url https://www.nutrient.io/downloads/pdf-to-json-review/invoice.pdf \
--schema fields.json --out result.json --mode understand
Use the Data Extraction pricing guide
and the response's usage for current charges. The bundled script gates high local estimates
behind --yes and can display legacy credit-based estimates. See
references/extract-output-and-citations.md for the response shape. Include the source page
when reporting cited values, and flag missing or uncertain evidence for review.
Setup
- Get an API key with Data Extraction access at https://dashboard.nutrient.io/.
- Export it as
NUTRIENT_EXTRACT_API_KEY:export NUTRIENT_EXTRACT_API_KEY="pdf_live_..." - Scripts live in
scripts/relative to this SKILL.md. Use the directory containing this SKILL.md as the working directory:cd <directory containing this SKILL.md> && uv run scripts/<script>.py --help
The helpers prefer NUTRIENT_EXTRACT_API_KEY and can use a global key with Data Extraction
access via NUTRIENT_API_KEY when the first variable is unset.
/extraction/parse — one primitive, two output shapes
One call returns a structural document model with typed elements, bounding boxes, confidence scores, and reading order, or a whole-document Markdown string. The processing mode determines which element types are available.
Picking a mode
The processing modes guide
recommends auto as a starting point for direct API integrations. It routes each page
to structure, understand, or agentic. The bundled parse.py helper takes explicit
modes and defaults to structure with spatial output.
| User intent | Mode | Output |
|---|---|---|
| Read an existing PDF text layer for search or RAG | text |
Markdown |
| Read a scan or photo with OCR | structure |
Markdown or spatial |
| Enumerate form regions or detect semantic layout | understand |
Spatial |
| Describe figures or diagrams | agentic |
Spatial |
For large runs, estimate the cost from the current per-page prices and the page count. When using a legacy credit estimate, confirm with the operator before running above 200 extraction credits.
Invocation
# Default: structure mode, spatial output
uv run scripts/parse.py --input doc.pdf --out out.json
# Markdown for RAG (text mode — cheapest)
uv run scripts/parse.py --input doc.pdf --out out.md --output-format markdown --mode text
# Enumerate all key-value regions of a form (understand mode) — for NAMED fields use extract
uv run scripts/parse.py --input doc.pdf --out out.json --mode understand
# Agentic (VLM alt text on pictures)
uv run scripts/parse.py --input doc.pdf --out out.json --mode agentic
The script reports legacy credit usage when present in the response. Use the API response or dashboard to verify current charges.
Downstream consumption
After a single /parse call, slice the response for common needs:
- Reading-order plain text: walk
output.elementssorted by(page.pageIndex, readingOrder), joinparagraphandhandwritingtextfields - Tables: project
cells[]on eachtableelement into rows/columns usingcell.rowandcell.column - Key-value pairs: read
pairs[]on eachkeyValueRegionelement — each pair has.key.valueand.value.value - Formulas: read
latexon eachformulaelement - Pictures: read
classificationandaltDescription(populated byagenticmode) on eachpictureelement - Markdown output: call with
--output-format markdown; the script writes the Markdown string directly
For the canonical response schema and per-mode field availability, see the official docs linked from references/parse-output-filtering.md; that file also lists the tools we suggest for filtering and reshaping the response.
Input constraint
parse.py accepts local file paths. For a document at a public URL, use the
Parse API's documented JSON URL input.
