# E-Invoice Pre-check MCP: EN 16931 UBL and CII XML (`agustin-recoba/einvoice-precheck-mcp`) Actor

MCP server and Actor that pre-checks EN 16931 e-invoice XML (UBL 2.1 or CII): failed rules, XML location and, for amount errors, the expected value. Recomputes VAT totals. A pre-check, not a certification.

- **URL**: https://apify.com/agustin-recoba/einvoice-precheck-mcp.md
- **Developed by:** [Agustín Recoba](https://apify.com/agustin-recoba) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 invoice checks or recompute

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 pre-check: MCP server for EN 16931 XML

Give it the XML of an e-invoice and it lists the EN 16931 rules the document fails, where in the XML, and for amount and rate errors the value it expected. It reads UBL 2.1 (invoice and credit note) and UN/CEFACT CII, which is the XML inside Factur-X and ZUGFeRD.

It is a pre-check, not a certification of compliance, and not legal or tax advice. A result without errors does not make an invoice valid or compliant. Run the validator your recipient or platform requires before going live. The official CEN artefacts and the KoSIT validator are free.

### Connect an AI agent (MCP)

The server speaks MCP over Streamable HTTP. Every request needs your own Apify API token.

```json
{
  "mcpServers": {
    "einvoice-precheck": {
      "url": "https://agustin-recoba--einvoice-precheck-mcp.apify.actor/mcp",
      "headers": { "Authorization": "Bearer <YOUR_APIFY_TOKEN>" }
    }
  }
}
```

| Tool | What it does | Charged |
| --- | --- | --- |
| `validate_invoice` | Failed rules with XML location and, where it can be computed, expected and found values. Arguments: `xml`, `max_findings` (1 to 200, default 50) | yes |
| `recompute_totals` | VAT breakdown and totals derived from the lines, next to the stated values. Argument: `xml` | yes |
| `explain_rule` | What a rule such as `BR-CO-17` requires. Argument: `rule_id` | no |

Ask your agent, for example: "Validate this invoice XML and tell me how to fix each error."

### Run it without MCP

Pick an operation on the **Input** tab and start a run. The run stores one dataset item.

Input:

```json
{ "operation": "explain_rule", "ruleId": "BR-CO-15" }
```

Output (one item):

```json
{
  "operation": "explain_rule",
  "result": {
    "rule": "BR-CO-15",
    "severity": "fatal",
    "description": "Total with VAT (BT-112) = BT-109 + BT-110, with exactly one VAT total in the document currency."
  }
}
```

The prefilled input checks a made-up UBL invoice that has deliberate errors.

### Pricing

Pay per event. One successful `validate_invoice` or `recompute_totals` call costs USD 0.005, through the MCP server or a run. `explain_rule`, `tools/list` and input that cannot be read are not charged. A run started on the Input tab also has the Actor start event (USD 0.00005).

### What is checked

196 EN 16931 model rules: mandatory fields (BR-01 to BR-65), conditions and calculations (BR-CO), decimal precision (BR-DEC) and the VAT category rules, including reverse charge and intra-community supply. Against the official test material of CEN release 1.3.17 it agreed with all 1056 unit test expectations for the rules it implements and reported no errors on the 34 example invoices. Those unit tests are almost all UBL; CII is covered mainly by the examples and by this project's own tests.

### What it does not check

XML schema (XSD) validity, code lists (BR-CL), syntax binding rules (UBL-*, CII-*), XRechnung, Peppol or other national rule sets, BR-CO-25, and PDF/A-3. It does not extract XML from a PDF. One call takes up to 2 MB of XML. XML with a DOCTYPE is rejected.

### Privacy

The invoice is processed in memory. The server writes no part of it to disk or to the log and calls no other service with it. The one outbound call is the charge to the Apify API, which carries a request id and an event name. A run started on the Input tab stores your input and the result in your own Apify storage. Requests pass through Apify's platform. Test with anonymised invoices.

### Limits

- The server accepts 600 tool calls a minute, shared by all callers of one instance. Over the limit it answers with the seconds to wait.
- The first call after a quiet period waits for an instance to start.
- MCP revisions: 2026-07-28 and the `initialize` based ones from 2024-11-05 to 2025-11-25.

### Support and authorship

Open an issue on the **Issues** tab. It was written with AI assistance and tested against the official test material.

# Changelog

This Actor's version history is a separate document: https://apify.com/agustin-recoba/einvoice-precheck-mcp/changelog.md

# Actor input Schema

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

What to do.

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

The whole document: UBL 2.1 Invoice or CreditNote, or UN/CEFACT CrossIndustryInvoice. The prefilled one is a made-up invoice with deliberate errors. Used by the first two operations.

## `maxFindings` (type: `integer`):

How many failures to list (check only).

## `ruleId` (type: `string`):

A rule such as BR-CO-15 (explain only).

## Actor input object example

```json
{
  "operation": "validate_invoice",
  "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Fictional data written for this project, with deliberate errors. -->\n<Invoice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\"\n         xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\"\n         xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\">\n  <cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>\n  <cbc:ID>EX-2026-0001</cbc:ID>\n  <cbc:IssueDate>2026-11-02</cbc:IssueDate>\n  <cbc:DueDate>2026-12-02</cbc:DueDate>\n  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>\n  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>\n  <cac:AccountingSupplierParty>\n    <cac:Party>\n      <cbc:EndpointID schemeID=\"EM\">billing@seller.example</cbc:EndpointID>\n      <cac:PostalAddress>\n        <cbc:CityName>Berlin</cbc:CityName>\n        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>\n      </cac:PostalAddress>\n      <cac:PartyTaxScheme>\n        <cbc:CompanyID>DE123456789</cbc:CompanyID>\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\n      </cac:PartyTaxScheme>\n      <cac:PartyLegalEntity>\n        <cbc:RegistrationName>Example Seller GmbH</cbc:RegistrationName>\n      </cac:PartyLegalEntity>\n    </cac:Party>\n  </cac:AccountingSupplierParty>\n  <cac:AccountingCustomerParty>\n    <cac:Party>\n      <cbc:EndpointID schemeID=\"EM\">accounts@buyer.example</cbc:EndpointID>\n      <cac:PostalAddress>\n        <cbc:CityName>Hamburg</cbc:CityName>\n        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>\n      </cac:PostalAddress>\n      <cac:PartyLegalEntity>\n        <cbc:RegistrationName></cbc:RegistrationName>\n      </cac:PartyLegalEntity>\n    </cac:Party>\n  </cac:AccountingCustomerParty>\n  <cac:PaymentMeans>\n    <cbc:PaymentMeansCode>58</cbc:PaymentMeansCode>\n    <cac:PayeeFinancialAccount><cbc:ID>DE89370400440532013000</cbc:ID></cac:PayeeFinancialAccount>\n  </cac:PaymentMeans>\n  <cac:AllowanceCharge>\n    <cbc:ChargeIndicator>false</cbc:ChargeIndicator>\n    <cbc:AllowanceChargeReason>Loyalty discount</cbc:AllowanceChargeReason>\n    <cbc:Amount currencyID=\"EUR\">10.00</cbc:Amount>\n    <cac:TaxCategory>\n      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\n      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\n    </cac:TaxCategory>\n  </cac:AllowanceCharge>\n  <cac:AllowanceCharge>\n    <cbc:ChargeIndicator>true</cbc:ChargeIndicator>\n    <cbc:AllowanceChargeReason>Freight</cbc:AllowanceChargeReason>\n    <cbc:Amount currencyID=\"EUR\">5.00</cbc:Amount>\n    <cac:TaxCategory>\n      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\n      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\n    </cac:TaxCategory>\n  </cac:AllowanceCharge>\n  <cac:TaxTotal>\n    <cbc:TaxAmount currencyID=\"EUR\">95.80</cbc:TaxAmount>\n    <cac:TaxSubtotal>\n      <cbc:TaxableAmount currencyID=\"EUR\">495.00</cbc:TaxableAmount>\n      <cbc:TaxAmount currencyID=\"EUR\">99.75</cbc:TaxAmount>\n      <cac:TaxCategory>\n        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\n      </cac:TaxCategory>\n    </cac:TaxSubtotal>\n    <cac:TaxSubtotal>\n      <cbc:TaxableAmount currencyID=\"EUR\">25.00</cbc:TaxableAmount>\n      <cbc:TaxAmount currencyID=\"EUR\">1.75</cbc:TaxAmount>\n      <cac:TaxCategory>\n        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\n      </cac:TaxCategory>\n    </cac:TaxSubtotal>\n  </cac:TaxTotal>\n  <cac:LegalMonetaryTotal>\n    <cbc:LineExtensionAmount currencyID=\"EUR\">552.00</cbc:LineExtensionAmount>\n    <cbc:TaxExclusiveAmount currencyID=\"EUR\">520.00</cbc:TaxExclusiveAmount>\n    <cbc:TaxInclusiveAmount currencyID=\"EUR\">615.80</cbc:TaxInclusiveAmount>\n    <cbc:AllowanceTotalAmount currencyID=\"EUR\">10.00</cbc:AllowanceTotalAmount>\n    <cbc:ChargeTotalAmount currencyID=\"EUR\">5.00</cbc:ChargeTotalAmount>\n    <cbc:PrepaidAmount currencyID=\"EUR\">100.00</cbc:PrepaidAmount>\n    <cbc:PayableAmount currencyID=\"EUR\">515.805</cbc:PayableAmount>\n  </cac:LegalMonetaryTotal>\n  <cac:InvoiceLine>\n    <cbc:ID>1</cbc:ID>\n    <cbc:InvoicedQuantity unitCode=\"C62\">10</cbc:InvoicedQuantity>\n    <cbc:LineExtensionAmount currencyID=\"EUR\">500.00</cbc:LineExtensionAmount>\n    <cac:Item>\n      <cbc:Name>Widget</cbc:Name>\n      <cac:ClassifiedTaxCategory>\n        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\n      </cac:ClassifiedTaxCategory>\n    </cac:Item>\n    <cac:Price><cbc:PriceAmount currencyID=\"EUR\">50.00</cbc:PriceAmount></cac:Price>\n  </cac:InvoiceLine>\n  <cac:InvoiceLine>\n    <cbc:ID>2</cbc:ID>\n    <cbc:InvoicedQuantity unitCode=\"C62\">2</cbc:InvoicedQuantity>\n    <cbc:LineExtensionAmount currencyID=\"EUR\">25.00</cbc:LineExtensionAmount>\n    <cac:Item>\n      <cbc:Name>Printed manual</cbc:Name>\n      <cac:ClassifiedTaxCategory>\n        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\n      </cac:ClassifiedTaxCategory>\n    </cac:Item>\n    <cac:Price><cbc:PriceAmount currencyID=\"EUR\">12.50</cbc:PriceAmount></cac:Price>\n  </cac:InvoiceLine>\n</Invoice>\n",
  "maxFindings": 50
}
```

# Actor output Schema

## `result` (type: `string`):

One item with the result of the operation.

# 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 = {
    "xml": `<?xml version="1.0" encoding="UTF-8"?>
<!-- Fictional data written for this project, with deliberate errors. -->
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
         xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>
  <cbc:ID>EX-2026-0001</cbc:ID>
  <cbc:IssueDate>2026-11-02</cbc:IssueDate>
  <cbc:DueDate>2026-12-02</cbc:DueDate>
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cbc:EndpointID schemeID="EM">billing@seller.example</cbc:EndpointID>
      <cac:PostalAddress>
        <cbc:CityName>Berlin</cbc:CityName>
        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>DE123456789</cbc:CompanyID>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Example Seller GmbH</cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cbc:EndpointID schemeID="EM">accounts@buyer.example</cbc:EndpointID>
      <cac:PostalAddress>
        <cbc:CityName>Hamburg</cbc:CityName>
        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>
      </cac:PostalAddress>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName></cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingCustomerParty>
  <cac:PaymentMeans>
    <cbc:PaymentMeansCode>58</cbc:PaymentMeansCode>
    <cac:PayeeFinancialAccount><cbc:ID>DE89370400440532013000</cbc:ID></cac:PayeeFinancialAccount>
  </cac:PaymentMeans>
  <cac:AllowanceCharge>
    <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
    <cbc:AllowanceChargeReason>Loyalty discount</cbc:AllowanceChargeReason>
    <cbc:Amount currencyID="EUR">10.00</cbc:Amount>
    <cac:TaxCategory>
      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
    </cac:TaxCategory>
  </cac:AllowanceCharge>
  <cac:AllowanceCharge>
    <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
    <cbc:AllowanceChargeReason>Freight</cbc:AllowanceChargeReason>
    <cbc:Amount currencyID="EUR">5.00</cbc:Amount>
    <cac:TaxCategory>
      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
    </cac:TaxCategory>
  </cac:AllowanceCharge>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="EUR">95.80</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="EUR">495.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="EUR">99.75</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="EUR">25.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="EUR">1.75</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="EUR">552.00</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="EUR">520.00</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="EUR">615.80</cbc:TaxInclusiveAmount>
    <cbc:AllowanceTotalAmount currencyID="EUR">10.00</cbc:AllowanceTotalAmount>
    <cbc:ChargeTotalAmount currencyID="EUR">5.00</cbc:ChargeTotalAmount>
    <cbc:PrepaidAmount currencyID="EUR">100.00</cbc:PrepaidAmount>
    <cbc:PayableAmount currencyID="EUR">515.805</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="C62">10</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="EUR">500.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>Widget</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price><cbc:PriceAmount currencyID="EUR">50.00</cbc:PriceAmount></cac:Price>
  </cac:InvoiceLine>
  <cac:InvoiceLine>
    <cbc:ID>2</cbc:ID>
    <cbc:InvoicedQuantity unitCode="C62">2</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="EUR">25.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>Printed manual</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price><cbc:PriceAmount currencyID="EUR">12.50</cbc:PriceAmount></cac:Price>
  </cac:InvoiceLine>
</Invoice>`
};

