# Receipt & Invoice OCR to JSON (`determined_alghoza_2aj/receipt-invoice-ocr`) Actor

Receipts/invoices (image or PDF) to OCR text + total/subtotal/tax with confidence. Local OCR, no AI API. Accuracy measured on the CORD dataset (see README). Pay per page processed.

- **URL**: https://apify.com/determined\_alghoza\_2aj/receipt-invoice-ocr.md
- **Developed by:** [ajay shah](https://apify.com/determined_alghoza_2aj) (community)
- **Categories:** AI, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.00 / 1,000 page processeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Receipt & Invoice OCR to JSON

Upload receipt or invoice images (JPG/PNG) or PDFs. For every page you get the full OCR text and the amount fields
(**total, subtotal, tax**), each with a confidence score. A field is **null** when the actor is not confident enough.
It does not guess.

- Runs entirely on Apify: local OCR (RapidOCR, ONNX), no third-party AI API, and your files are not sent anywhere
  else.
- Only files uploaded in the input are read. Up to 20 MB per file and 20 pages per PDF.

### Pricing

Pay per event: **$0.004 per page successfully processed**. Pages that fail are reported and **not charged**.

### How accurate is it? (measured, not claimed)

Measured on **CORD v2**, a public dataset of real photographed receipts (clovaai/cord, CC-BY-4.0, test split,
100 receipts). The confidence threshold was chosen on the separate validation split and applied once.

| field | correct / answered | precision (95 % interval) | answered for |
|---|---|---|---|
| total | 59 / 65 | 90.8 % (81 %–96 %) | 68 % of receipts |
| subtotal | 42 / 42 | 100 % (92 %–100 %) | 65 % of receipts that have one |
| tax | 17 / 20 | 85 % (64 %–95 %) | 49 % of receipts that have one |

What this means:

- When the actor gives a total it was right about 9 times in 10 on this data.
- For about a third of receipts it returns null rather than risk a wrong number.
- Your documents may differ: layout, language, photo quality.

**Not measured on real data:** `vendor`, `invoice_no`, `date_text` and `currency` are best-effort. They are null
unless confident, and every row lists them in `unmeasured_fields`. Treat them as hints.

**Not included yet:** line items.

### Output (one row per page)

| field | meaning |
|---|---|
| `document`, `page`, `source` | which file and page |
| `status` | `OK`, `FAILED` (with `error`), or `REFUSED` (not an Apify-storage upload, too large, too many pages) |
| `total`, `subtotal`, `tax` | numbers, or null when not confident |
| `total_confidence` (etc.) | the actor's own confidence, 0–1 |
| `currency`, `vendor`, `invoice_no`, `date_text` | best-effort, not measured on real data |
| `unmeasured_fields` | the list of the fields above |
| `text` | the full OCR text, line by line |

Amounts are parsed locale-tolerantly: `60.000` → 60000, `1,234.50` → 1234.5, `1.234,50` → 1234.5.

### Attribution

Accuracy was measured on CORD: Park et al., "CORD: A Consolidated Receipt Dataset for Post-OCR Parsing", CC-BY-4.0.

# Actor input Schema

## `documents` (type: `array`):

Upload receipt/invoice images (JPG, PNG) or PDFs (up to 20 pages, 20 MB each). Only files uploaded here (Apify storage) are read.

## Actor input object example

```json
{
  "documents": [
    "https://api.apify.com/v2/key-value-stores/eiVp3cwEZB6XFuH8j/records/sample-receipt.png"
  ]
}
```

# Actor output Schema

## `results` (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 = {
    "documents": [
        "https://api.apify.com/v2/key-value-stores/eiVp3cwEZB6XFuH8j/records/sample-receipt.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("determined_alghoza_2aj/receipt-invoice-ocr").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 = { "documents": ["https://api.apify.com/v2/key-value-stores/eiVp3cwEZB6XFuH8j/records/sample-receipt.png"] }

# Run the Actor and wait for it to finish
run = client.actor("determined_alghoza_2aj/receipt-invoice-ocr").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 '{
  "documents": [
    "https://api.apify.com/v2/key-value-stores/eiVp3cwEZB6XFuH8j/records/sample-receipt.png"
  ]
}' |
apify call determined_alghoza_2aj/receipt-invoice-ocr --silent --output-dataset

```

## MCP server setup

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

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/Wt9j5eozqcu0TbvJR/builds/rgaKK7bYvn8dtLLjp/openapi.json
