# Invoice Parser & Receipt Parser - Invoice OCR to JSON/CSV (`tidytools/invoice-receipt-parser`) Actor

Invoice parser and receipt parser for PDF, JPG and PNG URLs. Invoice OCR returns one row per line item by default, repeating supplier, invoice number, date, currency and totals on every row. Documents without items return one row. $0.01 per readable page; unreadable documents are free.

- **URL**: https://apify.com/tidytools/invoice-receipt-parser.md
- **Developed by:** [Yukai Lin](https://apify.com/tidytools) (community)
- **Categories:** AI, Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 extracted pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Parser & Receipt Parser — PDF and image invoices to JSON

### What does it do?

Read public invoice or receipt PDF, JPG and PNG URLs into structured rows: **one row per line item by default**, with the document header repeated on each row. Paste a document URL, choose **invoice** (default) or **receipt**, then export the Dataset as JSON or CSV; Excel can open the CSV.

### How to use

1. Replace the sample URL with a public PDF, JPG or PNG invoice or receipt.
2. Keep **invoice** or choose **receipt**. Leave Fields empty for the preset columns.
3. Run a small sample, check the original document, then export JSON or CSV.

### Input example

```json
{
  "urls": ["https://filedone.ai/sample-files/sample-invoice.pdf"],
  "preset": "invoice",
  "fields": {},
  "flatOutput": true
}
```

The sample URL was directly downloaded as a PDF on 2026-10-28 (HTTP 200). Replace it with your own publicly readable documents. You can also pass `startUrls` (Apify request-list format), or `datasetId` plus `datasetField` to read URLs from another Dataset. For a receipt image, change `preset` to `receipt`. Use files you are allowed to process; login-only files cannot be read.

### Output example

Illustrative flat invoice row (actual values depend on the source):

```json
{"url":"https://example.org/invoice.pdf","documentUrl":"https://example.org/invoice.pdf","lineItemIndex":0,"success":true,"charged":true,"supplier":"Example Ltd","invoice_number":"INV-1","date":"2026-10-01","currency":"USD","subtotal":100,"tax":10,"total":110,"item_description":"Service","item_quantity":1,"item_unit_price":100,"item_amount":100,"documentPagesRead":1,"documentTruncated":false}
```

### Output fields

`lineItemRows: true` is the default. Each line item produces a Dataset row; a document with no items still produces one header row with null item fields and `lineItemIndex: null`. `flatOutput: true` (also the default) makes header and item fields top-level CSV/Excel columns. Turn Flat columns off to place them inside `data`. Turn `lineItemRows` off for the engine's original one-row-per-document output with the item array in `data` (or a JSON text cell with Flat columns).

| Document | JSON field | Meaning |
| --- | --- | --- |
| Invoice | `supplier` | Printed vendor/supplier; equivalent to vendor |
| Invoice | `invoice_number` | Printed invoice number |
| Invoice | `date` | Printed invoice date |
| Invoice | `currency` | Printed currency or symbol, if present |
| Invoice | `subtotal`, `tax`, `total` | Printed amounts; absent values are null |
| Invoice, `lineItemRows: false` | `line_items[]` | Original item array: `description`, `quantity`, `unit_price`, `amount` |
| Receipt | `merchant`, `date`, `currency`, `total` | Printed receipt header |
| Receipt, `lineItemRows: false` | `items[]` | Original item array: `name`, `quantity`, `amount` |
| Either, `lineItemRows: true` | `item_description`, `item_quantity`, `item_unit_price`, `item_amount` | One item per row; receipt description maps from `name` and its unit price is `null` |
| Either, `lineItemRows: true` | `documentUrl`, `lineItemIndex` | Final document URL and zero-based item position; itemless row has null index |
| Either | `documentPagesRead`, `documentTruncated` | Pages sent to the model and whether later pages were omitted |
| Either | `charged`, `success`, `errorType` | Actual charge flag and free failure reason |
| Invoice | `reviewWarnings[]` | Non-blocking `invoice_amount_mismatch` hint if supported subtotal + tax differs from total on a complete document |

The preset does not extract a due date by default. Add `{"dueDate":"string"}` to **Fields** if you need one; verify it against the document. The actor does not rename the engine's snake_case fields to camelCase.

### Pricing

The existing `page-extracted` event costs **$0.01 per readable page on the Free plan** (higher Apify plans have the engine's existing discounts). A two-page PDF with two readable pages sent to AI creates two events regardless of the number of item rows; a JPG/PNG creates one event. Unreadable documents, download errors, and documents whose requested fields are all empty return a free row with `charged: false` and `errorType`. A readable non-invoice PDF that happens to contain a requested value may still be charged under the current engine rule; review the result before relying on it. There is no new event or price.

### Limitations and data handling

The Actor stores results in your Apify Dataset and uses the existing extraction backend to process the document. This variant adds no separate document archive or training workflow. Do not upload confidential invoices unless your Apify and AI processing arrangements meet your requirements. Scanned PDFs and images use OCR; handwriting, poor scans, long tables, and truncated documents may need manual review. The amount mismatch warning is a review cue, not an accounting guarantee.

### FAQ

**What creates one Dataset row per item?** `lineItemRows`, enabled by default. Flat columns places the repeated header and item values in separate CSV/Excel columns.

**Are 404s charged?** No. They return a free error row.

# Actor input Schema

## `urls` (type: `array`):

Paste directly downloadable PDF, JPG or PNG invoice and receipt URLs. Public sample invoice PDF is prefilled. Each unreadable or invalid URL returns a free error row.

## `startUrls` (type: `array`):

Add public PDF, JPG or PNG URLs in Apify request-list format, or provide a public text-file URL containing document URLs.

## `preset` (type: `string`):

Choose invoice or receipt. Invoice is preselected; receipt uses merchant and items fields. Other engine presets are available for advanced use but are outside this Actor's stated purpose.

## `fields` (type: `object`):

Leave empty to use the invoice or receipt preset. Add field names and types only if you need more columns; these merge with preset fields.

## `flatOutput` (type: `boolean`):

Put invoice or receipt fields in separate columns for CSV and Excel. With lineItemRows enabled, each item is a separate row.

## `lineItemRows` (type: `boolean`):

Emit each invoice or receipt item as a separate Dataset row with repeated header fields. An itemless document still emits one header row. Turn off for the engine's original one-row-per-document JSON output. Charging remains per readable page.

## `datasetId` (type: `string`):

Read document URLs from another Actor run's dataset; non-URL values become text inputs.

## `datasetField` (type: `string`):

Dataset field containing document URLs, for example url or fileUrl. Dot paths work.

## `maxPdfPages` (type: `integer`):

Read up to this many pages per PDF. Only pages with text that are sent to extraction incur one page-extracted event each.

## Actor input object example

```json
{
  "urls": [
    "https://filedone.ai/sample-files/sample-invoice.pdf"
  ],
  "preset": "invoice",
  "fields": {},
  "flatOutput": true,
  "lineItemRows": true,
  "maxPdfPages": 20
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `full` (type: `string`):

No description

## `qualityJson` (type: `string`):

No description

## `qualityCsv` (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 = {
    "urls": [
        "https://filedone.ai/sample-files/sample-invoice.pdf"
    ],
    "fields": {}
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidytools/invoice-receipt-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 = {
    "urls": ["https://filedone.ai/sample-files/sample-invoice.pdf"],
    "fields": {},
}

# Run the Actor and wait for it to finish
run = client.actor("tidytools/invoice-receipt-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 '{
  "urls": [
    "https://filedone.ai/sample-files/sample-invoice.pdf"
  ],
  "fields": {}
}' |
apify call tidytools/invoice-receipt-parser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tidytools/invoice-receipt-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/YDGmNa4fnOX8ZiCWG/builds/qqRY6a6lgnGJzI8mN/openapi.json
