# Factur-X Validator & Generator (2026 Mandate) (`comall-agency/facturx-validator-generator`) Actor

Validate a Factur-X invoice (PDF/A-3 or bare CII XML) against EN16931 and the French BR-FR business rules, or generate a compliant PDF/A-3 from invoice data. Totals are recalculated server-side and a mismatch is rejected, never silently corrected. Preflight for the 2026 mandate.

- **URL**: https://apify.com/comall-agency/facturx-validator-generator.md
- **Developed by:** [Comall Agency](https://apify.com/comall-agency) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 50.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Factur-X Validator & Generator (2026 Mandate)

Validate or generate Factur-X invoices (PDF/A-3 with an embedded
EN16931/CII XML payload) ahead of France's B2B e-invoicing mandate —
1 September 2026 for large and medium companies, 2027 for small
businesses.

This Actor is a thin, faithful wrapper around a production validation
engine (veraPDF + Saxon under the hood). It does not reimplement any
compliance logic, so its results match what that engine already produces
in production.

### Use cases

- **Compliance and finance teams** — a real preflight check on outgoing or
  incoming Factur-X invoices before the deadline, instead of discovering
  the problem when a customer's system rejects the invoice.
- **ERP and invoicing software** — validate your generated Factur-X output
  against EN16931/CII and the French BR-FR rules before shipping it.
- **Developers** — generate a compliant Factur-X PDF/A-3 from structured
  invoice data, with server-side total recalculation and internal
  re-validation before you ever see the file.

### What it does

**`validate`** — checks an existing PDF or XML invoice against the
Factur-X / EN16931 (CII) rules and the French business rules (`BR-FR-*`),
and returns a structured compliance report listing errors by rule code.

**`generate`** — builds a new, compliant Factur-X PDF from structured
invoice data. Totals are **always recalculated server-side** from the line
items, and the request is **rejected rather than silently corrected** if
the totals you send do not match. The generated PDF is re-validated
internally before being returned, so you never receive a non-compliant
document.

### Input — validate

```json
{
  "operation": "validate",
  "fileUrl": "https://example.com/invoice.pdf"
}
```

Use `fileUrl` **or** `fileBase64` (raw file content, base64-encoded), not
both. The input form ships with a prefilled URL pointing at a real sample
Factur-X invoice — run it as-is to see exactly what a validation report
looks like, then replace it with your own file.

### Input — generate

```json
{
  "operation": "generate",
  "invoiceData": {
    "numero": "FA-2026-0001",
    "date_emission": "2026-08-26",
    "type_code": "380",
    "devise": "EUR",
    "vendeur": {
      "nom": "Ma Société SAS",
      "siren_siret": "12345678900012",
      "tva_intracom": "FR12345678900",
      "adresse": { "ligne1": "1 rue Exemple", "code_postal": "75001", "ville": "Paris", "pays": "FR" }
    },
    "acheteur": {
      "nom": "Client SARL",
      "siren_siret": "98765432100019",
      "adresse": { "ligne1": "2 avenue Client", "code_postal": "69001", "ville": "Lyon", "pays": "FR" }
    },
    "lignes": [
      { "designation": "Prestation de conseil", "quantite": 1, "prix_unitaire_ht": 1000, "taux_tva": 20, "categorie_tva": "S" }
    ],
    "totaux": { "total_ht": 1000, "total_tva": 200, "total_ttc": 1200 }
  }
}
```

The `totaux` block is checked against a server-side recalculation of the
line items. A mismatch returns a `TOTALS_MISMATCH` rejection instead of a
document — deliberately, because a compliance document built from
inconsistent totals is worse than no document.

### Output — validate

```json
{
  "operation": "validate",
  "ok": true,
  "result": { "...": "structured compliance report, errors listed by rule code" }
}
```

When the upstream engine returns an error for your file (for example a
file that is too large, or empty), the row instead carries
`"ok": false` together with `httpStatus` and the `error` payload, so you
always get the real reason rather than a fabricated verdict.

### Output — generate

```json
{
  "operation": "generate",
  "ok": true,
  "pdfKeyValueStoreKey": "invoice-FA-2026-0001.pdf",
  "pdfUrl": "https://api.apify.com/v2/key-value-stores/.../records/invoice-FA-2026-0001.pdf"
}
```

The generated PDF is stored in the run's key-value store under
`pdfKeyValueStoreKey`, and `pdfUrl` links straight to it.

### Pricing (pay-per-event)

| Event | Price | Charged when |
|---|---|---|
| `validation` | $0.05 | A validation check was performed and returned a real answer — whether the invoice passes or fails. |
| `generation` | $0.08 | A compliant Factur-X PDF was actually produced and returned. |

**Charged for a failed check, to be explicit about it:** if the engine
rejects your file as too large or empty, the validation event is still
charged, because the check was genuinely performed on the file you sent.
You are paying for the answer, not for a "pass".

**Never charged:** the upstream service being unreachable, rate-limited or
saturated (those abort the run rather than billing you), and — for
`generate` — any rejected request where no PDF was produced, including a
totals mismatch.

### Limitations — read this before you buy

- Covers the **French** mandate specifically: EN16931/CII plus the
  `BR-FR-*` business rules. Other countries' e-invoicing formats
  (FatturaPA, XRechnung profiles beyond CII, Peppol BIS variants) are out
  of scope.
- This Actor calls a live external API it does not run itself, so its
  availability tracks that service's availability. When that service is
  down, the run fails loudly and unbilled rather than returning a guess.
- Validation reports what the rules say. It is not tax advice, and passing
  validation is not a statement about the invoice's commercial or legal
  correctness.

### FAQ

**Can I validate an XML file without the PDF wrapper?**
Yes — `validate` accepts both a PDF/A-3 and a bare CII XML file.

**What happens if my totals are off by a cent?**
`generate` rejects the request and tells you so, and you are not charged.
Rounding differences between your system and the recalculation are the
most common cause.

### Related Actors

- [French E-Invoice Partner Resolver](https://apify.com/comall-agency/fr-einvoice-partner-resolver) — resolve SIRET / SIREN / VAT details for the parties on an invoice.
- [EU VAT Number Checker](https://apify.com/comall-agency/eu-vat-checker) — confirm a customer's VAT number against the official VIES service before you issue a zero-rated invoice.
- [IBAN Validator & Formatter](https://apify.com/comall-agency/iban-validator-formatter) — check the payment details carried on the invoice.

# Actor input Schema

## `operation` (type: `string`):

validate: check that a PDF/A-3 or XML invoice complies with the Factur-X / EN16931 (CII) standard. generate: build a new, compliant Factur-X PDF from structured invoice data.

## `fileUrl` (type: `string`):

Public URL of the PDF or XML invoice to validate. Use this OR fileBase64, not both. Required when operation = validate. The prefilled URL is a real sample Factur-X invoice (PDF/A-3B with an embedded EN16931 CII factur-x.xml) — run it as-is to see exactly what a validation report looks like, then replace it with your own invoice.

## `fileBase64` (type: `string`):

Base64-encoded raw file content, as an alternative to fileUrl. Required when operation = validate and fileUrl is not set.

## `invoiceData` (type: `object`):

Structured invoice data used to build a new Factur-X PDF. Required when operation = generate. See the README for the full field reference (seller/buyer, SIREN/SIRET, VAT rates, line items...). Totals are RECALCULATED server-side and the request is rejected if the totals you send don't match — never trust client-provided totals for a compliance document.

## Actor input object example

```json
{
  "operation": "validate",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/DsZ5HTNC4PojX3A8a/records/facturx-sample-invoice.pdf",
  "invoiceData": {
    "numero": "FA-2026-0001",
    "date_emission": "2026-08-26",
    "type_code": "380",
    "devise": "EUR",
    "vendeur": {
      "nom": "Ma Société SAS",
      "siren_siret": "12345678900012",
      "tva_intracom": "FR12345678900",
      "adresse": {
        "ligne1": "1 rue Exemple",
        "code_postal": "75001",
        "ville": "Paris",
        "pays": "FR"
      }
    },
    "acheteur": {
      "nom": "Client SARL",
      "siren_siret": "98765432100019",
      "adresse": {
        "ligne1": "2 avenue Client",
        "code_postal": "69001",
        "ville": "Lyon",
        "pays": "FR"
      }
    },
    "lignes": [
      {
        "designation": "Prestation de conseil",
        "quantite": 1,
        "prix_unitaire_ht": 1000,
        "taux_tva": 20,
        "categorie_tva": "S"
      }
    ],
    "totaux": {
      "total_ht": 1000,
      "total_tva": 200,
      "total_ttc": 1200
    }
  }
}
```

# 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 = {
    "operation": "validate",
    "fileUrl": "https://api.apify.com/v2/key-value-stores/DsZ5HTNC4PojX3A8a/records/facturx-sample-invoice.pdf",
    "invoiceData": {
        "numero": "FA-2026-0001",
        "date_emission": "2026-08-26",
        "type_code": "380",
        "devise": "EUR",
        "vendeur": {
            "nom": "Ma Société SAS",
            "siren_siret": "12345678900012",
            "tva_intracom": "FR12345678900",
            "adresse": {
                "ligne1": "1 rue Exemple",
                "code_postal": "75001",
                "ville": "Paris",
                "pays": "FR"
            }
        },
        "acheteur": {
            "nom": "Client SARL",
            "siren_siret": "98765432100019",
            "adresse": {
                "ligne1": "2 avenue Client",
                "code_postal": "69001",
                "ville": "Lyon",
                "pays": "FR"
            }
        },
        "lignes": [
            {
                "designation": "Prestation de conseil",
                "quantite": 1,
                "prix_unitaire_ht": 1000,
                "taux_tva": 20,
                "categorie_tva": "S"
            }
        ],
        "totaux": {
            "total_ht": 1000,
            "total_tva": 200,
            "total_ttc": 1200
        }
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("comall-agency/facturx-validator-generator").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 = {
    "operation": "validate",
    "fileUrl": "https://api.apify.com/v2/key-value-stores/DsZ5HTNC4PojX3A8a/records/facturx-sample-invoice.pdf",
    "invoiceData": {
        "numero": "FA-2026-0001",
        "date_emission": "2026-08-26",
        "type_code": "380",
        "devise": "EUR",
        "vendeur": {
            "nom": "Ma Société SAS",
            "siren_siret": "12345678900012",
            "tva_intracom": "FR12345678900",
            "adresse": {
                "ligne1": "1 rue Exemple",
                "code_postal": "75001",
                "ville": "Paris",
                "pays": "FR",
            },
        },
        "acheteur": {
            "nom": "Client SARL",
            "siren_siret": "98765432100019",
            "adresse": {
                "ligne1": "2 avenue Client",
                "code_postal": "69001",
                "ville": "Lyon",
                "pays": "FR",
            },
        },
        "lignes": [{
                "designation": "Prestation de conseil",
                "quantite": 1,
                "prix_unitaire_ht": 1000,
                "taux_tva": 20,
                "categorie_tva": "S",
            }],
        "totaux": {
            "total_ht": 1000,
            "total_tva": 200,
            "total_ttc": 1200,
        },
    },
}

# Run the Actor and wait for it to finish
run = client.actor("comall-agency/facturx-validator-generator").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 '{
  "operation": "validate",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/DsZ5HTNC4PojX3A8a/records/facturx-sample-invoice.pdf",
  "invoiceData": {
    "numero": "FA-2026-0001",
    "date_emission": "2026-08-26",
    "type_code": "380",
    "devise": "EUR",
    "vendeur": {
      "nom": "Ma Société SAS",
      "siren_siret": "12345678900012",
      "tva_intracom": "FR12345678900",
      "adresse": {
        "ligne1": "1 rue Exemple",
        "code_postal": "75001",
        "ville": "Paris",
        "pays": "FR"
      }
    },
    "acheteur": {
      "nom": "Client SARL",
      "siren_siret": "98765432100019",
      "adresse": {
        "ligne1": "2 avenue Client",
        "code_postal": "69001",
        "ville": "Lyon",
        "pays": "FR"
      }
    },
    "lignes": [
      {
        "designation": "Prestation de conseil",
        "quantite": 1,
        "prix_unitaire_ht": 1000,
        "taux_tva": 20,
        "categorie_tva": "S"
      }
    ],
    "totaux": {
      "total_ht": 1000,
      "total_tva": 200,
      "total_ttc": 1200
    }
  }
}' |
apify call comall-agency/facturx-validator-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,comall-agency/facturx-validator-generator"
        }
    }
}

```

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/UKhHRPJWT3khJhKM1/builds/Quhyy8gNyXjbeMzpv/openapi.json
