documents.parse converts a document into structured text. It can return
markdown, plain text, layout blocks, optional chunks, image crops, spreadsheet
metadata, or an audio/video transcript 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
Method signature
Parameters
Returns
APromise<Job>. After success, narrow with isParseResult(job.result).
result.markdown is a convenience alias for result.document.markdown.
Audio and video set result.lane to "audio" or "video" and mint
result.transcript_url; result.transcript is inline on jobs.get only.
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
Configuration
Select pages and processing effort
"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
["markdown", "blocks"]. table_format accepts "html"
or "markdown" and defaults to "html". include_page_markers defaults to
true.
OCR and OCR geometry
ocr_applied reports whether it ran. The current
runtime accepts only mode: "auto" and rejects a non-empty languages array.
Figures and diagrams
figures.mode accepts "omit", "include", or "describe" and defaults to
"include". Diagram mode accepts "omit" or "mermaid" and defaults to
"omit".
Chunking
"none", which leaves document.chunks empty. Use
"page" or "section" for retrieval-oriented chunks. Use markdown for
whole-document display.
Spreadsheet controls
sheets array is rejected. Formula source text requires HTML table
output and markdown or blocks in output.formats.
Encrypted PDF
Response structure
"audio" or
"video", and transcript contains the speaker-attributed timeline on a
single-job read. See Parse response format.
Reuse a parse
Pass a successful parse job to extract, split, or ground to avoid paying for the same parse twice:parse_mode must remain "low" on a parse_result source.
Complete example
Error handling
Best practices
Request only what you use
Extra renderings, images, descriptions, and higher parse modes add work. Figure descriptions are enabled by default; pass
figures: { 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
{ type: "parse_result", job_id } to extract, split, or ground when they should read the same parse.