# XRechnung Invoice Generator (`kamerozkan/xrechnung-invoice-generator`) Actor

Generate XRechnung 3.0.2 UBL or CII from strict JSON and validate it with the pinned KoSIT rules before delivery.

- **URL**: https://apify.com/kamerozkan/xrechnung-invoice-generator.md
- **Developed by:** [Kamer Ozkan](https://apify.com/kamerozkan) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 invoice generateds

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/platform/actors/running/actors-in-store#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

Strict JSON in. A generated and technically validated XRechnung 3.0.2 artifact out.

The Actor calculates totals with decimal arithmetic, generates the target invoice,
runs an independent pinned validation stack, stores only accepted artifacts, and
returns a SHA-256 evidence record. A rejected artifact is not delivered or charged
under pay-per-event pricing.

### Input

Use `invoice` for one document or `invoices` for a batch of up to 100. Amounts and
quantities must be JSON strings such as `"19.00"`, not floating-point numbers.
The input schema exposes the complete production v1 canonical model and the strict
product extension. Unknown fields are rejected instead of being silently ignored.

### Production v1 capabilities

- Select UBL Invoice or UN/CEFACT CII syntax in the same product.
- Generate invoices, credit notes, and corrected invoices supported by the adapter.
- Map EN 16931 parties, delivery, references, periods, attachments, allowances, charges, payment data, tax groups, and monetary totals.
- Run the release-pinned KoSIT XRechnung validator and return its findings.

### Required product context

`buyer_reference`, seller contact details, and seller/buyer electronic endpoint identifiers are required by the XRechnung path.

### Output

Each dataset row contains the technical assessment, artifact key, evidence key,
hash, byte count, generator version, standard version, pinned ruleset, and bounded
findings. The artifact and evidence JSON are private key-value store records.

For pay-per-event deployment, configure `invoice-generated` at exactly USD 0.01
and keep the synthetic `apify-default-dataset-item` event at USD 0. The
synthetic `apify-actor-start` event may have any nonnegative configured price;
every other event must remain free. The runtime refuses hosted non-PPE runs and
unsafe event maps before reading input. Local non-PPE execution remains
available for offline tests. A paid run charges only an artifact that was
validated, stored, and delivered.

### Operational boundary

This Actor generates and validates the document. It does not submit to Peppol,
KSeF, SdI, or a French platform. It does not authenticate to an authority, create
a qualified signature, perform legal archival, assign an official network
identifier, or guarantee recipient or tax-authority acceptance. `ACCEPTED` means
the generated artifact passed the documented pinned offline technical gate.

# Actor input Schema

## `invoice` (type: `object`):

One invoice for XRechnung 3.0.2.

## `invoices` (type: `array`):

Optional batch of up to 100 invoices. Do not use with invoice.

## Actor input object example

```json
{
  "invoice": {
    "invoice_number": "INV-2026-0001",
    "issue_date": "2026-07-29",
    "due_date": "2026-08-28",
    "delivery_date": "2026-07-29",
    "currency": "EUR",
    "invoice_type_code": "380",
    "buyer_reference": "BUYER-REF-1001",
    "purchase_order_reference": "PO-2026-1001",
    "seller": {
      "name": "Example Supplier GmbH",
      "address": {
        "line1": "Musterstrasse 10",
        "city": "Berlin",
        "postal_code": "10115",
        "country_code": "DE"
      },
      "vat_id": "DE123456789",
      "registration_id": "HRB12345",
      "endpoint_id": "4000001123452",
      "endpoint_scheme": "0088",
      "email": "billing@example-supplier.test",
      "contact_name": "Billing Team",
      "phone": "+49 30 1234567"
    },
    "buyer": {
      "name": "Example Buyer GmbH",
      "address": {
        "line1": "Einkaufsweg 20",
        "city": "Hamburg",
        "postal_code": "20095",
        "country_code": "DE"
      },
      "vat_id": "DE987654321",
      "registration_id": "HRB54321",
      "endpoint_id": "4000001987658",
      "endpoint_scheme": "0088",
      "email": "accounts@example-buyer.test"
    },
    "lines": [
      {
        "id": "1",
        "description": "Consulting services",
        "quantity": "2",
        "unit_code": "HUR",
        "unit_price": "500.00",
        "tax_rate": "19",
        "tax_category": "S"
      }
    ],
    "payment": {
      "means_code": "30",
      "reference": "INV-2026-0001",
      "iban": "DE89370400440532013000",
      "bic": "COBADEFFXXX"
    },
    "notes": [
      "Generated sample for technical preflight."
    ],
    "extensions": {
      "xrechnung": {
        "syntax": "ubl"
      }
    }
  }
}
```

# Actor output Schema

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

One result row per requested invoice, including delivery status and bounded validation findings.

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

Run-level counts, standard and ruleset identity, billing mode, and explicit operational boundaries.

## `artifacts` (type: `string`):

Private XML or PDF records delivered only after every pinned technical gate accepted them.

## `evidence` (type: `string`):

SHA-256 identity, ruleset versions, validation outcome, and network-operation boundary for each delivered artifact.

# 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 = {
    "invoice": {
        "invoice_number": "INV-2026-0001",
        "issue_date": "2026-07-29",
        "due_date": "2026-08-28",
        "delivery_date": "2026-07-29",
        "currency": "EUR",
        "invoice_type_code": "380",
        "buyer_reference": "BUYER-REF-1001",
        "purchase_order_reference": "PO-2026-1001",
        "seller": {
            "name": "Example Supplier GmbH",
            "address": {
                "line1": "Musterstrasse 10",
                "city": "Berlin",
                "postal_code": "10115",
                "country_code": "DE"
            },
            "vat_id": "DE123456789",
            "registration_id": "HRB12345",
            "endpoint_id": "4000001123452",
            "endpoint_scheme": "0088",
            "email": "billing@example-supplier.test",
            "contact_name": "Billing Team",
            "phone": "+49 30 1234567"
        },
        "buyer": {
            "name": "Example Buyer GmbH",
            "address": {
                "line1": "Einkaufsweg 20",
                "city": "Hamburg",
                "postal_code": "20095",
                "country_code": "DE"
            },
            "vat_id": "DE987654321",
            "registration_id": "HRB54321",
            "endpoint_id": "4000001987658",
            "endpoint_scheme": "0088",
            "email": "accounts@example-buyer.test"
        },
        "lines": [
            {
                "id": "1",
                "description": "Consulting services",
                "quantity": "2",
                "unit_code": "HUR",
                "unit_price": "500.00",
                "tax_rate": "19",
                "tax_category": "S"
            }
        ],
        "payment": {
            "means_code": "30",
            "reference": "INV-2026-0001",
            "iban": "DE89370400440532013000",
            "bic": "COBADEFFXXX"
        },
        "notes": [
            "Generated sample for technical preflight."
        ],
        "extensions": {
            "xrechnung": {
                "syntax": "ubl"
            }
        }
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kamerozkan/xrechnung-invoice-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 = { "invoice": {
        "invoice_number": "INV-2026-0001",
        "issue_date": "2026-07-29",
        "due_date": "2026-08-28",
        "delivery_date": "2026-07-29",
        "currency": "EUR",
        "invoice_type_code": "380",
        "buyer_reference": "BUYER-REF-1001",
        "purchase_order_reference": "PO-2026-1001",
        "seller": {
            "name": "Example Supplier GmbH",
            "address": {
                "line1": "Musterstrasse 10",
                "city": "Berlin",
                "postal_code": "10115",
                "country_code": "DE",
            },
            "vat_id": "DE123456789",
            "registration_id": "HRB12345",
            "endpoint_id": "4000001123452",
            "endpoint_scheme": "0088",
            "email": "billing@example-supplier.test",
            "contact_name": "Billing Team",
            "phone": "+49 30 1234567",
        },
        "buyer": {
            "name": "Example Buyer GmbH",
            "address": {
                "line1": "Einkaufsweg 20",
                "city": "Hamburg",
                "postal_code": "20095",
                "country_code": "DE",
            },
            "vat_id": "DE987654321",
            "registration_id": "HRB54321",
            "endpoint_id": "4000001987658",
            "endpoint_scheme": "0088",
            "email": "accounts@example-buyer.test",
        },
        "lines": [{
                "id": "1",
                "description": "Consulting services",
                "quantity": "2",
                "unit_code": "HUR",
                "unit_price": "500.00",
                "tax_rate": "19",
                "tax_category": "S",
            }],
        "payment": {
            "means_code": "30",
            "reference": "INV-2026-0001",
            "iban": "DE89370400440532013000",
            "bic": "COBADEFFXXX",
        },
        "notes": ["Generated sample for technical preflight."],
        "extensions": { "xrechnung": { "syntax": "ubl" } },
    } }

# Run the Actor and wait for it to finish
run = client.actor("kamerozkan/xrechnung-invoice-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "invoice": {
    "invoice_number": "INV-2026-0001",
    "issue_date": "2026-07-29",
    "due_date": "2026-08-28",
    "delivery_date": "2026-07-29",
    "currency": "EUR",
    "invoice_type_code": "380",
    "buyer_reference": "BUYER-REF-1001",
    "purchase_order_reference": "PO-2026-1001",
    "seller": {
      "name": "Example Supplier GmbH",
      "address": {
        "line1": "Musterstrasse 10",
        "city": "Berlin",
        "postal_code": "10115",
        "country_code": "DE"
      },
      "vat_id": "DE123456789",
      "registration_id": "HRB12345",
      "endpoint_id": "4000001123452",
      "endpoint_scheme": "0088",
      "email": "billing@example-supplier.test",
      "contact_name": "Billing Team",
      "phone": "+49 30 1234567"
    },
    "buyer": {
      "name": "Example Buyer GmbH",
      "address": {
        "line1": "Einkaufsweg 20",
        "city": "Hamburg",
        "postal_code": "20095",
        "country_code": "DE"
      },
      "vat_id": "DE987654321",
      "registration_id": "HRB54321",
      "endpoint_id": "4000001987658",
      "endpoint_scheme": "0088",
      "email": "accounts@example-buyer.test"
    },
    "lines": [
      {
        "id": "1",
        "description": "Consulting services",
        "quantity": "2",
        "unit_code": "HUR",
        "unit_price": "500.00",
        "tax_rate": "19",
        "tax_category": "S"
      }
    ],
    "payment": {
      "means_code": "30",
      "reference": "INV-2026-0001",
      "iban": "DE89370400440532013000",
      "bic": "COBADEFFXXX"
    },
    "notes": [
      "Generated sample for technical preflight."
    ],
    "extensions": {
      "xrechnung": {
        "syntax": "ubl"
      }
    }
  }
}' |
apify call kamerozkan/xrechnung-invoice-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=kamerozkan/xrechnung-invoice-generator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/HlIggRDjYfaKrqH2f/builds/GKlt9l28FPu9zeHhP/openapi.json
