# XML & E-invoice Validator (XSD, Peppol, XRechnung, Factur-X) (`xmlvalid/xml-einvoice-validator`) Actor

Validate XML documents and e-invoices by URL against XSD, DTD, RelaxNG and Schematron business rules: Peppol BIS, EN 16931, XRechnung, Factur-X, FatturaPA, KSeF and more. One row per document with the verdict, line numbers and rule ids.

- **URL**: https://apify.com/xmlvalid/xml-einvoice-validator.md
- **Developed by:** [Alex Babintsev](https://apify.com/xmlvalid) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 document 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

### What does the XML & E-invoice Validator do?

It validates XML documents and e-invoices you give it by URL, the way the receiving system will check them: against the **XSD, DTD or RelaxNG schema** and, for e-invoices, the **Schematron business rules** (EN 16931, Peppol BIS, XRechnung, national CIUS). You get one row per document with the verdict, the number of errors and warnings, and each finding with its **line number, rule id** (such as `BR-CO-16`) and a link that explains how to fix it.

It runs on [xmlvalid.com](https://xmlvalid.com), a streaming validator built on libxml2 and SaxonJS that handles files up to 1 GB.

### What can it validate?

- **E-invoices:** Peppol BIS Billing 3.0, EN 16931 (UBL and CII), XRechnung, ZUGFeRD and Factur-X (including the XML inside the PDF), France CTC 2026, FatturaPA with the SdI checks, KSeF FA(3), Croatian eRačun (HR CIUS), Romanian e-Factura (CIUS-RO), Spain (SPFE, VERI\*FACTU), Peppol PINT for the UAE, Singapore, Japan, Australia and Malaysia.
- **Other XML formats** in the [schema catalog](https://xmlvalid.com/schemas): UBL 2.1, ISO 20022 payments (pain, pacs, camt), CFDI, NF-e, ISDOC, Finvoice, SAF-T, HL7 CDA, FHIR, SOAP, WSDL, SAML, Maven POM, sitemaps, Atom, SVG, XHTML, GPX, KML and more.
- **Any well-formed XML** for syntax errors, and its own DOCTYPE.
- **.zip archives** document by document, and **EPUB** books file by file.

With `schema` left at `auto`, an e-invoice is checked against the profile it declares (its specification identifier, BT-24), so a mix of Peppol, XRechnung and Factur-X invoices can go in one run.

### How to use it

1. Add the **URLs** of your documents, or paste one XML document.
2. Leave **Schema** at `auto`, or pick a catalog name such as `peppol-bis-3-invoice`, `xrechnung-3-cii` or `ubl-2.1-invoice`.
3. Run it, and open the **Results** or **Findings** view of the dataset, or export it as JSON, CSV or Excel.

Turn on **Make a shareable report link** to get one HTML report for all documents, open for 30 days, in the run's `OUTPUT`: handy to send to whoever has to fix the invoices.

### Output

```json
{
  "source": "https://example.com/invoices/INV-1042.xml",
  "valid": false,
  "outcome": "invalid",
  "schema": "peppol-bis-3-invoice",
  "schemaName": "Peppol BIS Billing 3.0 Invoice",
  "errorsTotal": 1,
  "warningsTotal": 0,
  "firstError": "Line 139: [BR-CO-16] Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Paid amount (BT-113) +Rounding amount (BT-114).",
  "errors": [
    {
      "line": 139,
      "level": "error",
      "type": "schematron",
      "rule": "BR-CO-16",
      "message": "Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Paid amount (BT-113) +Rounding amount (BT-114).",
      "help": "https://xmlvalid.com/rules/BR-CO-16"
    }
  ],
  "warnings": [],
  "sizeBytes": 9227,
  "durationMs": 35,
  "validationId": "val_01m55d4m0rtw2n0szg5f3ybmas",
  "error": null
}
```

`outcome` is `valid`, `warnings` (valid, with warnings), `invalid`, `schema` (the schema could not be used), `input` (the document could not be read or downloaded), `failed`, or `error` when the request was refused (the `error` field says why).

### How much does it cost?

You pay per document validated, as listed on the Pricing tab, plus a tiny fee per run. Documents that are refused before they are checked are not charged.

**Already an xmlvalid user?** Enter your own API key and the validations count towards your xmlvalid plan instead (Free: 100 a month; Pro: 10,000), with your saved schemas (`my-12`) available too. You then pay Apify only for the run.

### Privacy

Documents are downloaded by xmlvalid's servers in the EU, validated and deleted as soon as the check finishes; results are kept for 24 hours. See [Security](https://xmlvalid.com/security) and the [DPA](https://xmlvalid.com/dpa).

### Other ways to validate

- In the browser, free, without uploading anything: [xmlvalid.com/validate](https://xmlvalid.com/validate)
- [REST API](https://xmlvalid.com/docs/api), [CLI and GitHub Action](https://xmlvalid.com/docs/ci), [MCP server for AI agents](https://xmlvalid.com/docs/api#mcp)

Questions or a format you need: support@xmlvalid.com

# Actor input Schema

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

Public http(s) addresses of the XML documents, e-invoices (UBL, CII), Factur-X / ZUGFeRD PDFs or .zip archives to validate. They are downloaded by xmlvalid.com.

## `xml` (type: `string`):

One document to validate, pasted here, in addition to the URLs.

## `schema` (type: `string`):

"auto" picks the catalog profile an e-invoice names (Peppol BIS, XRechnung, Factur-X, CIUS…) and otherwise checks well-formedness and the document's own DOCTYPE. Or a catalog name such as peppol-bis-3-invoice, xrechnung-3-cii, ubl-2.1-invoice or fatturapa-1.2.3: see https://xmlvalid.com/schemas.

## `apiKey` (type: `string`):

With a key of your own (xv\_…, from https://xmlvalid.com/dashboard/api) the validations count towards your xmlvalid plan, including saved schemas (my-12), and are not charged per document here.

## `maxErrors` (type: `integer`):

How many errors and warnings each row lists (all are counted).

## `shareReport` (type: `boolean`):

One public HTML report for all documents, open for 30 days, in the run's OUTPUT. Holds the verdicts and findings, not the documents.

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

How many documents are validated in parallel.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://xmlvalid.com/schemas/peppol-bis-3-invoice/example"
    }
  ],
  "schema": "auto",
  "maxErrors": 20,
  "shareReport": false,
  "concurrency": 3
}
```

# Actor output Schema

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

One row per document: the verdict, the schema, the error and warning counts and the first error.

## `findings` (type: `string`):

One row per error: the document, its line, level, rule id, message and a link that explains it.

## `summary` (type: `string`):

How many documents were checked, and the shareable report link when one was asked for.

# 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 = {
    "startUrls": [
        {
            "url": "https://xmlvalid.com/schemas/peppol-bis-3-invoice/example"
        }
    ],
    "schema": "auto"
};

// Run the Actor and wait for it to finish
const run = await client.actor("xmlvalid/xml-einvoice-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 = {
    "startUrls": [{ "url": "https://xmlvalid.com/schemas/peppol-bis-3-invoice/example" }],
    "schema": "auto",
}

# Run the Actor and wait for it to finish
run = client.actor("xmlvalid/xml-einvoice-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 '{
  "startUrls": [
    {
      "url": "https://xmlvalid.com/schemas/peppol-bis-3-invoice/example"
    }
  ],
  "schema": "auto"
}' |
apify call xmlvalid/xml-einvoice-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xmlvalid/xml-einvoice-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/FAGatUrcWi3gvAznc/builds/Azawhx5ddjNHqLDQq/openapi.json
