# Factur-X E-Invoice Validator & EU/FR KYB Check (MCP) (`b2b-telemetry-labs/fr-eu-einvoicing-kyb-mcp`) Actor

Validate Factur-X EN 16931 e-invoices and verify SIREN, EU VIES VAT proofs, and BODACC insolvency in real time via API or MCP.

- **URL**: https://apify.com/b2b-telemetry-labs/fr-eu-einvoicing-kyb-mcp.md
- **Developed by:** [Arthur Vatel](https://apify.com/b2b-telemetry-labs) (community)
- **Categories:** Business, Developer tools, Automation
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.00 / 1,000 kyb or factur-x invoice audits

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## EU & France E-Invoicing (Factur-X) Validator & KYB Company Check MCP

Verify **Factur-X / ZUGFeRD / EN 16931 / UBL 2.1** electronic invoices and run real-time **French & European KYB (Know Your Business)** supplier checks—available both as a **Batch Apify Actor** and a **Standby Streamable HTTP MCP Server** (`/mcp`) for AI agents, ERPs, and automation workflows.

Built for the **2026 French B2B e-invoicing mandate** and European cross-border supplier compliance, running on just **128–256 MB RAM** with zero headless browser overhead.

***

### Key Capabilities

1. **Factur-X & EN 16931 / UBL 2.1 Deterministic Validator**
   - Extracts embedded XML (`factur-x.xml`, `zugferd-invoice.xml`, `xrechnung.xml`) directly from **base64-encoded PDF/A-3** documents (`/Names/EmbeddedFiles`) or parses raw **CII / UBL 2.1 XML**.
   - Built-in **XXE / DTD protection** (rejects `<!DOCTYPE` and `<!ENTITY` declarations).
   - Validates mandatory EN 16931 & BR-FR fields: `BT-1` (invoice number), `BT-2` (issue date), `BT-3` (type code e.g. `380`, `381`), `BT-5` (ISO currency), seller/buyer names, SIREN/SIRET, and VAT numbers.
   - Strict decimal arithmetic verification (`TaxExclusiveAmount + TaxAmount == TaxInclusiveAmount` within `0.02`, plus invoice line summation checks).

2. **Real-Time French & EU KYB Connectors**
   - **Official French SIRENE API** (`recherche-entreprises.api.gouv.fr`): legal name, active/ceased administrative status (`etat_administratif`), NAF/APE code, headcount bracket, headquarters SIRET/address, and executives (`dirigeants`).
   - **Official FR VAT Checksum & EU VIES API**: mathematical computation of French intra-community VAT (`FR{key}{SIREN}`) + live European Commission VIES REST verification with a strict 5-second timeout and automatic `member_state_timeout_fallback` when Brussels VIES is temporarily unavailable.
   - **Official BODACC Insolvency Monitoring** (`bodacc-datadila.opendatasoft.com`): scans recent commercial announcements to detect *sauvegarde*, *redressement judiciaire*, *liquidation judiciaire*, and *radiation*.

3. **Dual Mode: Apify Batch Actor & Standby MCP Server**
   - **Batch Mode**: Process invoices and company lists via Apify Console, API, or n8n/Make schedules and export structured JSON to the Apify Dataset.
   - **MCP Standby Mode (`/mcp`)**: Connect Claude Desktop, Cursor, Windsurf, or custom AI agents directly over Streamable HTTP JSON-RPC 2.0 (`tools/list`, `tools/call`).

***

### Use Cases

- **ERP & Accounting Pre-Validation**: Reject non-compliant Factur-X invoices before PDP/PPF transmission or ERP ingestion.
- **Automated Supplier Onboarding (KYB)**: Verify new French/EU vendors against SIRENE, VIES, and BODACC insolvency registries in under a second.
- **AI Agent Tooling (MCP)**: Give autonomous procurement, finance, and compliance agents deterministic tools (`check_company_kyb`, `validate_facturx_invoice`) without hallucinated company data.

***

### Input Example (Batch Mode)

```json
{
  "action": "full_supplier_audit",
  "identifiers": ["380129866"],
  "facturxXmlOrBase64Pdf": "<rsm:CrossIndustryInvoice ...>...</rsm:CrossIndustryInvoice>",
  "includeBodaccInsolvency": true
}
```

#### Input Parameters

| Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `action` | `string` | `"full_supplier_audit"` | `"kyb_check"`, `"validate_facturx"`, or `"full_supplier_audit"`. |
| `identifiers` | `string[]` | `[]` | French SIREN (9 digits), SIRET (14 digits), or EU VAT numbers (e.g. `"380129866"`, `"FR32380129866"`). |
| `facturxXmlOrBase64Pdf` | `string` | `null` | Raw Factur-X CII / UBL 2.1 XML string or base64-encoded PDF/A-3 document. |
| `includeBodaccInsolvency` | `boolean` | `true` | Query official BODACC records for collective insolvency procedures or radiation. |

***

### Output Example

```json
{
  "action": "kyb_check",
  "invoice_validation": null,
  "kyb_checks": [
    {
      "identifier": {
        "raw": "380129866",
        "normalized": "380129866",
        "identifier_type": "SIREN",
        "country_code": "FR",
        "siren": "380129866",
        "vat_number": "FR89380129866",
        "computed_fr_vat": "FR89380129866",
        "fr_vat_math_valid": true
      },
      "sirene": {
        "found": true,
        "siren": "380129866",
        "nom_complet": "ORANGE",
        "etat_administratif": "A",
        "is_active": true,
        "activite_principale": "61.10Z"
      },
      "vies": {
        "vies_status": "valid",
        "valid": true,
        "computed_fr_vat": "FR89380129866"
      },
      "bodacc": {
        "checked": true,
        "insolvency_alert": false,
        "radiation_detected": false
      },
      "risk_level": "LOW",
      "risk_flags": []
    }
  ]
}
```

***

### MCP Integration (Claude Desktop / Cursor / n8n)

When deployed on Apify in **Standby Mode**, the MCP endpoint is exposed at:

`https://<your-actor-standby-url>/mcp`

#### Exposed MCP Tools

1. **`check_company_kyb`**: Accepts `identifier` (SIREN/SIRET/EU VAT) and `include_bodacc_insolvency` (bool).
2. **`validate_facturx_invoice`**: Accepts `facturx_xml_or_base64_pdf` (XML string or base64 PDF/A-3).

Example client configuration (`mcpServers`):

```json
{
  "mcpServers": {
    "fr-eu-einvoicing-kyb": {
      "type": "http",
      "url": "https://<your-actor-standby-url>/mcp",
      "headers": {
        "Authorization": "Bearer <APIFY_API_TOKEN>"
      }
    }
  }
}
```

***

### Pay-Per-Event Pricing Transparency

This Actor uses transparent **Pay-Per-Event** billing (`kyb-or-invoice-audit`):

- **Batch mode**: Charges `1` `kyb-or-invoice-audit` event per audit run.
- **MCP Standby mode**: Charges `1` `kyb-or-invoice-audit` event per successful `tools/call` invocation (`check_company_kyb` or `validate_facturx_invoice`).
- Respects Apify spending limits (`event_charge_limit_reached`) and uses idempotency keys to prevent duplicate charges.

# Actor input Schema

## `action` (type: `string`):

Operation to execute: 'kyb_check' (company registry, VAT & BODACC), 'validate_facturx' (Factur-X PDF/XML EN 16931 check), or 'full_supplier_audit' (both invoice validation and supplier/buyer KYB checks).

## `identifiers` (type: `array`):

List of French SIREN (9 digits), SIRET (14 digits), or EU VAT numbers (e.g. '380129866', 'FR32380129866', 'DE123456789').

## `facturxXmlOrBase64Pdf` (type: `string`):

Optional raw CII / UBL 2.1 XML invoice string OR base64-encoded Factur-X / ZUGFeRD PDF/A-3 document containing embedded XML.

## `includeBodaccInsolvency` (type: `boolean`):

Query official BODACC commercial announcements to detect sauvegarde, redressement judiciaire, liquidation judiciaire, or radiation.

## Actor input object example

```json
{
  "action": "full_supplier_audit",
  "identifiers": [
    "380129866"
  ],
  "includeBodaccInsolvency": 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 = {
    "identifiers": [
        "380129866"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("b2b-telemetry-labs/fr-eu-einvoicing-kyb-mcp").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 = { "identifiers": ["380129866"] }

# Run the Actor and wait for it to finish
run = client.actor("b2b-telemetry-labs/fr-eu-einvoicing-kyb-mcp").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 '{
  "identifiers": [
    "380129866"
  ]
}' |
apify call b2b-telemetry-labs/fr-eu-einvoicing-kyb-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,b2b-telemetry-labs/fr-eu-einvoicing-kyb-mcp"
        }
    }
}
```

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/hUFNXMgmVjZ44IOPu/builds/nnAkW0BQVir1Z895b/openapi.json
