Skip to main content
Document operations are workspace-free: supply a document source and get back results. Every job-creating endpoint returns 202 immediately and accepts ?wait_seconds=N to block up to N seconds (max 300) for the result inline. wait_seconds is a query parameter, not a request body field. Idempotency-Key is an HTTP header, not a request body field. Strict request models refuse extra body fields.

Source types

The five job-creating operations (parse, split, classify, extract, ground) accept the shared document source union. Schema validation is synchronous and validates a schema structure only — it does not accept a document source.
See Sources and uploads for details.

Parse

Convert any document into structured text, Markdown, or block JSON. OCR is applied automatically when the document needs it. Query parameters:
  • wait_seconds (optional, default 0, max 300) — Block up to N seconds for the result inline. 0 returns 202 immediately.
Headers:
  • Idempotency-Key (optional, max 200 chars) — Replaying with the same key returns the original job.
Request body:
Body fields:
  • source (required) — Document source discriminator.
  • page_ranges (optional) — One or more 1-indexed inclusive page ranges. Omit to parse all pages.
  • password (optional) — PDF user/owner password for encrypted uploads/URLs. Write-only: never stored in the job payload or returned in any response. Rejected with parse_result sources. Ignored when the PDF is not encrypted. Non-PDF sources with a password fail with invalid_request.
  • output.formats (optional, default ["markdown", "blocks"]) — One or more of "markdown", "text", "blocks".
  • output.table_format (optional, default "html") — Render tables as "html" or GitHub-flavored "markdown".
  • output.include_images (optional, default false) — Include extracted figure crops in the parsed output. Works for PDF and image uploads (png / jpg / jpeg / webp).
  • output.include_page_markers (optional, default true) — Insert --- Page N --- headers between PDF pages in markdown and text. Page chunking still uses these headers internally when this is false.
  • figures.mode (optional, default "include") — "omit", "include", or "describe". Describe captions figure blocks (PDF and image). Independent of diagrams.mode.
  • diagrams.mode (optional, default "omit") — "omit" or "mermaid". When omit, flowchart mermaid is stripped and node/edge labels are flattened into overlay text. When mermaid, fences stay and figures.mode=describe still appends a Figure: caption.
  • chunking.strategy (optional, default "none") — "none", "page", or "section". Generated chunks are returned in document.chunks.
When source.type is parse_result, page selection and output.include_images are not supported because NDI reuses the prior Parse result instead of reading the original document again. Example (wait for result):
Response (202 — queued, or 200 — terminal when wait_seconds hit):
Result fields:
  • file_name — Name of the parsed file.
  • document.page_count — Total pages in the document.
  • document.markdown — Present when "markdown" was in output.formats.
  • document.text — Present when "text" was in output.formats.
  • document.blocks — Present when "blocks" was in output.formats; list of structural blocks.
  • document.chunks — RAG-oriented chunks produced by the selected chunking.strategy; empty for "none".
  • ocr_applied — Whether OCR ran.
  • units — Processing units consumed (for billing).

Split

Split a paged document into logical, classified page ranges. For spreadsheets, Split deterministically creates one segment per worksheet, then classifies each worksheet against the provided classes. Query parameters:
  • wait_seconds (optional, default 0, max 300)
Headers:
  • Idempotency-Key (optional)
Request body:
Body fields:
  • source (required) — One upload, URL, workspace-file, or supported Parse-result source.
  • classes (required) — Target segment categories with stable id values and optional subclasses. Spreadsheet worksheets are classified against the same two-level leaf classes and can return more than one match.
  • unknown_policy (optional, default "include") — Whether unclassified pages or worksheet segments are included, forced, or rejected.
  • overlap_policy (optional, default "exclusive") — How adjacent candidate ranges are reconciled. "shared_boundary_page" is reserved for a future runtime.
  • output.include_content (optional, default false) — Include segment content in the result.
  • output.materialize_files (optional, default false) — Materialize document segments as child artifacts. Spreadsheet segments always materialize as single-sheet .xlsx artifacts regardless of this option.
page_ranges is not supported for spreadsheet sources. Spreadsheet sheet position is represented as start_page == end_page == sheet_index + 1. Result:
Result fields:
  • segments — Ordered page-range segments for the document.
  • class — The selected class for the segment, or null for unclassified segments.
  • classes — Multi-class set for spreadsheet worksheet segments. Document/PDF segments keep the singular class field and return null here.
  • start_page / end_page — Inclusive 1-indexed page range.
  • sheet_name — Worksheet name for spreadsheet segments; null for document segments.
  • classification_confidence — Confidence band and optional calibrated score for the selected class.
  • boundary_confidence — Confidence band and optional calibrated score for the segment boundaries.
  • artifacts — Materialized child files when requested for documents; always one single-sheet .xlsx for spreadsheet segments.
  • warnings — Non-fatal notes about the segment.

Classify

Classify one document against caller-provided classes. Use granularity: "document" for one document-level label unit, or granularity: "page" for one label unit per page. page_ranges restricts which pages are parsed and classified. Query parameters:
  • wait_seconds (optional, default 0, max 300)
