# XRechnung & ZUGFeRD Validator (KoSIT, EN 16931) (`webify-lab/xrechnung-zugferd-validator`) Actor

Validate XRechnung (UBL and CII) and ZUGFeRD / Factur-X e-invoices with the official KoSIT validator and XRechnung configuration. XML or PDF in, verdict plus every error and warning with rule ID, message and XPath out. Only charged per invoice with a report.

- **URL**: https://apify.com/webify-lab/xrechnung-zugferd-validator.md
- **Developed by:** [Batu T.](https://apify.com/webify-lab) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 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.
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

## XRechnung & ZUGFeRD Validator (official KoSIT rules)

Check German e-invoices against the official rules before you send or book them. This Actor runs the KoSIT validator, the reference implementation of the German Coordination Office for IT Standards, with the official XRechnung validator configuration. It accepts XML files and ZUGFeRD / Factur-X PDFs (the embedded XML is extracted automatically) and returns a clear verdict plus every error and warning with rule ID, message and XPath location.

Since 1 January 2025 every business in Germany must be able to receive e-invoices; issuing them becomes mandatory step by step in 2027 and 2028. Typical users: accountants checking incoming invoices, software vendors testing their export, and companies checking their own invoices before they go out.

### What is checked

| format | how it is checked |
|---|---|
| XRechnung 3.0 UBL Invoice and CreditNote | XML Schema, EN 16931 rules, XRechnung rules |
| XRechnung 3.0 CII | XML Schema, EN 16931 rules, XRechnung rules |
| XRechnung Extension and CVD | as published by KoSIT |
| EN 16931 UBL and CII, ZUGFeRD / Factur-X profile EN 16931 (Comfort) | XML Schema and EN 16931 rules |
| ZUGFeRD / Factur-X PDF | embedded factur-x.xml, zugferd-invoice.xml or xrechnung.xml is extracted and checked as above |

ZUGFeRD / Factur-X profiles MINIMUM, BASIC WL, BASIC and EXTENDED and ZUGFeRD 1.0 are not part of the official XRechnung configuration. They are recognised and reported with their profile, but marked as not checkable and not charged.

Bundled versions: KoSIT Validator 1.6.3, XRechnung validator configuration 2026-08-31 (XRechnung 3.0.2, CEN rules 1.3.16).

### Output per invoice

| field | meaning |
|---|---|
| `acceptable` | `true` when the official assessment recommends accepting the invoice |
| `verdict` | `accept`, `accept-tolerated` (only tolerated errors), `reject`, `no-scenario` or `processing-error` |
| `recommendation` | the official recommendation in English or German |
| `conformance` | conformance statement: no errors and no warnings, or the counts |
| `syntax`, `profileId`, `profile` | detected format, for example `CII` and `XRechnung 3.0` |
| `scenario` | the KoSIT validation scenario that was applied |
| `schemaValid`, `schematronValid` | result of the XML Schema check and of the business rules |
| `errorCount`, `warningCount`, `informationCount` | number of messages per severity after the official severity overrides |
| `errors`, `warnings` | `ruleId` (for example BR-DE-15), `severity`, `message`, readable `path`, full `location` XPath, `step` |
| `invoiceNumber`, `issueDate`, `seller` | read from the report |
| `fileType`, `embeddedFileName` | `xml` or `pdf`, and the name of the XML inside the PDF |
| `reportXmlUrl`, `reportHtmlUrl` | the full official XML report and the German HTML report (Pruefbericht) |

### Input

- `invoiceUrls`: direct links to XML or PDF files.
- `keyValueStoreKeys`: records in a key-value store, for example files you uploaded through the API. Uses the run's default store unless `keyValueStoreId` is set.
- `language`: `en` or `de` for the verdict and summary texts. Rule messages stay as published: EN 16931 rules in English, German XRechnung rules (BR-DE) in German.
- `includeInformation`: also list information messages.
- `saveReports`: keep the official XML and HTML reports.

### Pricing

You pay per invoice that receives a validation report, whether it is accepted or rejected. Files that cannot be downloaded, are not XML, are not well-formed, PDFs without an embedded invoice and formats without an official scenario are not charged.

### Limits

- The PDF itself is not checked for PDF/A-3 conformance, only the embedded XML.
- Validation follows the bundled official configuration. Rules of other countries (Peppol BIS country rules beyond those included in XRechnung, French CTC) are not covered.
- The first batch of each run needs about 10 seconds to start the validator; after that an invoice takes a fraction of a second.

The validator and the configuration are published by KoSIT under the Apache License 2.0. Not affiliated with KoSIT, the FeRD forum or the Factur-X project.

### FAQ

**What am I charged for?** One event per invoice that receives a validation report with the verdict `accept`, `accept-tolerated` or `reject`. Download failures, files that are not XML or PDF, XML that is not well-formed, PDFs without an embedded invoice and documents without an official scenario (`no-scenario`) are not charged.

**Which rules are used?** The official KoSIT validator 1.6.3 with the XRechnung validator configuration 2026-08-31 (XRechnung 3.0.2), bundled in the Actor. No external validation service is called.

**Can I validate files that are not online?** Yes. Upload them as records to a key-value store and pass their keys in `keyValueStoreKeys`. The run's default store is used unless `keyValueStoreId` is set.

**Is there a file size or count limit?** Files above `maxFileSizeMb` (default 20 MB, maximum 100 MB) end as an error item and are not charged. One run validates up to `maxInvoices` (default 1000).

**What does a failed invoice look like in the output?** It is still one dataset item with `input`, `source` and an `error` field explaining the reason. Documents without an official scenario also carry `verdict: no-scenario` and the detected `profile`.

### Use with AI agents (MCP)

This Actor works as a tool for Claude, ChatGPT, Cursor and other MCP clients through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp). Add only this Actor:

