
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.
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
| Field | Type | Required | Description |
|---|---|---|---|
url | string; length 1..2048 | no | https URL of the document. Provide this or content_base64. |
content_base64 | string; length 1..5592408 | no | Standard padded base64 of the file, at most 4 MB decoded. Provide this or url. |
filename | string; length 1..255 | no | Original file name; helps format detection and is kept as the extension of the suggested name. |
format | string; one of "markdown", "text" | no | markdown (default) or text (Markdown syntax removed). |
pages | string; length 0..1000 | no | Page, sheet or slide selection such as "1-5,8", at most 200 pages. Default: the first 200. |
max_chars | integer; 1000..400000 | no | Output cap in characters, cut at a unit boundary. Default 120000. |
describe | boolean | no | Also 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.
| Field | Type | Required | Description |
|---|---|---|---|
source | object | no | kind (url|inline), final url, filename, detected media_type, bytes and sha256 of the input file. |
document_kind | string; one of "pdf", "docx", "xlsx", "pptx", "html", "markdown", "text", "csv", "json" | no | |
format | string; one of "markdown", "text" | no | |
content | string | no | The converted document; units are joined by a blank line. |
units | array<object> | no | |
unit_count | integer | no | Units returned. |
units_total | integer | no | Units in the document. |
metadata | one of | no | |
tables_count | integer | no | |
truncated | boolean | no | True when max_chars, a page cap, a row cap or the time budget left content out. |
notes | array<string> | no | |
deterministic | boolean | no | True when no model was used for this result. |
describe | object | no | With 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. |
llm | object | no | status (ok|skipped|unavailable), provider and model when ok, reason when unavailable. |
limits | object | no | max_bytes, max_chars, offsets convention and what is not covered. |
Pay and connect
Available through: x402 (USDC on Base), MCP, RapidAPI, Apify.
Machine-readable
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent