Web, pages and documents logo

Document to Markdown with per-page hashes and offsets

$0.02 USDC per call · Developer and security · POST /api/v1/doc-to-markdown · Id doc-to-markdown

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.

What you get

Agents cannot cite a page they cannot locate. This returns readable Markdown with a verifiable hash and character range per page, and flags scanned pages that need OCR instead of silently returning nothing.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/doc-to-markdown. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/doc-to-markdown \
  -H 'content-type: application/json' \
  -d '{"url":"https://www.irs.gov/pub/irs-pdf/fw9.pdf","pages":"1-2","max_chars":20000,"describe":true}'

Input

FieldTypeRequiredDescription
urlstring; length 1..2048nohttps URL of the document. Provide this or content_base64.
content_base64string; length 1..5592408noStandard padded base64 of the file, at most 4 MB decoded. Provide this or url.
filenamestring; length 1..255noOriginal file name; helps format detection and is kept as the extension of the suggested name.
formatstring; one of "markdown", "text"nomarkdown (default) or text (Markdown syntax removed).
pagesstring; length 0..1000noPage, sheet or slide selection such as "1-5,8", at most 200 pages. Default: the first 200.
max_charsinteger; 1000..400000noOutput cap in characters, cut at a unit boundary. Default 120000.
describebooleannoAlso suggest a file name, tags and a summary with a language model. Default false.

Example request body

{
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "pages": "1-2",
  "max_chars": 20000,
  "describe": true
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
sourceobjectnokind (url|inline), final url, filename, detected media_type, bytes and sha256 of the input file.
document_kindstring; one of "pdf", "docx", "xlsx", "pptx", "html", "markdown", "text", "csv", "json"no
formatstring; one of "markdown", "text"no
contentstringnoThe converted document; units are joined by a blank line.
unitsarray<object>no
unit_countintegernoUnits returned.
units_totalintegernoUnits in the document.
metadataone ofno
tables_countintegerno
truncatedbooleannoTrue when max_chars, a page cap, a row cap or the time budget left content out.
notesarray<string>no
deterministicbooleannoTrue when no model was used for this result.
describeobjectnoWith describe=true: suggested_filename, doc_type, tags, summary and evidence_quotes verified to appear in the content; null otherwise or when the model is unavailable.
llmobjectnostatus (ok|skipped|unavailable), provider and model when ok, reason when unavailable.
limitsobjectnomax_bytes, max_chars, offsets convention and what is not covered.

Pay and connect

Available through: x402 (USDC on Base), MCP, RapidAPI, Apify.

Machine-readable