# Invoice & Receipt Parser (OCR, No AI) (`freecamp008/invoice-parser`) Actor

Extract invoice number, dates, vendor, VAT ID, IBAN, totals, taxes and line items from PDF invoices, scanned PDFs and receipt photos (JPG/PNG/WebP) into JSON. Built-in OCR, multilingual (EN/FR/DE/ES/IT/NL/PT), no LLM, no external APIs.

- **URL**: https://apify.com/freecamp008/invoice-parser.md
- **Developed by:** [Camp8 fr0](https://apify.com/freecamp008) (community)
- **Categories:** Developer tools, Automation, AI
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 document parseds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Invoice & Receipt Parser – PDF, Scanned & Photo Invoices to JSON (OCR, No AI)

Extract **invoice number, invoice date, due date, vendor, VAT ID, IBAN, subtotal, VAT/tax, total and line items** from PDF invoices, scanned invoices and receipt photos (JPG, PNG, WebP), and get clean, structured JSON back. The parser uses the PDF text layer when there is one, falls back to built-in OCR (Tesseract) for scans and photos, and then applies layout rules: it pairs each label with the value to its right or below it, looks for totals near the bottom of the page, and takes the vendor from the top block or the largest font.

There's **no LLM and no paid API**, and your documents never leave the Actor run. Every field comes with a **confidence score (0–1)**, and the totals are checked against each other (subtotal + tax ≈ total, sum of line items ≈ subtotal).

### What does Invoice & Receipt Parser do?

- Downloads each document URL (PDF, JPG, PNG, WebP) and finds out the file type from its content.
- Digital PDFs: reads the words and their positions from the text layer. This takes milliseconds and has no OCR errors.
- Scanned PDFs and photos: runs OCR on the page images. Table ruling lines are removed first so the text in the cells can be read.
- Turns the words into lines, columns and blocks, and pulls out the fields with **multilingual keywords** in English, French, German, Spanish, Italian, Dutch and Portuguese.
- Normalises all numbers, dates and currencies, so you get `1234.56`, `2024-03-12` and `EUR` whatever the invoice's locale.

### Key features

- 📄 **Every common format**: digital PDFs, scanned PDFs, smartphone photos and scans of receipts (JPG/PNG/WebP)
- 🇫🇷 **Strong French support**: Facture, Avoir, TVA, HT, TTC, Net à payer, Date d'échéance, SIRET/SIREN, N° TVA intracommunautaire
- 🌍 **7 languages**: invoice / facture / Rechnung / factura / fattura / factuur / fatura, plus each language's own words for dates, totals and tax
- 🔢 **Any number format**: `1,234.56`, `1.234,56`, `1 234,56`, `1'234.56`, `(12.00)`, `12.50-`
- 📅 **Any date format**: `12/03/2024`, `03/12/2024` (US order detected), `12.03.24`, `2024-03-12`, `12 mars 2024`, `7. Mai 2014`, `12 de marzo de 2024`, `March 12th, 2024` → `YYYY-MM-DD`
- 💶 **Currency detection** from symbols and ISO codes (€, $, £, ₹, RM, DH, CHF, R$, …), returned as ISO 4217
- 🏢 **Vendor and customer**: name, address, email, phone, website, and *Bill to* / *Facturé à* / *Rechnungsadresse* blocks
- 🆔 **Tax IDs checked with checksums**: EU VAT (all member states, FR key check), SIRET/SIREN (Luhn), ICE (Morocco), GSTIN (India), EIN (US), ABN (Australia, checksum); **IBAN mod-97 check**, BIC/SWIFT
- 🧾 **Taxes**: every VAT/GST rate and amount (`[{rate: 20, amount: 9.34}]`), plus total tax and amount due
- 📋 **Line items**: description, quantity, unit price, amount and tax rate, read from the items table in any of the supported languages
- ✅ **Cross-checks and confidence**: arithmetic checks raise or lower each field's confidence, and an `overall` score tells you which documents need a human look
- ⚡ **Fast and cheap**: digital PDFs take about 0.3 s each, OCR pages about 2–4 s, and you only pay for OCR when it's actually used

### Use cases

- **Accounts payable automation**: pull supplier invoices from an inbox or drive and push the structured data to your ERP or accounting tool (QuickBooks, Xero, Odoo, Pennylane, Sage…)
- **Expense management**: turn photos of receipts into expense lines with date, merchant, total and currency
- **Bookkeeping for accountants**: batch-process a client's invoices and keep the low-confidence ones for review
- **VAT reporting and audit**: collect VAT IDs, rates and tax amounts across thousands of documents
- **AI agents and workflows**: call it from an agent, Make, Zapier or n8n through the HTTP Standby endpoint to read an invoice on the fly
- **Data extraction pipelines**: get accurate, deterministic, cheap pre-extraction before (or instead of) an LLM step

### How to use

#### In Apify Console

1. Paste one or more direct links to invoices or receipts into **Document URLs**.
2. Keep **OCR mode** on `auto`. For French documents, set **OCR language** to `eng+fra` (other examples: `deu`, `spa`, `ita`, `nld`, `por`).
3. Click **Start**. Each document becomes one row in the dataset. Download it as JSON, CSV or Excel.

#### Via API

```bash
curl -X POST "https://api.apify.com/v2/acts/<username>~invoice-parser/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"documentUrls":["https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/free_fiber.pdf"],"ocrLanguage":"eng+fra"}'
```

#### Standby mode (instant HTTP API)

The Actor also runs as a warm, always-ready web server. Send the input fields as query parameters (GET) or as a JSON body (POST) and get `{ count, items }` back:

```bash
## GET – arrays are comma-separated
curl "https://<username>--invoice-parser.apify.actor/?documentUrls=https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/oyo.pdf&token=$APIFY_TOKEN"

## POST
curl -X POST "https://<username>--invoice-parser.apify.actor/?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"documentUrls":["https://example.com/receipt.jpg"],"ocrLanguage":"eng"}'
```

🤖 **AI agents can pay per call**: the Actor uses pay-per-event pricing and only needs limited permissions, so agents can call it through Apify and pay per request with **x402**, with no Apify account or subscription needed.

### Input example

```json
{
  "documentUrls": [
    "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/free_fiber.pdf",
    "https://raw.githubusercontent.com/zzzDavid/ICDAR-2019-SROIE/master/data/img/001.jpg"
  ],
  "ocrMode": "auto",
  "ocrLanguage": "eng+fra",
  "includeRawText": false,
  "maxPages": 10
}
```

| Field | Description | Default |
|---|---|---|
| `documentUrls` | Direct links to PDF / JPG / PNG / WebP files | – |
| `ocrMode` | `auto` (OCR only pages without text), `always`, `never` | `auto` |
| `ocrLanguage` | Tesseract language codes, e.g. `eng`, `fra`, `eng+fra`, `deu`, `spa`, `ita`, `nld`, `por` | `eng` |
| `includeRawText` | Add the layout-ordered text of the document | `false` |
| `maxPages` | Pages parsed per PDF | `10` |

### Output example

```json
{
  "documentUrl": "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/free_fiber.pdf",
  "fileType": "pdf",
  "pages": 2,
  "method": "text",
  "ocrPages": 0,
  "documentType": "invoice",
  "invoiceNumber": "562044387",
  "invoiceDate": "2015-07-02",
  "dueDate": "2015-07-05",
  "currency": "EUR",
  "vendor": {
    "name": "Free SAS",
    "address": "8 rue de la Ville l’Évèque 75008 Paris",
    "vatId": "FR60421938861",
    "taxIds": [{ "type": "EU_VAT", "value": "FR60421938861" }, { "type": "SIREN", "value": "421938861" }],
    "email": null, "phone": null, "website": "free.fr", "iban": null, "bic": null
  },
  "customer": { "name": "de Lattre Alexis", "address": null, "vatId": null, "email": "alexis@via.ecp.fr" },
  "subtotal": 24.99,
  "taxes": [{ "rate": 20, "amount": 5 }],
  "totalTax": 5,
  "total": 29.99,
  "amountDue": 29.99,
  "paymentTerms": null,
  "purchaseOrder": null,
  "lineItems": [],
  "checks": { "subtotalPlusTaxEqualsTotal": true },
  "confidence": {
    "invoiceNumber": 0.93, "invoiceDate": 0.87, "dueDate": 0.93, "currency": 1,
    "vendor.name": 0.87, "vendor.vatId": 0.85, "subtotal": 0.92, "totalTax": 0.92, "total": 0.95, "overall": 1
  },
  "processingMs": 275
}
```

A line item looks like `{"description": "Apple iPad Air Wifi 16 GB Zilver", "quantity": 1, "unitPrice": 399, "amount": 399, "taxRate": 21}`. Documents that can't be downloaded or read are returned as `{ "documentUrl", "error", "isError": true }` and are **not charged**.

`checks` explains the confidence: `subtotalPlusTaxEqualsTotal`, `lineItemsMatchSubtotal` / `lineItemsMatchTotal`, `lineItemsSum`, `roundedTotal` (cash rounding on receipts) and `subtotalDerived` (the net amount wasn't printed, so it was computed as total − tax).

### Pricing

Pay-per-event pricing: you pay only for results.

| Event | When | Price |
|---|---|---|
| `document-parsed` | One invoice/receipt parsed into a dataset item | **$0.008** ($8 per 1,000 documents) |
| `ocr-page` | One page or photo run through OCR (scans and photos only; digital PDFs never trigger it) | **$0.005** ($5 per 1,000 pages) |

A digital PDF invoice costs **$0.008**, and a receipt photo or one-page scan costs **$0.013**. Comparable invoice-parsing APIs usually charge around $0.01 or more per document. Failed downloads and unreadable files are free. Apify platform usage (compute) is billed separately according to your plan. The Actor respects **Maximum cost per run**: it never starts OCR on a page unless the budget still covers that page and the document's result.

### FAQ

**How accurate is it?**
Digital PDFs give the best results. On our test set of 11 public invoices (English, French, German, Dutch, Indian), the invoice number, dates, currency and total came out right on almost every document, and VAT ID, subtotal and tax on most of them. On scanned and photographed documents, accuracy depends on image quality. Small or low-resolution receipt photos can lose digits or decimal points in OCR. Use the `confidence` scores (and `confidence.overall`) to send uncertain documents to manual review.

**Which languages are supported?**
Keywords cover English, French, German, Spanish, Italian, Dutch and Portuguese. For scanned documents, set `ocrLanguage` to the document's language: `eng+fra` for French, `deu` for German, `spa`, `ita`, `nld`, `por`. OCR data for all seven languages is built into the image. Any other Tesseract language code also works, but its data is downloaded from a public CDN the first time it's used.

**Does it use AI or send my documents to a third party?**
No. Everything runs inside the Actor container with open-source components (pdf.js and Tesseract OCR), with no LLM and no external API calls. Your documents are only downloaded from the URLs you provide. Documents are processed in memory and nothing is stored apart from the dataset results you get back.

**What are the limits?**
Each file can be up to 50 MB, and `maxPages` (default 10, max 100) PDF pages are parsed per document. Password-protected PDFs, TIFF files and HTML pages aren't supported. Handwritten receipts and very low-resolution photos give poor OCR results. If the issuer's details are only printed inside an image on an otherwise digital PDF (for example a logo with the address), they won't be read unless you set `ocrMode` to `always`.

**What if a field is missing or wrong?**
Fields the parser can't find with reasonable certainty are returned as `null` rather than guessed. Every value has a confidence score. The rules are deterministic, so the same document always gives the same output.

**Can I parse receipts as well as invoices?**
Yes. Receipts (`documentType: "receipt"`) get the merchant name, date, total (including cash rounding), currency and line items. Credit notes (*avoir*, *Gutschrift*, *creditnota*) are detected as `credit_note`.

**Is it legal to extract data from invoices?**
Yes, when you process documents you are entitled to use, such as your own or your company's invoices and receipts, or documents your clients hand you. Invoices contain personal data (names, addresses, bank details), so process them in line with the GDPR or your local privacy law. This Actor doesn't keep any data beyond your run's storage.

**How do I process files from Google Drive, Dropbox or email?**
Give the Actor a direct download link: a Dropbox `?dl=1` link, a Google Drive `uc?export=download&id=…` link, or a pre-signed S3 URL. Pages that only show the file in a browser viewer return HTML and are reported as an error.

# Actor input Schema

## `documentUrls` (type: `array`):

Direct links to invoices or receipts: PDF (digital or scanned) or images (JPG, PNG, WebP). Each document becomes one result with structured fields.

## `ocrMode` (type: `string`):

<b>auto</b>: use the PDF text layer and OCR only pages without text (scanned). <b>always</b>: OCR every PDF page. <b>never</b>: text layer only (fastest; images are always OCR'd).

## `ocrLanguage` (type: `string`):

Tesseract language code(s) used for scanned pages and photos, e.g. <code>eng</code>, <code>fra</code>, <code>deu</code>, <code>spa</code>, <code>ita</code>, <code>nld</code>, <code>por</code>, or combined like <code>eng+fra</code>. Data for eng, fra, deu, spa, ita, nld and por is pre-installed; other Tesseract languages are downloaded on first use.

## `includeRawText` (type: `boolean`):

Add the full extracted text (layout-ordered) of each document to the result.

## `maxPages` (type: `integer`):

Only the first N pages of each PDF are parsed (invoices rarely need more).

## Actor input object example

```json
{
  "documentUrls": [
    "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/oyo.pdf"
  ],
  "ocrMode": "auto",
  "ocrLanguage": "eng",
  "includeRawText": false,
  "maxPages": 10
}
```

# Actor output Schema

## `documents` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "documentUrls": [
        "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/oyo.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("freecamp008/invoice-parser").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "documentUrls": ["https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/oyo.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("freecamp008/invoice-parser").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "documentUrls": [
    "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/oyo.pdf"
  ]
}' |
apify call freecamp008/invoice-parser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,freecamp008/invoice-parser"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qFMSS728G4mkrYtAN/builds/USOAVbuMepcpJvojw/openapi.json
