Skip to main content
documents.extract pulls structured data from a document into a JSON object you define. Supply an inline JSON Schema or the ID of a registered schema. Every declared field receives a status. not_found means NDI examined the document and did not find the value; it is not an HTTP or job failure.

Basic usage


Method signature

Parameters

Returns

A Job. After success, job.result is an ExtractResult: With delivery="progressive", read the job using client.jobs.get(job_id). A running job can already contain values with enrichment_status="pending". Continue reading the same job to receive the final highlights. jobs.wait waits for terminal status, so use individual reads when showing early values. Parquet extraction currently returns its result at completion.

Define the schema

Use the supported JSON Schema subset to describe the exact shape you need:

Write specific descriptions

Descriptions guide extraction and should distinguish similar values:
instructions can clarify how to fill these fields, but it cannot add fields that the schema does not declare:

Validate before extracting

Schema validation creates no job and spends no credits:
The response contains every discovered error and the normalized schema when validation succeeds.

Use a registered schema

Create and publish reusable schemas through the REST extraction-schema endpoints. The Python SDK does not currently expose a schema-registry namespace. See Extraction schemas.

Source options

Extract accepts staged uploads, HTTPS URLs, workspace files, and successful parse jobs. Reuse a parse when another operation already produced the content:
page_ranges is unavailable with ParseResultSource because the selected content is already fixed. Use page ranges when extracting from an original source:

Citations

Citations are enabled by default. Each field can carry the location and source text that supports its value:
Disable citations only when you do not need source verification:

Response structure

Use data for the schema-shaped answer and fields for verification and status handling. Missing values remain present as None; they are not silently dropped.

Extract response format

Review field statuses, confidence, citation locations, warnings, and registered schema metadata.

Async extract


Complete example


Error handling

Client-side ValueError is raised when both json_schema and schema_id are set, or when neither is set.

Best practices

Validate first

Preflight a schema without creating a job or spending credits.

Describe each field

State which value to select, how to distinguish it, and the expected representation.

Keep citations on

Preserve the locations and source text needed to verify extracted values.

Inspect not_found

Treat a missing field as a document-level answer rather than a failed request.

Next steps