{"openapi":"3.0.3","info":{"title":"StructDoc — Document Structuring API","version":"1.0.0","description":"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.","contact":{"email":"hp.vladic@gmail.com"}},"servers":[{"url":"https://structdoc-api.hp-vladic.workers.dev"}],"paths":{"/layout":{"post":{"summary":"Layout analysis → Markdown (tables, headings, key-value); RAG-ready. ≤20 pages. $0.25 per call, x402","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL of the document (PDF/image)"},"base64":{"type":"string","description":"Base64-encoded document bytes (≤~6MB)"},"pages":{"type":"string","description":"Page range e.g. \"1-5\" (optional)"},"features":{"type":"string","description":"Comma-separated add-ons: languages,barcodes,keyValuePairs"},"queryFields":{"type":"string","description":"Comma-separated custom field names to extract (≤8)"}}}}}},"responses":{"200":{"description":"Structured result (JSON)"},"402":{"description":"Payment required (x402)"}}}},"/read":{"post":{"summary":"OCR full-text extraction, 100+ languages. ≤25 pages. $0.05 per call, x402","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL of the document (PDF/image)"},"base64":{"type":"string","description":"Base64-encoded document bytes (≤~6MB)"},"pages":{"type":"string","description":"Page range e.g. \"1-5\" (optional)"},"features":{"type":"string","description":"Comma-separated add-ons: languages,barcodes,keyValuePairs"},"queryFields":{"type":"string","description":"Comma-separated custom field names to extract (≤8)"}}}}}},"responses":{"200":{"description":"Structured result (JSON)"},"402":{"description":"Payment required (x402)"}}}},"/invoice":{"post":{"summary":"Invoice field extraction (vendor, customer, line items, totals). ≤4 pages. $0.08 per call, x402","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL of the document (PDF/image)"},"base64":{"type":"string","description":"Base64-encoded document bytes (≤~6MB)"},"pages":{"type":"string","description":"Page range e.g. \"1-5\" (optional)"},"features":{"type":"string","description":"Comma-separated add-ons: languages,barcodes,keyValuePairs"},"queryFields":{"type":"string","description":"Comma-separated custom field names to extract (≤8)"}}}}}},"responses":{"200":{"description":"Structured result (JSON)"},"402":{"description":"Payment required (x402)"}}}},"/receipt":{"post":{"summary":"Receipt field extraction (merchant, date, items, tax, total). ≤2 pages. $0.04 per call, x402","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL of the document (PDF/image)"},"base64":{"type":"string","description":"Base64-encoded document bytes (≤~6MB)"},"pages":{"type":"string","description":"Page range e.g. \"1-5\" (optional)"},"features":{"type":"string","description":"Comma-separated add-ons: languages,barcodes,keyValuePairs"},"queryFields":{"type":"string","description":"Comma-separated custom field names to extract (≤8)"}}}}}},"responses":{"200":{"description":"Structured result (JSON)"},"402":{"description":"Payment required (x402)"}}}},"/read-large":{"post":{"summary":"OCR up to 100 pages. $0.20 per call, x402","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL of the document (PDF/image)"},"base64":{"type":"string","description":"Base64-encoded document bytes (≤~6MB)"},"pages":{"type":"string","description":"Page range e.g. \"1-5\" (optional)"},"features":{"type":"string","description":"Comma-separated add-ons: languages,barcodes,keyValuePairs"},"queryFields":{"type":"string","description":"Comma-separated custom field names to extract (≤8)"}}}}}},"responses":{"200":{"description":"Structured result (JSON)"},"402":{"description":"Payment required (x402)"}}}},"/layout-large":{"post":{"summary":"Layout → Markdown up to 100 pages. $1.10 per call, x402","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL of the document (PDF/image)"},"base64":{"type":"string","description":"Base64-encoded document bytes (≤~6MB)"},"pages":{"type":"string","description":"Page range e.g. \"1-5\" (optional)"},"features":{"type":"string","description":"Comma-separated add-ons: languages,barcodes,keyValuePairs"},"queryFields":{"type":"string","description":"Comma-separated custom field names to extract (≤8)"}}}}}},"responses":{"200":{"description":"Structured result (JSON)"},"402":{"description":"Payment required (x402)"}}}},"/catalog":{"get":{"summary":"Machine-readable catalog (free)","security":[],"responses":{"200":{"description":"Catalog"}}}},"/sample":{"get":{"summary":"Free example output for every paid endpoint — try before you pay","description":"Returns the exact JSON shape each paid endpoint produces, as a static example. No payment, no OCR.","security":[],"parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["read","layout","invoice","receipt","read-large","layout-large"]},"description":"Show only one endpoint’s example. Omit for all of them."}],"responses":{"200":{"description":"Example output (JSON)"}}}}}}