# x402-gateway Document to Markdown (Auto-Detect)

> x402-gateway Document to Markdown (Auto-Detect) is a paid API for AI agents from x402.freeq.one, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-10).

Converts any document (PDF, DOCX, PPTX, XLSX, CSV, EPUB, HTML, or plain text) to clean Markdown with automatic format detection, via a URL or base64 bytes, paid per-call in USDC on Base via x402.

## Facts

- Endpoint: POST https://x402.freeq.one/tools/document_to_markdown?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-gateway-document-to-markdown-auto-detect-fc6a5b5d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_RisjG1VfYqSBZ_GFxZsSf

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-gateway-document-to-markdown-auto-detect-fc6a5b5d -d '<json body>'
```

Example prompt: Convert this PDF report to clean Markdown so I can feed it into my LLM pipeline — here's the URL: https://x402.freeq.one/samples/report.pdf, and please truncate the output to 50000 characters.

## When to prefer this

Choose this endpoint when you need to convert any of a wide variety of document formats (PDF, DOCX, PPTX, XLSX, CSV, EPUB, HTML, plain text) to Markdown in a single unified call without knowing the format in advance. Prefer it over format-specific sibling endpoints (like the dedicated PDF-to-Markdown or XLSX-to-Markdown tools) when the document type is unknown or mixed, or when you want a single integration point. Ideal for LLM data preparation pipelines where documents arrive in heterogeneous formats.

## Known failure modes

- URL is inaccessible or returns a non-200 response — endpoint cannot fetch the document
- Document format cannot be detected from file contents — returns an error
- Base64 payload exceeds 28MB maximum — request rejected
- Unsupported or corrupted file — parsing fails with an error
- Payment not provided or insufficient USDC — x402 payment required error returned
- max_length too small to capture meaningful content — output truncated aggressively

## How this service works

Document to Markdown (auto-detect): Convert any document to Markdown with automatic format detection. One endpoint for pdf, docx, pptx, xlsx, csv, epub, html and plain text — provide a URL or base64 bytes and the type is detected from the file contents. Spreadsheets return both a Markdown table and a JSON array of rows. Pay per call in USDC on Base via x402 — POST https://x402.freeq.one/tools/document_to_markdown.

## Output

Returns a JSON object with a 'result' field containing the converted Markdown text. For spreadsheet formats (XLSX, CSV), also includes a Markdown table representation and a JSON array of rows. Output may be truncated if max_length is specified.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "example": "https://x402.freeq.one/samples/report.pdf",
   "description": "Direct URL to any supported document (pdf, docx, pptx, xlsx, csv, epub, html, text)"
  },
  "file_b64": {
   "type": "string",
   "maxLength": 28000000,
   "description": "Base64-encoded document bytes (alternative to url)"
  },
  "max_length": {
   "type": "integer",
   "example": 100000,
   "description": "Truncate output to N characters"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-gateway-document-to-markdown-auto-detect-fc6a5b5d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.freeq.one](https://www.zero.xyz/host/x402.freeq.one/llms.txt)
