# Peppol UBL to JSON Parser (`kamerozkan/peppol-ubl-to-json-parser`) Actor

Parse Peppol BIS Billing UBL invoices and credit notes into stable JSON with document-level technical conformance findings. Transport is not included.

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

## Pricing

from $5.00 / 1,000 document processeds

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

Validate Peppol BIS Billing UBL Invoice and CreditNote documents and return the
shared EN 16931-oriented JSON contract.

### What it does

- Accepts UBL 2.1 Invoice and CreditNote documents.
- Detects Peppol CustomizationID, ProfileID, document type, and source digest.
- Runs XSD, CEN EN 16931, and Peppol document rules through the pinned KoSIT
  runtime.
- Uses the active Peppol BIS Billing `3.0.20-hotfix` ruleset, including the
  mandatory `0245` electronic-address scheme update.
- Keeps upcoming `3.0.21` disabled until its effective date and artifact pin
  are active.
- Normalizes the full declared UBL binding with business-term trace entries.
- Can unwrap exactly one business document from an SBDH envelope when
  `unwrapSbdh` is enabled.
- Can store KoSIT XML and XHTML reports as opt-in KVS artifacts.

When SBDH is unwrapped, the result explicitly reports
`UNWRAPPED_NOT_VALIDATED`. The SBDH header is not silently treated as
validated.

### Product boundary

`Peppol` here means Peppol BIS Billing document rules only. This Actor does
not provide:

- an Access Point;
- SMP or SML participant discovery;
- AS4 transport;
- invoice sending or receiving;
- a delivery receipt or network-status service;
- Peppol certification or accreditation.

The Actor also does not make legal, tax, authenticity, signature, or recipient
acceptance decisions.

### Release state

The processing engine and Actor contract are feature-complete. The source
contains a fail-closed pay-per-event charge path for `document-processed` at
exactly `$0.005` per evaluated document. Local non-PPE results remain
`billable: false`; a hosted run stops before processing unless the event and
price contract are active. The synthetic `apify-actor-start` event is allowed,
while `apify-default-dataset-item` must cost USD 0. Apify Console
configuration, a Docker image build, and hosted lifecycle, charge-count, and
budget-limit smoke tests remain before Store publication.

# Actor input Schema

## `invoiceFiles` (type: `array`):

Upload Peppol BIS Billing UBL Invoice or CreditNote XML files.

## `documents` (type: `array`):

Each item must contain exactly one source: url, xml, base64, or keyValueStoreKey.

## `sourceKeyValueStoreId` (type: `string`):

Key-value store ID containing records referenced by keyValueStoreKey.

## `documentType` (type: `string`):

Detect the UBL document type automatically or require Invoice or CreditNote.

## `ruleset` (type: `string`):

LATEST\_SUPPORTED resolves to an exact version and digest in every final report.

## `unwrapSbdh` (type: `boolean`):

When present, unwrap a supported Standard Business Document Header before document parsing.

## `allowPartialNormalization` (type: `boolean`):

Return safely mapped fields when full source-to-JSON semantic coverage cannot be proven.

## `storeTechnicalReports` (type: `boolean`):

Store the KoSIT XML report and embedded HTML report in the run key-value store. Reports can contain invoice data.

## `maxFindingsPerDocument` (type: `integer`):

Maximum number of validation findings returned for each document.

## Actor input object example

```json
{
  "documents": [
    {
      "documentId": "official-peppol-valid-sample",
      "fileName": "base-example.xml",
      "url": "https://raw.githubusercontent.com/itplr-kosit/validator-configuration-bis/release-3.0.20/test-files/good/ubl/base-example.xml"
    }
  ],
  "documentType": "AUTO",
  "ruleset": "LATEST_SUPPORTED",
  "unwrapSbdh": true,
  "allowPartialNormalization": true,
  "storeTechnicalReports": false,
  "maxFindingsPerDocument": 100
}
```

# Actor output Schema

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

Default Dataset rows validated against the versioned invoice, conversion, conformance, and semantic-difference contract.

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

The OUTPUT key-value-store record with aggregate processing and billing counts.

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

ARTIFACT-prefixed key-value-store records written only when artifact storage was requested.

# 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 = {
    "documents": [
        {
            "documentId": "official-peppol-valid-sample",
            "fileName": "base-example.xml",
            "url": "https://raw.githubusercontent.com/itplr-kosit/validator-configuration-bis/release-3.0.20/test-files/good/ubl/base-example.xml"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kamerozkan/peppol-ubl-to-json-parser").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 = { "documents": [{
            "documentId": "official-peppol-valid-sample",
            "fileName": "base-example.xml",
            "url": "https://raw.githubusercontent.com/itplr-kosit/validator-configuration-bis/release-3.0.20/test-files/good/ubl/base-example.xml",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("kamerozkan/peppol-ubl-to-json-parser").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 '{
  "documents": [
    {
      "documentId": "official-peppol-valid-sample",
      "fileName": "base-example.xml",
      "url": "https://raw.githubusercontent.com/itplr-kosit/validator-configuration-bis/release-3.0.20/test-files/good/ubl/base-example.xml"
    }
  ]
}' |
apify call kamerozkan/peppol-ubl-to-json-parser --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/2H8UdIY1VkrGgFZh4/builds/7cZAas9VkqNVHMHzz/openapi.json