Headers:
  • Idempotency-Key (optional)
Request body:
Body fields:
  • source (required) — One upload, URL, or workspace-file source. parse_result reuse is intentionally rejected for Classify.
  • classes (required) — One or more classes with stable id, human label, optional description, optional criteria, and optional subclasses.
  • granularity (optional, default "document") — "document" or "page".
  • page_ranges (optional) — One-based inclusive page ranges. Valid for paged document sources.
  • unknown_policy (optional, default "allow") — "allow" returns an unknown unit with its detected Other / … label; "force_best" requires the classifier to select the best configured class.
  • output.max_alternatives (optional, default 3) — Maximum ranked labels per unit.
  • output.include_reason (optional, default true) — Include model reasons in labels.
Result:
Result fields:
  • units — One document unit or one unit per page, depending on granularity.
  • page_range — Page coverage for the unit, or null when not available.
  • unknowntrue when no provided class was selected. The detected freeform type remains in labels under class other.
  • labels — Ranked class assignments with their reason and coverage-derived confidence. Confidence is the fraction of the unit’s pages or sheets assigned that label, not a calibrated model probability.

Extract

Extract schema-shaped structured data from a document. Exactly one of schema_id or schema must be present. Query parameters:
  • wait_seconds (optional, default 0, max 300)
Headers:
  • Idempotency-Key (optional)
Request body:
Body fields:
  • source (required) — Document source.
  • schema_id (optional) — A registered schema identifier from /v1/extraction-schemas. Mutually exclusive with schema.
  • schema_version (optional, ≥ 1) — Pin a registry version when using schema_id. Omit to resolve the latest visible version.
  • schema (optional) — Inline JSON Schema. Mutually exclusive with schema_id. Pre-validate with POST /v1/extract/schema-validation.
  • instructions (optional) — Additional guidance for finding values declared by the schema. Instructions cannot add undeclared result fields.
  • page_ranges (optional) — One or more 1-indexed inclusive page ranges. Not supported with a parse_result source.
  • citations.enabled (optional, default true) — Attach per-field citations when values can be located.
  • citations.include_source_text (optional, default true) — Include a short source quote in citations.
Result:
Result fields:
  • data — The extracted object shaped by the submitted schema.
  • fields — One entry per schema field. Status is found, not_found, or ambiguous. A field the model could not locate is explicitly not_found, never silently omitted.
  • fields[*].citations — Per-field locations and source text tracing found values back to the source document.
  • schema_id / schema_version — Set when Extract resolved a registry schema; null for inline schema.
  • warnings — Non-fatal notes about the request, such as instructions that no declared schema field can satisfy.

Extract schema validation

Validate an extraction schema without creating a job. Synchronous — returns 200 immediately. Request body:
Body fields:
  • schema (optional) — Inline JSON Schema to validate. Mutually exclusive with schema_id.
  • schema_id (optional) — Registered schema from /v1/extraction-schemas. Mutually exclusive with schema.
  • schema_version (optional, ≥ 1) — Pin a registry version when using schema_id.
Response (valid):
Response (invalid):
Use this before submitting an extract job to catch schema errors without consuming processing units.

Ground

Locate target text in a document. Each target is assessed independently as found, not_found, or failed, with ranked matches that report how the location was found. Ground is target location, not claim verification. It locates target text and reports location status only. Query parameters:
  • wait_seconds (optional, default 0, max 300)
Headers:
  • Idempotency-Key (optional)
Request body:
Body fields:
  • source (required) — Document source.
  • targets (required) — Array of 1–30 target texts to locate.
    • id — Caller-assigned identifier, echoed in the result.
    • text — Text or phrase to locate.
    • hint (optional) — Nearby text that helps disambiguate matches.
    • page_hints (optional) — 1-based page numbers to search first.
  • options.max_matches (optional, default 10) — Maximum ranked matches per target.
  • options.minimum_semantic_score (optional) — Minimum score from 0 to 1 for semantic matches.
  • options.include_previews (optional, default false) — Generate source-image crops when a visual region is available.
Legacy claims[] requests remain accepted during rollout, but new integrations should send targets[]. Result:
Result fields:
  • targets — One entry per input target, in the same order.
  • statusfound, not_found, or failed.
  • matches — Ranked locations for found targets.
  • match_methodexact, normalized, or semantic.
  • confidencenull for exact and normalized matches; set only for probabilistic semantic matches.
  • cropped_image_url — Authenticated crop URL when previews were requested and a visual region is available; otherwise null. Send the same X-API-Key header when fetching it. See Get a Ground crop.

Job lifecycle

All five job-creating endpoints (parse, split, classify, extract, ground) follow the same pattern:
  1. 202 immediately when wait_seconds=0 (default). Poll GET /v1/jobs/{job_id}.
  2. 200 with terminal result when wait_seconds=N and the job finished within N seconds.
  3. 202 with running job when wait_seconds=N but the job did not finish in time. Still poll.
Read status regardless of whether the response is 200 or 202. See Jobs, idempotency, and async semantics for the full job lifecycle.