Document to Markdown API: Word, Excel, PowerPoint, HTML, EPUB and PDF to Markdown

Updated 2026-11-10

Use when an agent must read a Word, Excel, PowerPoint, PDF, HTML or EPUB file as Markdown text.

From an MCP client, add https://tanod.dev/mcp and call convert_document_to_markdown; calls are paid per use with x402, no key or signup.

POST /v1/docs/to-markdown turns a document (base64 or upload) into Markdown that agents and retrieval pipelines can read. It detects the format by content and keeps headings, tables and lists. In the example, a Word file made from a short report comes back with its heading, paragraph, table and bullet list as Markdown.

Try a bounded free preview

Set preview: true and send X-Tanod-Free: 1 over HTTP. In MCP, pass preview: true to convert_document_to_markdown (do not set tanod/free=false). One attempt per caller IP per UTC day, within a separate global daily budget. Input is at most 1,000,000 bytes; only the first 3 PDF pages are processed and output stops at 5,000 characters. The response always says preview=true and truncated=true, even for a short document; PDF page counts and coverage describe only the preview window. No OCR is run.

Other formats have smaller parse limits: text, HTML and CSV use a 32,000-character prefix; ZIP-based documents must have at most 100 entries, 256,000 expanded bytes total and 64,000 bytes per part; CSV tables at most 10,000 padded cells. Larger packages are refused before conversion. Failed attempts count. Previews do not use payment credentials; a refused preview with credentials returns 409 preview_payment_not_used, not another payment challenge. Resend the credential with preview: false before expiry for full output. Without credentials, exhaustion returns a 402 quoting the normal full price (ChatGPT mode: capacity error). Full calls are free within connector allowances where applicable; otherwise USD 0.005 with the full-conversion limits. This direct HTTP/MCP preview is not available through prepaid marketplace channels.

Free bounded preview, not a full conversion
curl -s https://tanod.dev/v1/docs/to-markdown \
  -H 'content-type: application/json' -H 'X-Tanod-Free: 1' \
  -d '{"url":"https://tanod.dev/samples/tables-sample.pdf","preview":true}'

Request

curl (an x402 client pays the 402; shown without the payment header)
curl -s -X POST https://tanod.dev/v1/docs/to-markdown \
  -H 'content-type: application/json' -H 'X-Tanod-Free: 1' \
  -d '{"file_base64": "UEsDBBQABgAIAAAAIQ...(the .docx, base64)"}'

Response

Response (from the live code, trimmed)
{
  "operation": "to-markdown",
  "format": "docx",
  "characters": 201,
  "truncated": false,
  "markdown": "# Quarterly summary\n\nRevenue grew 12% quarter over quarter. Two risks remain open.\n\n|  |  |\n| --- | --- |\n| Region | Revenue |\n| EMEA | 1.2M |\n| APAC | 0.9M |\n\n* Hire two engineers\n* Close the EU audit",
  "untrusted_content": true
}

PDFs that trip converters

Word files with tracked changes

A redlined DOCX still holds the deleted text, marked as a deletion, so a converter that reads the raw XML can return a clause the author deleted. This route applies tracked changes as if they were accepted: deleted text is left out and inserted text is kept. Checked on 14 October 2026 with a DOCX holding one tracked deletion and one tracked insertion, through the same converter the route runs. The Markdown shows the accepted text only, not who changed what; to see the differences between two versions, send both to POST /v1/docs/compare (changed paragraphs and table rows with a word-level diff, and an optional redline DOCX or PDF; USD 0.01). The same conversion runs as an Apify actor for use without a wallet.

Tokens per page, before and after

A PDF sent straight to a model costs more than its words. Anthropic’s PDF support documentation (Estimate your costs, read 15 October 2026) says each page typically uses 1,500–3,000 text tokens depending on content density, and because each page is also converted into an image, image token costs are added on top. Measured on 15 October 2026 with a public 15-page research paper (arXiv 1706.03762): its text layer is 39,496 characters, about 2,600 characters a page, or roughly 660 tokens a page at the usual estimate of four characters per token. Converted to Markdown first, the model reads that text once, with no page images. The saving is largest on text-heavy files; a scan has no text layer, so run PDF OCR first, and keep the PDF when the model must see a chart or a layout.

How it compares

Other pay-per-call document-to-Markdown APIs that the Agent402 router returned for "convert a pdf to markdown" on 13 October 2026, with their listed prices:

This route costs USD 0.005 and takes Word, Excel, PowerPoint, PDF, HTML, EPUB or CSV, so one call covers mixed document sets. For scanned PDFs, an AI layout engine such as the first one above is the better fit. Prices are as listed on that date and change; check each 402.

Limits and caveats

Files it refuses, and why

A converter that treats anything it cannot parse as plain text will pass whatever bytes arrive to the agent's model: an executable decoded as text, or a file full of hidden instructions. This one checks the bytes against a fixed list of formats. Text must decode cleanly, with no NUL byte and under 1% control characters at the start. Anything else gets a 415 that names the reason and lists the supported formats. That covers executables (ELF, Windows .exe), images, archives (gzip, bzip2, xz, 7z, RAR), audio and video, SQLite databases, and old binary Office files (.doc, .xls, .ppt, .msg). A refused file is not charged, because payment settles only on a 200 answer. Source code and other plain text are converted as text, so treat that output as untrusted data as well.

A .docx that fails with "File is not a zip file". A real .docx is a ZIP archive and starts with the bytes PK. Some files named .docx are old Word 97-2003 documents saved with the new extension, and those start with D0 CF 11 E0. Libraries that trust the extension then fail with "File is not a zip file". This converter checks the bytes, not the name, so it answers with a 415 naming the old binary format instead of a confusing ZIP error, and the call is not charged. To convert it, open the file in Word or LibreOffice and save it as .docx.

How the fetch is guarded. Only public http and https addresses on ports 80 and 443 are fetched. The host name is resolved once and the connection is pinned to the address that was checked, so a DNS answer that changes between the check and the request (DNS rebinding) cannot redirect it to an internal address; a name with any private or internal record is refused, and every redirect hop is checked again. A refused address is a 422 and is not charged.

Price and free allowance

USD 0.005 per call, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum with x402. Full conversions have no general free tier; explicit bounded previews are free within their own daily limits. MCP tool: convert_document_to_markdown at https://tanod.dev/mcp (or the focused docs server at https://tanod.dev/mcp/docs). Shared connector allowances also apply. No signup and no API key.

Paying by card instead? The same conversion runs as an Apify actor, PDF to Markdown & Text Extractor (tanod/document-to-markdown), billed through your Apify account at USD 0.01 per converted document (failed files are free); give it a list of file URLs and get the converted files back in the run's storage.

Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/docs?via=document-to-markdown-api as a custom connector (steps), then ask in plain words, for example "Turn this Word file into Markdown." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.

Updated 2026-10-08. Related guides: PDF to Word API, PDF OCR API, Compress PDF API. All guides, or back to tanod.dev.