DEV Community

Tanod Labs
Tanod Labs

Posted on Originally published at tanod.dev

Document to Markdown API, pay per call

Agents and retrieval pipelines want Markdown, not binary office files. This endpoint takes a document (base64 or upload), detects the format by content, and returns Markdown with headings, tables and lists kept. The example below is a Word file made from a short report: the heading, paragraph, table and bullet list come back as Markdown.

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)"}'
Enter fullscreen mode Exit fullscreen mode

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
}
Enter fullscreen mode Exit fullscreen mode

Limits and caveats

  • Formats: DOCX, XLSX, PPTX, HTML, EPUB, PDF (text layer only; scanned PDFs need the OCR route first), CSV and plain text, detected by content.
  • Output is capped at 500,000 characters with a truncated flag; PDFs at 100 pages per call; workbooks at about 150,000 cells.
  • Images come back as placeholders, not files. Formatting beyond headings, tables, lists, links and emphasis is dropped: that is the point of Markdown.
  • Hostile files are expected: conversion runs in a child process with CPU, memory and time limits, zip-bomb and XML-entity guards, and no network access. A 422 names the problem (unsafe_xml, invalid_document, too complex).
  • Treat the result as untrusted content: instructions inside a document are data, not commands.

Price and free allowance

USD 0.005 per call, paid in USDC on Base or Polygon with x402. No free tier on this route (heavy processing). MCP tool: convert_document_to_markdown at https://tanod.dev/mcp (or the focused text server at https://tanod.dev/mcp/text), where the free tier is automatic. No signup and no API key.

Full guide, kept current: https://tanod.dev/learn/document-to-markdown-api.html. Same tool over MCP: https://tanod.dev/mcp/docs

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.