// Run the Actor and wait for it to finish
const run = await client.actor("agustin-recoba/einvoice-precheck-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 = { "xml": """<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!-- Fictional data written for this project, with deliberate errors. -->
<Invoice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\"
         xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\"
         xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\">
  <cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>
  <cbc:ID>EX-2026-0001</cbc:ID>
  <cbc:IssueDate>2026-11-02</cbc:IssueDate>
  <cbc:DueDate>2026-12-02</cbc:DueDate>
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cbc:EndpointID schemeID=\"EM\">billing@seller.example</cbc:EndpointID>
      <cac:PostalAddress>
        <cbc:CityName>Berlin</cbc:CityName>
        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>DE123456789</cbc:CompanyID>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Example Seller GmbH</cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cbc:EndpointID schemeID=\"EM\">accounts@buyer.example</cbc:EndpointID>
      <cac:PostalAddress>
        <cbc:CityName>Hamburg</cbc:CityName>
        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>
      </cac:PostalAddress>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName></cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingCustomerParty>
  <cac:PaymentMeans>
    <cbc:PaymentMeansCode>58</cbc:PaymentMeansCode>
    <cac:PayeeFinancialAccount><cbc:ID>DE89370400440532013000</cbc:ID></cac:PayeeFinancialAccount>
  </cac:PaymentMeans>
  <cac:AllowanceCharge>
    <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
    <cbc:AllowanceChargeReason>Loyalty discount</cbc:AllowanceChargeReason>
    <cbc:Amount currencyID=\"EUR\">10.00</cbc:Amount>
    <cac:TaxCategory>
      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
    </cac:TaxCategory>
  </cac:AllowanceCharge>
  <cac:AllowanceCharge>
    <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
    <cbc:AllowanceChargeReason>Freight</cbc:AllowanceChargeReason>
    <cbc:Amount currencyID=\"EUR\">5.00</cbc:Amount>
    <cac:TaxCategory>
      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
    </cac:TaxCategory>
  </cac:AllowanceCharge>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID=\"EUR\">95.80</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID=\"EUR\">495.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID=\"EUR\">99.75</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID=\"EUR\">25.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID=\"EUR\">1.75</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID=\"EUR\">552.00</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID=\"EUR\">520.00</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID=\"EUR\">615.80</cbc:TaxInclusiveAmount>
    <cbc:AllowanceTotalAmount currencyID=\"EUR\">10.00</cbc:AllowanceTotalAmount>
    <cbc:ChargeTotalAmount currencyID=\"EUR\">5.00</cbc:ChargeTotalAmount>
    <cbc:PrepaidAmount currencyID=\"EUR\">100.00</cbc:PrepaidAmount>
    <cbc:PayableAmount currencyID=\"EUR\">515.805</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode=\"C62\">10</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID=\"EUR\">500.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>Widget</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price><cbc:PriceAmount currencyID=\"EUR\">50.00</cbc:PriceAmount></cac:Price>
  </cac:InvoiceLine>
  <cac:InvoiceLine>
    <cbc:ID>2</cbc:ID>
    <cbc:InvoicedQuantity unitCode=\"C62\">2</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID=\"EUR\">25.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>Printed manual</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price><cbc:PriceAmount currencyID=\"EUR\">12.50</cbc:PriceAmount></cac:Price>
  </cac:InvoiceLine>
</Invoice>
""" }

# Run the Actor and wait for it to finish
run = client.actor("agustin-recoba/einvoice-precheck-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 '{
  "xml": "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!-- Fictional data written for this project, with deliberate errors. -->\\n<Invoice xmlns=\\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\\"\\n         xmlns:cac=\\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\\"\\n         xmlns:cbc=\\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\\">\\n  <cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>\\n  <cbc:ID>EX-2026-0001</cbc:ID>\\n  <cbc:IssueDate>2026-11-02</cbc:IssueDate>\\n  <cbc:DueDate>2026-12-02</cbc:DueDate>\\n  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>\\n  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>\\n  <cac:AccountingSupplierParty>\\n    <cac:Party>\\n      <cbc:EndpointID schemeID=\\"EM\\">billing@seller.example</cbc:EndpointID>\\n      <cac:PostalAddress>\\n        <cbc:CityName>Berlin</cbc:CityName>\\n        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>\\n      </cac:PostalAddress>\\n      <cac:PartyTaxScheme>\\n        <cbc:CompanyID>DE123456789</cbc:CompanyID>\\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\\n      </cac:PartyTaxScheme>\\n      <cac:PartyLegalEntity>\\n        <cbc:RegistrationName>Example Seller GmbH</cbc:RegistrationName>\\n      </cac:PartyLegalEntity>\\n    </cac:Party>\\n  </cac:AccountingSupplierParty>\\n  <cac:AccountingCustomerParty>\\n    <cac:Party>\\n      <cbc:EndpointID schemeID=\\"EM\\">accounts@buyer.example</cbc:EndpointID>\\n      <cac:PostalAddress>\\n        <cbc:CityName>Hamburg</cbc:CityName>\\n        <cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>\\n      </cac:PostalAddress>\\n      <cac:PartyLegalEntity>\\n        <cbc:RegistrationName></cbc:RegistrationName>\\n      </cac:PartyLegalEntity>\\n    </cac:Party>\\n  </cac:AccountingCustomerParty>\\n  <cac:PaymentMeans>\\n    <cbc:PaymentMeansCode>58</cbc:PaymentMeansCode>\\n    <cac:PayeeFinancialAccount><cbc:ID>DE89370400440532013000</cbc:ID></cac:PayeeFinancialAccount>\\n  </cac:PaymentMeans>\\n  <cac:AllowanceCharge>\\n    <cbc:ChargeIndicator>false</cbc:ChargeIndicator>\\n    <cbc:AllowanceChargeReason>Loyalty discount</cbc:AllowanceChargeReason>\\n    <cbc:Amount currencyID=\\"EUR\\">10.00</cbc:Amount>\\n    <cac:TaxCategory>\\n      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\\n      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\\n    </cac:TaxCategory>\\n  </cac:AllowanceCharge>\\n  <cac:AllowanceCharge>\\n    <cbc:ChargeIndicator>true</cbc:ChargeIndicator>\\n    <cbc:AllowanceChargeReason>Freight</cbc:AllowanceChargeReason>\\n    <cbc:Amount currencyID=\\"EUR\\">5.00</cbc:Amount>\\n    <cac:TaxCategory>\\n      <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\\n      <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\\n    </cac:TaxCategory>\\n  </cac:AllowanceCharge>\\n  <cac:TaxTotal>\\n    <cbc:TaxAmount currencyID=\\"EUR\\">95.80</cbc:TaxAmount>\\n    <cac:TaxSubtotal>\\n      <cbc:TaxableAmount currencyID=\\"EUR\\">495.00</cbc:TaxableAmount>\\n      <cbc:TaxAmount currencyID=\\"EUR\\">99.75</cbc:TaxAmount>\\n      <cac:TaxCategory>\\n        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\\n      </cac:TaxCategory>\\n    </cac:TaxSubtotal>\\n    <cac:TaxSubtotal>\\n      <cbc:TaxableAmount currencyID=\\"EUR\\">25.00</cbc:TaxableAmount>\\n      <cbc:TaxAmount currencyID=\\"EUR\\">1.75</cbc:TaxAmount>\\n      <cac:TaxCategory>\\n        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>\\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\\n      </cac:TaxCategory>\\n    </cac:TaxSubtotal>\\n  </cac:TaxTotal>\\n  <cac:LegalMonetaryTotal>\\n    <cbc:LineExtensionAmount currencyID=\\"EUR\\">552.00</cbc:LineExtensionAmount>\\n    <cbc:TaxExclusiveAmount currencyID=\\"EUR\\">520.00</cbc:TaxExclusiveAmount>\\n    <cbc:TaxInclusiveAmount currencyID=\\"EUR\\">615.80</cbc:TaxInclusiveAmount>\\n    <cbc:AllowanceTotalAmount currencyID=\\"EUR\\">10.00</cbc:AllowanceTotalAmount>\\n    <cbc:ChargeTotalAmount currencyID=\\"EUR\\">5.00</cbc:ChargeTotalAmount>\\n    <cbc:PrepaidAmount currencyID=\\"EUR\\">100.00</cbc:PrepaidAmount>\\n    <cbc:PayableAmount currencyID=\\"EUR\\">515.805</cbc:PayableAmount>\\n  </cac:LegalMonetaryTotal>\\n  <cac:InvoiceLine>\\n    <cbc:ID>1</cbc:ID>\\n    <cbc:InvoicedQuantity unitCode=\\"C62\\">10</cbc:InvoicedQuantity>\\n    <cbc:LineExtensionAmount currencyID=\\"EUR\\">500.00</cbc:LineExtensionAmount>\\n    <cac:Item>\\n      <cbc:Name>Widget</cbc:Name>\\n      <cac:ClassifiedTaxCategory>\\n        <cbc:ID>S</cbc:ID><cbc:Percent>19</cbc:Percent>\\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\\n      </cac:ClassifiedTaxCategory>\\n    </cac:Item>\\n    <cac:Price><cbc:PriceAmount currencyID=\\"EUR\\">50.00</cbc:PriceAmount></cac:Price>\\n  </cac:InvoiceLine>\\n  <cac:InvoiceLine>\\n    <cbc:ID>2</cbc:ID>\\n    <cbc:InvoicedQuantity unitCode=\\"C62\\">2</cbc:InvoicedQuantity>\\n    <cbc:LineExtensionAmount currencyID=\\"EUR\\">25.00</cbc:LineExtensionAmount>\\n    <cac:Item>\\n      <cbc:Name>Printed manual</cbc:Name>\\n      <cac:ClassifiedTaxCategory>\\n        <cbc:ID>S</cbc:ID><cbc:Percent>7</cbc:Percent>\\n        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>\\n      </cac:ClassifiedTaxCategory>\\n    </cac:Item>\\n    <cac:Price><cbc:PriceAmount currencyID=\\"EUR\\">12.50</cbc:PriceAmount></cac:Price>\\n  </cac:InvoiceLine>\\n</Invoice>\\n"
}' |
apify call agustin-recoba/einvoice-precheck-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,agustin-recoba/einvoice-precheck-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/VPrnjpuEqpbJkrZQF/builds/mOJUbpO7IqOjnsCRq/openapi.json
