Get data from a document
The total of an invoice or the date on a receipt, as data.
Tell it in plain words what you need, like the invoice number and the total. Or give the exact fields as a JSON schema. Chab reads the whole document and returns the data in that shape. For each value you also see the page it came from. It works for invoices and receipts, and for contracts and IDs.
Paste this into your AI agent
Set up Chab for me: fetch https://www.chab.ai/agent-setup.md?v=497c0f and follow it. Then use Chab to tell me the total and the VAT on this receipt and list what was bought: https://upload.wikimedia.org/wikipedia/commons/e/ee/Italian_supermarket_receipt_showing_value-added_tax_%28IVA%29_categories.jpg
Your agent connects Chab and then runs it. Price: From 1 credit, about 1 credit for one or two pages. The free credits cover a first try. How it works in each app
- Returns
- JSON result
- REST endpoint
POST /v1/documents/fields- Over MCP
- Call
chab_operation_startwith"documents.fields"
What you get
Example request
{ "source": { "type": "url", "url": "https://upload.wikimedia.org/wikipedia/commons/e/ee/Italian_supermarket_receipt_showing_value-added_tax_%28IVA%29_categories.jpg" }, "prompt": "The receipt date, the total, the VAT and each item with its price.", "schema": { "type": "object", "properties": { "date": { "type": [ "string", "null" ] }, "total": { "type": [ "number", "null" ] }, "vat": { "type": [ "number", "null" ] }, "items": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "price": { "type": "number" } }, "required": [ "name", "price" ] } } }, "required": [ "date", "total", "vat", "items" ] }}Example result
{ "data": { "result": { "source": { "type": "url", "url": "https://upload.wikimedia.org/wikipedia/commons/e/ee/Italian_supermarket_receipt_showing_value-added_tax_%28IVA%29_categories.jpg", "filename": "Italian_supermarket_receipt_showing_value-added_tax_(IVA)_categories.jpg", "format": "jpeg", "byte_size": 984810 }, "page_count": 1, "first_page": 1, "pages_read": 1, "data": { "date": null, "total": 11.85, "vat": 1.12, "items": [ { "name": "ACQUA S.ANGELO NATUR", "price": 1.32 }, { "name": "MILK PRO PORRIDGE AV", "price": 1.65 }, { "name": "MILK PRO PORRIDGE AV", "price": 1.65 }, { "name": "LINDT TAVOLETTA LATT", "price": 2.85 }, { "name": "CRIK CROK STILE FATT", "price": 2.85 }, { "name": "MELE GRANNY SMITH [C", "price": 1.53 } ] }, "field_pages": { "date": [], "total": [1], "vat": [1], "items": [1] }, "usage": { "input_tokens": 510, "output_tokens": 186 } }, "artifacts": [], "warnings": [], "result_expires_at": "2026-11-19T12:29:12+00:00" }, "meta": { "request_id": "req_123" }}Inputs
| Field | Type | Details |
|---|---|---|
sourcerequired | object | The document: an uploaded file (file_id), a reusable artifact such as a screenshot (artifact_id), or a public https URL (url). PDF, PNG, JPEG, WebP, TIFF or HEIC. |
source.typerequired | string | One of file_id, artifact_id, url |
source.id | string | The fil_ or art_ id, with type file_id or artifact_id.Up to 64 characters |
source.url | string | A public https URL of the document, with type url. Chab downloads it (up to your plan's upload size) and checks it for viruses like an upload.Up to 2048 characters |
first_page | integer | The first page to read.Default 1. Min 1 |
max_pages | integer | Most pages to read from first_page on. Credits are reserved for these pages and the unused part is released. An image is one page.Default 10. Min 1 max 20 |
prompt | string | What to get from the document, in plain words, such as "the invoice number, the date, the total and each line item".Up to 4000 characters |
schema | object | A JSON schema for the data, with type object at the root. The answer is checked against it and repaired once when it does not match. |
max_output_tokens | integer | Most tokens of the answer.Default 4096. Min 256 max 16384 |
How to call it
AI apps use it through hosted MCP. Coding agents can also use the CLI, and your own code can call the API. Each call starts a job, and your agent picks up the result when it is ready.
curl -X POST https://www.chab.ai/v1/documents/fields \ -H "Authorization: Bearer CHAB_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: documents-fields-001" \ -d '{"source":{"type":"url","url":"https://upload.wikimedia.org/wikipedia/commons/e/ee/Italian_supermarket_receipt_showing_value-added_tax_%28IVA%29_categories.jpg"},"prompt":"The receipt date, the total, the VAT and each item with its price.","schema":{"type":"object","properties":{"date":{"type":["string","null"]},"total":{"type":["number","null"]},"vat":{"type":["number","null"]},"items":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"price":{"type":"number"}},"required":["name","price"]}}},"required":["date","total","vat","items"]}}'Get data from a document result
{ "data": { "result": { "source": { "type": "url", "url": "https://upload.wikimedia.org/wikipedia/commons/e/ee/Italian_supermarket_receipt_showing_value-added_tax_%28IVA%29_categories.jpg", "filename": "Italian_supermarket_receipt_showing_value-added_tax_(IVA)_categories.jpg", "format": "jpeg", "byte_size": 984810 }, "page_count": 1, "first_page": 1, "pages_read": 1, "data": { "date": null, "total": 11.85, "vat": 1.12, "items": [ { "name": "ACQUA S.ANGELO NATUR", "price": 1.32 }, { "name": "MILK PRO PORRIDGE AV", "price": 1.65 }, { "name": "MILK PRO PORRIDGE AV", "price": 1.65 }, { "name": "LINDT TAVOLETTA LATT", "price": 2.85 }, { "name": "CRIK CROK STILE FATT", "price": 2.85 }, { "name": "MELE GRANNY SMITH [C", "price": 1.53 } ] }, "field_pages": { "date": [], "total": [1], "vat": [1], "items": [1] }, "usage": { "input_tokens": 510, "output_tokens": 186 } }, "artifacts": [], "warnings": [], "result_expires_at": "2026-11-19T12:29:12+00:00" }, "meta": { "request_id": "req_123" }}Price: From 1 credit, about 1 credit for one or two pages. See all prices
Want to try Chab with your agent?
Copy the prompt and paste it into your AI. Your agent starts with free credits and doesn't need an account.