← Home

Invoice & Receipt Extract API

Extract invoice and receipt data from PDFs and images into JSON. Includes totals, VAT, parties, line items, payment details, and basic consistency checks.

Base URL
https://fatura.lunafzai.com
Auth
Bearer API key
MCP
/mcp

Authentication

Send your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY
Files are not stored. Failed calls are not charged. Credits are prepaid and valid for 12 months.

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.

FieldTypeDescription
invoice_number, issue_date, due_datestringInvoice number and dates (YYYY-MM-DD).
currencystringISO currency code.
seller, buyerobjectname, street, postcode, city, country, vat_id, tax_number, email.
linesarraydescription, quantity, unit, unit_price, net_amount, vat_rate, discount_amount.
vat_breakdownarrayrate, taxable_amount, vat_amount, category.
total_net, total_vat, total_grossnumberNet, VAT and gross totals.
prepaid_amount, amount_duenumberDown payment and remaining amount.
paymentobjectiban, 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.

kodRaised when
TOTALnet + VAT does not equal gross
AMOUNT_DUEgross minus prepaid does not equal amount due
LINE_CALCquantity x unit price does not match a line amount
LINE_SUMline amounts do not sum to the net total
VAT_CALCVAT amount does not match rate x base
VAT_SUMVAT breakdown does not sum to total VAT
IBANIBAN checksum invalid
VAT_IDVAT ID format invalid
SELLER_TAXseller has neither VAT ID nor tax number
DATEdate is not YYYY-MM-DD
DELIVERY_DATEdelivery or service date problem
Important: This is AI-assisted extraction. Review results before booking, payment, or tax reporting. The API is not tax advice and not an EN 16931 validator.

Errors

StatusWhen
400Missing or malformed request (bad JSON, missing file or mime).
401Missing, invalid or exhausted API key.
413File larger than 8 MB.
415Unsupported mime type.
422File could not be processed. For scanned PDFs, send the page as an image.
502Extraction 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

Buy credits · Terms · Privacy