doc_to_markdown
Convert PDF, DOCX, XLSX, PPTX, HTML, Markdown, CSV, JSON or text files into Markdown or plain text, with page, sheet or slide offsets and hashes for accurate agent reading and citation checks.
Instructions
Document to Markdown with per-page hashes and offsets. Converts a PDF (text layer), DOCX, XLSX or PPTX file, or normalizes an HTML, Markdown, text, CSV or JSON file, into Markdown (or plain text) for an agent that must read or cite a document. Give an https URL or up to 4 MB as base64. Returns the content plus one unit per page, sheet or slide with its exact character range in the content and a SHA-256 of that unit's text, so later quote and citation checks can anchor to a page. Headings, lists, tables and links are kept for DOCX; sheets become tables; slides become sections. Set describe to also get a suggested descriptive file name, tags and a one-line summary (a fast model reads the first 6,000 characters; its quotes are checked against the text). It does NOT run OCR: scanned PDF pages are flagged needs_ocr and come back empty. Images, comments, notes, headers and footers are ignored, legacy .doc/.xls/.ppt and password-protected files are refused, and ZIP64 is unsupported.
Cost: 0.02 USDC per call, paid automatically over x402 on Base when AGENT_PRIVATE_KEY is configured and the price is within MAX_USDC_PER_CALL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | https URL of the document. Provide this or content_base64. | |
| pages | No | Page, sheet or slide selection such as "1-5,8", at most 200 pages. Default: the first 200. | |
| format | No | markdown (default) or text (Markdown syntax removed). | |
| describe | No | Also suggest a file name, tags and a summary with a language model. Default false. | |
| filename | No | Original file name; helps format detection and is kept as the extension of the suggested name. | |
| max_chars | No | Output cap in characters, cut at a unit boundary. Default 120000. | |
| content_base64 | No | Standard padded base64 of the file, at most 4 MB decoded. Provide this or url. |