# StructDoc Layout-to-Markdown Document Structuring API

> StructDoc Layout-to-Markdown Document Structuring API is a paid API for AI agents from structdoc-api.hp-vladic.workers.dev, paid per call via x402, $0.25/call, status unknown (last checked 2026-09-13).

Converts PDF or image documents into structured data (Markdown, tables, key-value pairs, invoice/receipt fields) using OCR and layout analysis across 100+ languages

## Facts

- Endpoint: POST https://structdoc-api.hp-vladic.workers.dev/layout
- Price: $0.25/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/structdoc-layout-to-markdown-document-structuring-api-0a2f40f9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_RWTNgEEl35a5UrF8WMifc

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 structdoc-layout-to-markdown-document-structuring-api-0a2f40f9 -d '<json body>'
```

Example prompt: Can you extract all the text and tables from this invoice PDF and give me the results as structured Markdown — I need the line items, totals, and vendor info pulled out cleanly?

## When to prefer this

Choose this endpoint when you need to convert unstructured PDF or image documents into AI-ready Markdown or structured data, especially for invoices, receipts, and forms with tables or key-value pairs. It is ideal for agents that need to process documents without managing API keys, paying per-call via USDC. Prefer it over generic OCR when you need layout-aware extraction that preserves table structure and document hierarchy across 100+ languages.

## Known failure modes

- Unsupported file format returns an error — only PDF and common image types accepted
- Document too large or too many pages may time out or return a partial result
- Heavily handwritten or low-resolution scans may produce poor OCR accuracy
- Non-Latin scripts may have reduced accuracy depending on language support
- Payment failure via x402/USDC will block the request before processing
- Malformed or inaccessible document URL returns a fetch error

## How this service works

Turn any document into structured data for AI agents — OCR, layout-to-Markdown, tables, key-value, invoice/receipt fields — from PDF/images in 100+ languages. Pay per call via x402 (USDC). No API keys.

## Output

A JSON object containing the model name ('prebuilt-layout'), page count, output format ('markdown'), and full Markdown-formatted document content including extracted text, tables, and layout structure. Key-value fields such as invoice line items, totals, dates, and vendor info are embedded in the Markdown representation.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "description": "Document URL (PDF/image)"
  },
  "pages": {
   "type": "string",
   "description": "Page range e.g. \"1-5\""
  },
  "base64": {
   "type": "string",
   "description": "Base64 document bytes (≤~6MB)"
  },
  "features": {
   "type": "string",
   "description": "languages,barcodes,keyValuePairs"
  },
  "queryFields": {
   "type": "string",
   "description": "custom fields, comma-separated ≤8"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "model": "prebuilt-layout",
  "pages": 1,
  "format": "markdown",
  "content": "# ..."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/structdoc-layout-to-markdown-document-structuring-api-0a2f40f9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from structdoc-api.hp-vladic.workers.dev](https://www.zero.xyz/host/structdoc-api.hp-vladic.workers.dev/llms.txt)
