Authentication
Send your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
POST /v1/extract
Extract structured invoice or receipt data. Send JSON with file (base64, max 8 MB) and mime (application/pdf, image/png, image/jpeg, image/webp or text/plain). x-api-key: YOUR_API_KEY also works instead of the Bearer header.
Endpoint: POST https://fatura.lunafzai.com/v1/extract
cURL
curl -X POST "https://fatura.lunafzai.com/v1/extract" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file\": \"$(base64 -w0 invoice.pdf)\", \"mime\": \"application/pdf\"}"
Python
import base64, requests
url = "https://fatura.lunafzai.com/v1/extract"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
with open("invoice.pdf", "rb") as f:
payload = {"file": base64.b64encode(f.read()).decode(), "mime": "application/pdf"}
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
print(response.json())
Node.js
import fs from "node:fs";
const res = await fetch("https://fatura.lunafzai.com/v1/extract", {
method: "POST",
headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" },
body: JSON.stringify({
file: fs.readFileSync("invoice.pdf").toString("base64"),
mime: "application/pdf"
})
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(await res.json());
Response fields
The API returns { data, checks, meta }. The fields below are inside data; checks sits next to it. Exact shape may evolve; see the OpenAPI spec for current details.
| Field | Type | Description |
|---|---|---|
| invoice_number, issue_date, due_date | string | Invoice number and dates (YYYY-MM-DD). |
| currency | string | ISO currency code. |
| seller, buyer | object | name, street, postcode, city, country, vat_id, tax_number, email. |
| lines | array | description, quantity, unit, unit_price, net_amount, vat_rate, discount_amount. |
| vat_breakdown | array | rate, taxable_amount, vat_amount, category. |
| total_net, total_vat, total_gross | number | Net, VAT and gross totals. |
| prepaid_amount, amount_due | number | Down payment and remaining amount. |
| payment | object | iban, bic, account_name, payment_reference, terms. |
Example response
{
"data": {
"invoice_number": "RE-2026-001",
"issue_date": "2026-11-20",
"currency": "EUR",
"seller": { "name": "Example GmbH", "vat_id": "DE123456789" },
"buyer": { "name": "Buyer AG" },
"lines": [ { "description": "Consulting", "quantity": 1, "unit_price": 100, "net_amount": 100, "vat_rate": 19 } ],
"vat_breakdown": [ { "rate": 19, "taxable_amount": 100, "vat_amount": 19 } ],
"total_net": 100, "total_vat": 19, "total_gross": 119, "amount_due": 119,
"payment": { "iban": "DE02120300000000202051" }
},
"checks": { "passed": true, "issues": [] },
"meta": { "source": "image", "ms": 2100 }
}
Checks and issue codes
The checks object next to data has passed (true/false) and issues: a list of objects { "kod": "TOTAL", "mesaj": "..." } where kod is the issue code and mesaj the message.
Checks help flag obvious inconsistencies. They are informational and should be reviewed by a human.
| kod | Raised when |
|---|---|
| TOTAL | net + VAT does not equal gross |
| AMOUNT_DUE | gross minus prepaid does not equal amount due |
| LINE_CALC | quantity x unit price does not match a line amount |
| LINE_SUM | line amounts do not sum to the net total |
| VAT_CALC | VAT amount does not match rate x base |
| VAT_SUM | VAT breakdown does not sum to total VAT |
| IBAN | IBAN checksum invalid |
| VAT_ID | VAT ID format invalid |
| SELLER_TAX | seller has neither VAT ID nor tax number |
| DATE | date is not YYYY-MM-DD |
| DELIVERY_DATE | delivery or service date problem |
Errors
| Status | When |
|---|---|
| 400 | Missing or malformed request (bad JSON, missing file or mime). |
| 401 | Missing, invalid or exhausted API key. |
| 413 | File larger than 8 MB. |
| 415 | Unsupported mime type. |
| 422 | File could not be processed. For scanned PDFs, send the page as an image. |
| 502 | Extraction failed upstream, retry. Failed calls are not charged. |
GET /v1/usage
Check remaining credits and usage information.
curl "https://fatura.lunafzai.com/v1/usage" \
-H "Authorization: Bearer YOUR_API_KEY"
MCP setup for Claude Desktop and Cursor
You can connect the API through its MCP endpoint for tool use in compatible apps.
MCP URL: https://fatura.lunafzai.com/mcp
Include your bearer token in the MCP connection configuration.
{
"mcpServers": {
"fatura": {
"url": "https://fatura.lunafzai.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Exact configuration screens differ between Claude Desktop and Cursor, but the key parts are the MCP URL and the Authorization: Bearer ... header.
Billing and data handling
- 100 calls: USD 9
- 1000 calls: USD 49
- 5000 calls: USD 199
- Prepaid credits are valid for 12 months
- Failed calls are not charged
- Files are not stored
Buy credits · Terms · Privacy