Skip to main content
New audio/video processing is unsupported. Media-specific response fields and transcript links below describe historical results, which remain readable. documents.parse converts a document into structured text. It can return markdown, plain text, layout blocks, optional chunks, image crops, spreadsheet metadata depending on the source and options. OCR runs automatically when the document needs it. Read ocr_applied on the result to see whether it ran.

Basic usage


Zero-retention workspace delivery

Pass result_delivery="workspace" with a workspace-file source and an explicit output_workspace_id. split, classify, extract and ground take the same two arguments. After the job succeeds, use client.jobs.download_output(job.job_id) to fetch the result JSON. See workspace delivery for artifact paths and access rules.

Method signature

Parameters

Returns

A Job. After success, job.result is a ParseResult: Ordinary results keep the requested content inline and leave content_url null. An oversized Office package that uses structural-text parsing exposes complete extracted text at document.content_url and reports parse_fidelity with mode="reduced_layout". Separately, when a finalized document result is too large, Markdown/text is a bounded preview, document.content_url contains the complete finalized content, and a content_truncated disclosure has target="document_content". Oversized workbooks use target="spreadsheet_region" and expose complete Markdown under each affected document.spreadsheet.sheets[].content_url. Fetch these URLs with the same X-API-Key used by the client.

Source options

Staged upload

Public or presigned URL

Workspace file

See Sources and uploads for lifecycle and access rules.

Configuration

Select pages and processing effort

Use low for the default native path, medium to route to the best parser, and high when page-level verification and correction justify additional latency.

Choose output formats

The default formats are markdown and blocks. Omitted renderings are None. table_format accepts html or markdown and defaults to html. include_page_markers defaults to True.

OCR and OCR geometry

OCR mode is automatic, and ParseResult.ocr_applied reports whether it ran. Although ParseOcrOptions exposes languages, the current runtime rejects a non-empty language list.

Figures and diagrams

figures.mode accepts omit, include, or describe and defaults to include. Diagram mode accepts omit or mermaid and defaults to omit. With output.include_images=True, a figure that cannot be cropped keeps image_url: null; the job still succeeds.

Chunking

Chunking defaults to none, which leaves document.chunks empty. Use page or section for retrieval-oriented chunks. Use markdown for whole-document display.

Spreadsheet controls

An empty sheets list is rejected. Formula source text requires HTML table output and markdown or blocks in output.formats.

Encrypted PDF

The password applies only to PDF sources and is excluded from stored job requests and representations. On any other source the request is accepted, then the job fails with error.code invalid_request.

Response structure

Layout block locations vary by source: pages use normalized polygons, workbooks use sheet ranges, tables can use row ranges, and structured text can use JSON pointers or character spans. New audio/video processing is not supported. Previously saved transcripts remain readable; see historical Parse results.

Reuse a parse

Pass a successful parse job to extract, split, or ground to avoid paying for the same parse twice:
Classify, Split, Extract and Ground accept a parse-result source. In Extract, page_ranges keeps only those pages of the reused parse, and a reused parse cannot add images that were not already produced.

Async parse

Use the async client guide for bounded concurrent processing.

Complete example


Error handling

Common failures include an unsupported format, a corrupt file, invalid page ranges, a wrong PDF password, or options incompatible with the source.

Best practices

Request only what you use

Extra renderings, images, descriptions, and higher parse modes add work. Figure descriptions are enabled by default; pass ParseFiguresOptions(mode="omit") when you do not need them.

Inspect OCR status

Use ocr_applied rather than assuming every document was OCR-processed.

Chunk for retrieval

Choose page or section chunking for RAG. Keep whole-document markdown for display.

Reuse successful parses

Pass ParseResultSource to extract, split, or ground when they should read the same parse.

Next steps

Streaming previews

Submit with wait_seconds=0 and observe the same job through the preview methods. No stream request flag is required. See Parse streaming for reconnects, provisional output, format/effort behavior, limits, cache and Zero retention.