# E-Invoice Validator: Peppol, XRechnung, Factur-X, ZUGFeRD (`nemata/e-invoice-validator-en16931`) Actor

Check e-invoices against the official EU rules before you send them. UBL, CII and Factur-X/ZUGFeRD PDFs, in bulk. Every broken rule explained, plus a clean invoice summary. $0.005 per invoice.

- **URL**: https://apify.com/nemata/e-invoice-validator-en16931.md
- **Developed by:** [nemata](https://apify.com/nemata) (community)
- **Features:** 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 invoices

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/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: Peppol, XRechnung, Factur-X, ZUGFeRD (EN 16931)

**For accounting teams, ERP integrators and AP automation: catch rejected e-invoices before your customer's portal does.**

Check electronic invoices against the **official European validation rules** before you send them, or as soon as you receive them. Upload UBL or CII XML files, or **Factur-X / ZUGFeRD PDFs**, and get a clear verdict with every broken business rule.

- **Official rules, not a re-implementation:** the Schematron validation artefacts of CEN/TC 434 for **EN 16931** (version 1.3.16), plus the **XRechnung** rules (Germany) when the invoice declares them. Peppol BIS 3.0 invoices are checked against the EN 16931 core rules they build on. They run on the Saxon engine, as the artefacts require.
- **Both syntaxes:** UBL 2.1 (Invoice and CreditNote) and UN/CEFACT CII D16B.
- **Hybrid PDFs:** the XML embedded in Factur-X / ZUGFeRD PDFs is extracted automatically.
- **Readable results:** rule ID (e.g. `BR-CO-15`), message, severity and XML location, plus an invoice summary (number, dates, seller, buyer, VAT IDs, totals).
- **Batch-friendly:** validate hundreds of invoices per run, and call it from your ERP, Zapier, Make or an AI agent.
- **Pay per invoice validated.**

### Why now

E-invoicing is becoming mandatory across Europe. Germany requires businesses to be able to receive e-invoices since 2025, Belgium made structured B2B e-invoices mandatory in 2026, and France and Spain are rolling out their own mandates. EN 16931 is the common European core behind all of them.

### Input

```json
{
  "invoiceUrls": [{ "url": "https://example.com/invoices/INV-2026-001.xml" }, { "url": "https://example.com/invoices/INV-2026-002.pdf" }],
  "rulesets": ["auto"],
  "includeWarnings": true
}
```

You can also paste one invoice in `invoiceXml`, or set `demo: true` to validate the official example invoices.

`rulesets`: `auto` applies EN 16931 always, plus XRechnung when the invoice's CustomizationID declares it. You can also force `en16931` or `xrechnung`.

### Output

```json
{
  "source": "https://example.com/invoices/INV-2026-001.xml",
  "syntax": "UBL",
  "documentType": "Invoice",
  "detectedSpecification": "Peppol BIS Billing 3.0",
  "valid": false,
  "errorCount": 1,
  "warningCount": 1,
  "errors": [
    {
      "ruleset": "en16931",
      "rule": "BR-CO-15",
      "severity": "error",
      "message": "[BR-CO-15]-Invoice total amount with VAT (BT-112) = Invoice total amount without VAT (BT-109) + Invoice total VAT amount (BT-110).",
      "location": "/*:Invoice[1]"
    }
  ],
  "rulesBroken": { "BR-CO-15": 1 },
  "rulesetsApplied": [{ "ruleset": "EN 16931 (CEN)", "version": "validation-1.3.16" }],
  "invoice": {
    "invoiceNumber": "INV-2026-001",
    "issueDate": "2026-11-20",
    "currency": "EUR",
    "sellerName": "Example Seller SL",
    "sellerVatId": "ESB12345678",
    "buyerName": "Example Buyer GmbH",
    "totalWithoutVat": "100.00",
    "totalVat": "21.00",
    "amountDue": "121.00"
  }
}
```

### Good to know

- Peppol-specific rules (PEPPOL-EN16931-R...) are not applied yet.
- Schematron rules cover the business rules of EN 16931 and its CIUS. XML Schema (XSD) errors usually show up as failed rules too, but this Actor does not run a separate XSD check.
- National formats that are not EN 16931 syntaxes, such as Spain's Facturae, are not supported yet.
- Invoices are processed only during the run and are not stored anywhere else.
- Validation artefacts: CEN/TC 434 EN 16931 (EUPL 1.2) and KoSIT XRechnung (Apache 2.0), used under their open licences. This Actor is not affiliated with these organisations.

### Use with AI agents

- **MCP:** AI assistants and agents can call this Actor as a tool through the Apify MCP server.
- **No Apify account needed for agents:** agents can pay per run through Apify with x402 (stablecoins) or Skyfire, and then call the Actor with the temporary token they receive.
- Clear JSON input and structured JSON output that an agent can use directly.

### Pricing

**$0.005 per invoice** ($5 per 1,000). The price is the same for every Apify plan you are on, and you can set a maximum cost per run in the run options.

Pay per event: you are charged **per invoice validated**. Files that cannot be downloaded or are not invoices are not charged.

# Actor input Schema

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

URLs of invoices: UBL or CII XML, or Factur-X / ZUGFeRD PDF.

## `invoiceXml` (type: `string`):

Or paste the XML of one invoice.

## `rulesets` (type: `array`):

'auto' = EN 16931 always, plus XRechnung when the invoice declares it.

## `includeWarnings` (type: `boolean`):

Also list warnings (rules with severity 'warning').

## `demo` (type: `boolean`):

Validate the example invoices shipped with the EN 16931 artefacts, to see how the output looks.

## Actor input object example

```json
{
  "rulesets": [
    "auto"
  ],
  "includeWarnings": true,
  "demo": true
}
```

# 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 = {
    "demo": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("nemata/e-invoice-validator-en16931").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 = { "demo": True }

# Run the Actor and wait for it to finish
run = client.actor("nemata/e-invoice-validator-en16931").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 '{
  "demo": true
}' |
apify call nemata/e-invoice-validator-en16931 --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nemata/e-invoice-validator-en16931"
        }
    }
}
```

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/ercHnxNxpAMCRM03C/builds/e5kVu7tyVSNaL8g7U/openapi.json