```
https://mcp.apify.com?tools=webify-lab/xrechnung-zugferd-validator
```

On first use the server signs you in with OAuth. Alternatively send the header `Authorization: Bearer <APIFY_TOKEN>`. Agents on the default Apify MCP setup can also find this Actor with `search-actors` and run it with `call-actor`. Pricing is the same as in Apify Console: you pay per result.

# Actor input Schema

## `invoiceUrls` (type: `array`):

Direct links to e-invoice files: XRechnung or EN 16931 XML (UBL Invoice, UBL CreditNote, CII) or ZUGFeRD / Factur-X PDF with embedded XML.

## `keyValueStoreKeys` (type: `array`):

Keys of records holding invoice files (XML or PDF). Read from the store below, or from this run's default store when no store is given.

## `keyValueStoreId` (type: `string`):

Optional store to read the records from. Empty means the run's default key-value store.

## `language` (type: `string`):

Language of the verdict and summary texts. Rule messages are passed through as published: EN 16931 rules are in English, the German XRechnung rules (BR-DE) in German.

## `includeInformation` (type: `boolean`):

Also list messages with severity information (hints that never affect the verdict). They are always counted.

## `saveReports` (type: `boolean`):

Store the official XML report and the German HTML report (Pruefbericht) of each invoice in the key-value store and link them in the result.

## `maxFileSizeMb` (type: `integer`):

Larger files are skipped with an error and not charged.

## `concurrency` (type: `integer`):

Files downloaded at the same time. Validation itself runs in batches inside one Java process.

## `maxInvoices` (type: `integer`):

Safety limit per run.

## Actor input object example

```json
{
  "invoiceUrls": [
    "https://projekte.kosit.org/xrechnung/xrechnung-testsuite/-/raw/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml"
  ],
  "keyValueStoreKeys": [],
  "language": "en",
  "includeInformation": false,
  "saveReports": true,
  "maxFileSizeMb": 20,
  "concurrency": 5,
  "maxInvoices": 1000
}
```

# Actor output Schema

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

One item per invoice: input, source, fileName, fileType, embeddedFileName, syntax, profileId, profile, scenario, acceptable, verdict, recommendation, conformance, schemaValid, schematronValid, errorCount, warningCount, informationCount, errors, warnings, information (ruleId, severity, message, path, location, step), invoiceNumber, issueDate, seller, validator, configuration, reportXmlUrl, reportHtmlUrl, validatedAt; or error.

# 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 = {
    "invoiceUrls": [
        "https://projekte.kosit.org/xrechnung/xrechnung-testsuite/-/raw/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("webify-lab/xrechnung-zugferd-validator").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 = { "invoiceUrls": ["https://projekte.kosit.org/xrechnung/xrechnung-testsuite/-/raw/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml"] }

# Run the Actor and wait for it to finish
run = client.actor("webify-lab/xrechnung-zugferd-validator").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 '{
  "invoiceUrls": [
    "https://projekte.kosit.org/xrechnung/xrechnung-testsuite/-/raw/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml"
  ]
}' |
apify call webify-lab/xrechnung-zugferd-validator --silent --output-dataset

```

## MCP server setup

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

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/QNDNBIGWfazqKsidc/builds/QQ21Hn8UIztXvjw1f/openapi.json
