# StructDoc Receipt Extraction API

> StructDoc Receipt Extraction API is a paid API for AI agents from structdoc-api.hp-vladic.workers.dev, paid per call via x402, $0.04/call, status unknown (last checked 2026-09-13).

Extracts structured fields (vendor, totals, line items, dates) from receipt images or PDFs using OCR and prebuilt layout models, returning Markdown-formatted structured data.

## Facts

- Endpoint: POST https://structdoc-api.hp-vladic.workers.dev/receipt
- Price: $0.04/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/structdoc-receipt-extraction-api-a5a87451
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_XCE1UwS5cTlAXs2gBZ4bw

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-receipt-extraction-api-a5a87451 -d '<json body>'
```

Example prompt: Pull all the structured fields out of this receipt image — vendor name, date, line items, and total — and give it to me as clean Markdown.

## When to prefer this

Choose this endpoint when you need to extract structured fields specifically from receipts or invoices (vendor, total, line items, date) from PDF or image files, especially when you want pay-per-call pricing with no API key setup. Prefer over generic OCR when you need layout-aware structured output in Markdown format with receipt-specific field extraction across 100+ languages.

## Known failure modes

- Unreadable or low-quality image results in incomplete OCR extraction
- Unsupported file format returns an error
- Document language not among supported 100+ languages may degrade accuracy
- Payment failure via x402/USDC results in 402 Payment Required response
- Malformed or missing document body returns a 400 Bad Request
- Handwritten receipts may have lower extraction accuracy than printed ones

## How this service works

Extract structured receipt fields — merchant, date/time, line items, subtotal, tax, tip, total, currency — from a receipt image/PDF. ≤2 pages.

## Output

A JSON response containing a Markdown-formatted structured representation of the receipt, including extracted fields such as vendor, date, line items, and totals, along with model metadata (model: 'prebuilt-layout', pages count, format: 'markdown').

## 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-receipt-extraction-api-a5a87451/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)
