Extract an Invoice to JSON in One API Call

Your first Fieldry parse: send a PDF plus a schema, get schema-valid JSON back with confidence and evidence on every field.

From PDF to structured data in five minutes

You have an invoice PDF and you want its fields in your database — number, date, total, line items. No templates, no training, no dragging boxes. You describe what you want with a JSON schema, and Fieldry returns JSON that matches it.

You need an API key and any invoice PDF. Everything below runs against the live API.

Step 1: Define what you want

A schema is just JSON describing the fields. Keep it small on the first run — three to five fields is enough to see the whole loop:

{
  "type": "object",
  "required": ["invoice_no", "total"],
  "properties": {
    "invoice_no": { "type": "string", "description": "Invoice number as printed" },
    "date": { "type": "string", "format": "date", "description": "Invoice issue date" },
    "total": { "type": "number", "description": "Grand total including VAT" }
  }
}

The description on each field matters more than it looks — it is the instruction the interpreter model reads. Write it like you would brief a careful colleague.

Every property needs a description. A schema without descriptions parses, but the field mapping gets noticeably worse — the model guesses what you meant instead of reading it.

Step 2: Send the file

One call, multipart form, file plus schema:

curl -X POST https://api.fieldry.io/v1/extract?wait \
  -H "Authorization: Bearer $FIELDRY_KEY" \
  -F "file=@invoice.pdf" \
  -F 'schema={"type":"object","required":["invoice_no","total"],"properties":{"invoice_no":{"type":"string","description":"Invoice number as printed"},"total":{"type":"number","description":"Grand total including VAT"}}}'

The ?wait flag holds the connection for a sync response (up to 25 seconds). Drop it and you get a 202 with a job_id plus a webhook when the result lands — same payload, better for bulk.

Step 3: Read the evidence, not just the values

The response is not flat values. Every field carries its own audit trail:

{
  "invoice_no": {
    "value": "INV-2026-041",
    "confidence": 0.99,
    "evidence": [{ "page": 1, "text": "INV-2026-041", "bbox": [0.21, 0.08, 0.38, 0.11] }]
  },
  "total": { "value": 1240.50, "confidence": 0.97, "status": "ok" },
  "vat": { "value": null, "status": "missing" }
}

Three things to notice. First, confidence tells you how much to trust each value — route low scores to review instead of re-checking everything. Second, evidence points at the exact page, text and bounding box, so any value is one click from its source. Third, the missing VAT number came back as null with status missing — never a guess. That null-honesty is the whole ballgame for downstream automation.

What it costs

One page costs 4 credits ($0.04). Tables add 2. Every response carries an X-Credits-Used header, so metering is visible per call, not per month-end surprise. Your free 200 monthly credits cover about 50 pages — enough to parse this tutorial's invoices many times over.

Common questions

No. One invoice schema handles all suppliers — the interpreter maps each layout to your fields. Add suppliers without touching the schema.

It returns null with status missing. Set per-field review thresholds and let humans confirm only the uncertain values.

Yes — define the items as an array of objects (mark it as a table) and you get stitched rows back, merged cells resolved. CSV and Markdown export included.

?wait for interactive flows under 25 seconds. Drop it for batch: 202 now, signed webhook on completion, 50% fewer credits through the batch queue.

  • extract
  • invoices
  • api
  • getting-started
Share this article