# E-Invoice Reader - XRechnung, ZUGFeRD & Factur-X to JSON (`forge_creations/xrechnung-zugferd-to-json`) Actor

Read XRechnung (UBL or CII), ZUGFeRD and Factur-X invoices by URL and get clean JSON: parties, VAT ids, dates, totals, tax per rate, line items, IBAN, plus arithmetic checks. $5 per 1,000 invoices; non-invoices are free.

- **URL**: https://apify.com/forge_creations/xrechnung-zugferd-to-json.md
- **Developed by:** [Forge Creations](https://apify.com/forge_creations) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 invoice reads

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

## E-Invoice Reader: XRechnung, ZUGFeRD & Factur-X to JSON

Paste links to electronic invoices. You get **one clean JSON record per invoice**, the same shape whatever the format:

- **Formats**: XRechnung (UBL 2.1 and UN/CEFACT CII), ZUGFeRD 2.x, Factur-X (the XML inside the PDF/A-3 is read), ZUGFeRD 1.0, PEPPOL BIS Billing 3.0 and other EN 16931 UBL invoices
- **Fields**: profile, invoice number, type (invoice, credit note, corrected invoice...), issue / due / delivery dates, currency, buyer reference (Leitweg-ID), order reference, seller and buyer (name, VAT id, tax number, address, email), totals, tax per rate, line items, IBAN / BIC / payment reference and terms, notes
- **Checks**: line amounts vs line total, net = lines - allowances + charges, tax per rate, gross = net + tax, amount due, required fields. Each check says what it compared.

Germany requires every business to be able to receive e-invoices since 2025, and issuing becomes mandatory step by step through 2028. France follows from 2026. This tool turns those files into data your bookkeeping, n8n, Make or Zapier flow can use.

### Pricing

| What | Price |
|---|---|
| Invoice read | $0.005 ($5 per 1,000 invoices) |
| Apify start fee | $0.00005 per run |

PDFs without an embedded invoice, other XML, unreadable files and failed downloads are **not charged**. Set a maximum charge in run options to cap spending.

### Input

| Field | Default | Notes |
|---|---|---|
| fileUrls | required | Links to .xml or .pdf invoices, 30 MB max each |
| includeLineItems | true | Turn off for headers and totals only |

### Output (one row per file)

`source_url, status, file_type, embedded_xml, syntax, profile, profile_id, invoice_number, type_code, type, issue_date, due_date, delivery_date, currency, buyer_reference, order_reference, seller, buyer, totals, tax_breakdown, lines, payment, notes, checks, checks_passed, checks_note`

`status` is `ok`, or one of `no_einvoice_xml`, `unsupported_format`, `unsupported_file`, `unreadable`, `download_failed` (all free).

### Limits

- The checks are arithmetic and presence checks. They are **not** a full EN 16931 / XRechnung Schematron validation; use the official validator when you need legal conformance.
- Plain PDF invoices without embedded XML are not read. For those, use **PDF & Image to Text** and **PDF Tables to CSV & JSON** from the same developer.
- Italian FatturaPA and pre-2014 ZUGFeRD drafts are reported as unsupported.
- XML is parsed with external entities and network access disabled.

### Support

Open an issue on the Issues tab with a sample file (remove personal data) and the run ID.

# Actor input Schema

## `fileUrls` (type: `array`):

Public http(s) links to XRechnung XML (UBL or CII) or ZUGFeRD / Factur-X PDFs, max 30 MB each.

## `includeLineItems` (type: `boolean`):

Return every invoice line (name, quantity, unit price, net amount, VAT). Turn off to get headers and totals only.

## `maxConcurrency` (type: `integer`):

How many files are processed in parallel.

## Actor input object example

```json
{
  "fileUrls": [
    "https://raw.githubusercontent.com/ZUGFeRD/corpus/master/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_2_Teilrechnung.pdf",
    "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml",
    "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_uncefact.xml"
  ],
  "includeLineItems": true,
  "maxConcurrency": 4
}
```

# Actor output Schema

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

One JSON record per invoice: profile, number, dates, seller and buyer, totals, tax breakdown, line items, payment details and checks. Free status rows for files that are not e-invoices.

# 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 = {
    "fileUrls": [
        "https://raw.githubusercontent.com/ZUGFeRD/corpus/master/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_2_Teilrechnung.pdf",
        "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml",
        "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_uncefact.xml"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("forge_creations/xrechnung-zugferd-to-json").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 = { "fileUrls": [
        "https://raw.githubusercontent.com/ZUGFeRD/corpus/master/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_2_Teilrechnung.pdf",
        "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml",
        "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_uncefact.xml",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("forge_creations/xrechnung-zugferd-to-json").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 '{
  "fileUrls": [
    "https://raw.githubusercontent.com/ZUGFeRD/corpus/master/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_2_Teilrechnung.pdf",
    "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml",
    "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_uncefact.xml"
  ]
}' |
apify call forge_creations/xrechnung-zugferd-to-json --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,forge_creations/xrechnung-zugferd-to-json"
        }
    }
}
```

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/qzjYWdxpgmYg5LCkr/builds/wFWvFf7qpdVHcRG1k/openapi.json
