{"id":"doc-to-markdown","title":"Document to Markdown with per-page hashes and offsets","description":"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.","roi":"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.","audience":"developer","channels":["x402","mcp","rapidapi","apify"],"endpoint":{"method":"POST","url":"https://agents.writerslogic.com/api/v1/doc-to-markdown","path":"/api/v1/doc-to-markdown","contentType":"application/json"},"price":{"amount":"0.02","currency":"USDC","network":"base","perCall":true,"failedCallsCharged":false},"inputSchema":{"type":"object","additionalProperties":false,"properties":{"url":{"type":"string","minLength":1,"maxLength":2048,"description":"https URL of the document. Provide this or content_base64."},"content_base64":{"type":"string","minLength":1,"maxLength":5592408,"description":"Standard padded base64 of the file, at most 4 MB decoded. Provide this or url."},"filename":{"type":"string","minLength":1,"maxLength":255,"description":"Original file name; helps format detection and is kept as the extension of the suggested name."},"format":{"type":"string","enum":["markdown","text"],"description":"markdown (default) or text (Markdown syntax removed)."},"pages":{"type":"string","maxLength":1000,"description":"Page, sheet or slide selection such as \"1-5,8\", at most 200 pages. Default: the first 200."},"max_chars":{"type":"integer","minimum":1000,"maximum":400000,"description":"Output cap in characters, cut at a unit boundary. Default 120000."},"describe":{"type":"boolean","description":"Also suggest a file name, tags and a summary with a language model. Default false."}}},"resultSchema":{"type":"object","properties":{"source":{"type":"object","description":"kind (url|inline), final url, filename, detected media_type, bytes and sha256 of the input file."},"document_kind":{"type":"string","enum":["pdf","docx","xlsx","pptx","html","markdown","text","csv","json"]},"format":{"type":"string","enum":["markdown","text"]},"content":{"type":"string","description":"The converted document; units are joined by a blank line."},"units":{"type":"array","items":{"type":"object","description":"index (page/sheet/slide number), label, char_start, char_end (content.slice(char_start, char_end) is the unit), sha256 of that text, needs_ocr, truncated."}},"unit_count":{"type":"integer","description":"Units returned."},"units_total":{"type":"integer","description":"Units in the document."},"metadata":{"anyOf":[{"type":"object","description":"title, author, created, modified, page_count; null when absent."},{"type":"null"}]},"tables_count":{"type":"integer"},"truncated":{"type":"boolean","description":"True when max_chars, a page cap, a row cap or the time budget left content out."},"notes":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"True when no model was used for this result."},"describe":{"type":"object","description":"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":{"type":"object","description":"status (ok|skipped|unavailable), provider and model when ok, reason when unavailable."},"limits":{"type":"object","description":"max_bytes, max_chars, offsets convention and what is not covered."}}},"outputSchema":{"type":"object","properties":{"data":{"type":"object","properties":{"source":{"type":"object","description":"kind (url|inline), final url, filename, detected media_type, bytes and sha256 of the input file."},"document_kind":{"type":"string","enum":["pdf","docx","xlsx","pptx","html","markdown","text","csv","json"]},"format":{"type":"string","enum":["markdown","text"]},"content":{"type":"string","description":"The converted document; units are joined by a blank line."},"units":{"type":"array","items":{"type":"object","description":"index (page/sheet/slide number), label, char_start, char_end (content.slice(char_start, char_end) is the unit), sha256 of that text, needs_ocr, truncated."}},"unit_count":{"type":"integer","description":"Units returned."},"units_total":{"type":"integer","description":"Units in the document."},"metadata":{"anyOf":[{"type":"object","description":"title, author, created, modified, page_count; null when absent."},{"type":"null"}]},"tables_count":{"type":"integer"},"truncated":{"type":"boolean","description":"True when max_chars, a page cap, a row cap or the time budget left content out."},"notes":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"True when no model was used for this result."},"describe":{"type":"object","description":"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":{"type":"object","description":"status (ok|skipped|unavailable), provider and model when ok, reason when unavailable."},"limits":{"type":"object","description":"max_bytes, max_chars, offsets convention and what is not covered."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]},"example":{"url":"https://www.irs.gov/pub/irs-pdf/fw9.pdf","pages":"1-2","max_chars":20000,"describe":true},"openapiOperation":{"operationId":"doc_to_markdown","summary":"Document to Markdown with per-page hashes and offsets","description":"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.\n\nPrice: 0.02 USDC on Base (x402).","x-x402-price-usdc":"0.02","x-x402-amount":"20000","x-audience":"developer","x-sample-url":"https://agents.writerslogic.com/api/v1/samples/doc-to-markdown","security":[{"x402":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"url":{"type":"string","minLength":1,"maxLength":2048,"description":"https URL of the document. Provide this or content_base64."},"content_base64":{"type":"string","minLength":1,"maxLength":5592408,"description":"Standard padded base64 of the file, at most 4 MB decoded. Provide this or url."},"filename":{"type":"string","minLength":1,"maxLength":255,"description":"Original file name; helps format detection and is kept as the extension of the suggested name."},"format":{"type":"string","enum":["markdown","text"],"description":"markdown (default) or text (Markdown syntax removed)."},"pages":{"type":"string","maxLength":1000,"description":"Page, sheet or slide selection such as \"1-5,8\", at most 200 pages. Default: the first 200."},"max_chars":{"type":"integer","minimum":1000,"maximum":400000,"description":"Output cap in characters, cut at a unit boundary. Default 120000."},"describe":{"type":"boolean","description":"Also suggest a file name, tags and a summary with a language model. Default false."}}},"example":{"url":"https://www.irs.gov/pub/irs-pdf/fw9.pdf","pages":"1-2","max_chars":20000,"describe":true}}}},"responses":{"200":{"description":"Paid result with provenance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"source":{"type":"object","description":"kind (url|inline), final url, filename, detected media_type, bytes and sha256 of the input file."},"document_kind":{"type":"string","enum":["pdf","docx","xlsx","pptx","html","markdown","text","csv","json"]},"format":{"type":"string","enum":["markdown","text"]},"content":{"type":"string","description":"The converted document; units are joined by a blank line."},"units":{"type":"array","items":{"type":"object","description":"index (page/sheet/slide number), label, char_start, char_end (content.slice(char_start, char_end) is the unit), sha256 of that text, needs_ocr, truncated."}},"unit_count":{"type":"integer","description":"Units returned."},"units_total":{"type":"integer","description":"Units in the document."},"metadata":{"anyOf":[{"type":"object","description":"title, author, created, modified, page_count; null when absent."},{"type":"null"}]},"tables_count":{"type":"integer"},"truncated":{"type":"boolean","description":"True when max_chars, a page cap, a row cap or the time budget left content out."},"notes":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"True when no model was used for this result."},"describe":{"type":"object","description":"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":{"type":"object","description":"status (ok|skipped|unavailable), provider and model when ok, reason when unavailable."},"limits":{"type":"object","description":"max_bytes, max_chars, offsets convention and what is not covered."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]}}}},"400":{"description":"Invalid request (no payment consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"401":{"description":"Invalid X-API-KEY","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"402":{"description":"Payment required or invalid","content":{"application/json":{"schema":{"type":"object","description":"x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"resource":{"type":"object"},"accepts":{"type":"array","items":{"type":"object"}},"extensions":{"type":"object"}}}}}},"502":{"description":"Upstream failure; the payment is released or not settled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}}},"links":{"docs":"https://writerslogic.com/agents/doc-to-markdown/","docsJson":"https://writerslogic.com/agents/doc-to-markdown.json","sample":"https://agents.writerslogic.com/api/v1/samples/doc-to-markdown","openapi":"https://agents.writerslogic.com/openapi.json","catalog":"https://agents.writerslogic.com/api/v1/catalog","verifyProvenance":"https://agents.writerslogic.com/api/v1/verify-provenance","index":"https://writerslogic.com/agents/index.json"}}