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
Exactly one of
json_schema or schema_id is required. The SDK throws a
client-side Error when both are supplied or neither is.
Returns
APromise<Job>. On success, result.result_type === "extract".
With delivery: "progressive", read the job using client.jobs.get(jobId).
A running job can already contain values with enrichment_status: "pending".
Continue reading the same job to receive final highlights. jobs.wait waits
for terminal status. enrichment_status becomes complete or degraded;
job status remains authoritative for completion or cancellation. 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 declared fields, but cannot add fields
that the schema does not declare:
Validate before extracting
Schema validation creates no job and spends no credits:Use a registered schema
POST /v1/extraction-schemas). The TypeScript SDK does not
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 a parse_result source 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:Response structure
data for the schema-shaped answer and fields for verification and
status handling. Missing values remain present as null; they are not silently
dropped.
Extract response format
Review field statuses, confidence, citation locations, warnings, and registered schema metadata.
Complete example
Error handling
Error is thrown 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.