# E-Invoice Validator: XRechnung & ZUGFeRD (official KoSIT rules) (`danielkofler/e-rechnung-pruefen`) Actor

Validate German e-invoices (XRechnung UBL/CII, ZUGFeRD and Factur-X PDF) against EN 16931 and the official XRechnung 3.0.2 rules with the KoSIT validator. One result and an HTML report per file.

- **URL**: https://apify.com/danielkofler/e-rechnung-pruefen.md
- **Developed by:** [Daniel Kofler](https://apify.com/danielkofler) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 invoice validateds

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 Validator: XRechnung & ZUGFeRD

Validate German e-invoices against the official rules, without installing Java or the KoSIT validator yourself.

**Supported formats**

- XRechnung 3.0 in UBL (Invoice, CreditNote) and UN/CEFACT CII
- ZUGFeRD and Factur-X PDF: the embedded XML is extracted and validated
- EN 16931 core invoices

**What you get per file**

- `akzeptiert`: true or false, the verdict of the KoSIT validator
- `fehler` and `warnungen`: counts
- `meldungen`: every finding with level, rule ID (for example `BR-DE-15`) and the official message text
- `szenario`: which rule set matched (XRechnung UBL, CII, Extension, CVD)
- `bericht_url`: link to the full HTML report of the KoSIT validator
- `rechnung_url`: link to a readable HTML rendering of the invoice itself (official KoSIT visualization, German labels), useful when you receive XRechnung XML that nobody can read
- `regelwerk`: the exact rule version used

**Why this matters now**

Since January 2025 every business in Germany must be able to receive e-invoices. From January 2027, companies with
more than EUR 800,000 turnover in the previous year must issue them, from 2028 all companies in domestic B2B trade.
A plain PDF no longer counts.

**How it validates**

The Actor runs the official KoSIT validator 1.6.3 with the official XRechnung 3.0.2 configuration (2026-08-31), the
same rules German public authorities apply. Both are downloaded at build time and checked against SHA-256 checksums.
All 86 invoices of the official XRechnung test suite pass.

**Input**

Links to files:

```json
{ "fileUrls": ["https://example.com/invoice.xml", "https://example.com/zugferd.pdf"] }
```

Or the files themselves, for example straight from an n8n, Make or Zapier email trigger:

```json
{ "files": [{ "name": "invoice.xml", "contentBase64": "PD94bWwgdmVyc2lvbj0iMS4wIi..." }] }
```

Up to 100 files per run in total, 20 MB each; links must be http or https. Files that cannot be loaded or decoded
are reported and not charged.

**Pricing**

Pay per event: you pay per validated file. If your spending limit is reached, the run stops and you are not charged
for files that were not delivered.

**Limits**

This Actor checks format and mandatory content according to EN 16931 and XRechnung. It does not judge whether an
invoice is correct for tax purposes. Run input, reports and readable copies stay in your own Apify account like any
run output and follow your data retention settings; the Actor sends them nowhere else.

Made by HYPEAKZ.IO.

# Actor input Schema

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

HTTPS links to XRechnung XML (UBL or CII) or ZUGFeRD / Factur-X PDF files. Up to 100 files in total, 20 MB each. Use this or files.

## `files` (type: `array`):

Send attachments directly instead of links: \[{"name": "invoice.xml", "contentBase64": "..."}]. Counts toward the 100-file limit.

## Actor input object example

```json
{
  "fileUrls": [
    "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml"
  ]
}
```

# Actor output Schema

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

One item per invoice file: akzeptiert (true/false), fehler, warnungen, meldungen with rule IDs, szenario, bericht_url, rechnung_url, regelwerk.

## `reports` (type: `string`):

Per file the KoSIT validation report (keys bericht-000, ...) and the readable invoice (keys rechnung-000, ...) as HTML.

# 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/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("danielkofler/e-rechnung-pruefen").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/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml"] }

# Run the Actor and wait for it to finish
run = client.actor("danielkofler/e-rechnung-pruefen").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/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml"
  ]
}' |
apify call danielkofler/e-rechnung-pruefen --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,danielkofler/e-rechnung-pruefen"
        }
    }
}
```

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/r5Y6ezKJO2fJc3CS4/builds/Pp9DGz4igWNQiMGa4/openapi.json
