Generating Compliant E-Invoices (UBL, CII, XRechnung, Factur-X)
Electronic invoicing across Europe is becoming a regulatory requirement, and generating fully compliant e-invoices can be complex due to country-specific formats and standards. Our E-Invoice API simplifies this process by transforming simple JSON data into structured, EN 16931-compliant invoices in multiple formats including UBL, CII, XRechnung, and Factur-X / ZUGFeRD.
This tutorial walks you through the available E-Invoice endpoints, so you can generate compliant invoices for B2G or B2B platforms with minimal effort.
How it works
- Retrieve the JSON schema to understand the required structure.
- Prepare invoice data in Peppol BIS Billing 3.0 format.
- Send the data to the appropriate endpoint to generate the final invoice.
1. Get Schema
Before generating an e-invoice, you can retrieve the JSON schema defining the required structure. This ensures that your JSON payload aligns with EN 16931 and Peppol BIS Billing 3.0 standards.
Endpoint Details
- HTTP Method:
GET - Request URL:
https://us1.pdfgeneratorapi.com/api/v4/einvoice/schema - Documentation: Official API Docs
cURL Example
curl --request GET \
--url https://us1.pdfgeneratorapi.com/api/v4/einvoice/schema \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
The response returns the JSON schema for your e-invoice payload.
2. Create eInvoice
Once you have retrieved the JSON schema using the Get Schema endpoint, you can use it to construct a valid invoice payload. This ensures your request meets the EN 16931 and Peppol BIS Billing 3.0 requirements before sending it for conversion.
The Create eInvoice endpoint takes this structured JSON and transforms it into a fully compliant XML e-invoice.
Endpoint Details
- HTTP Method:
POST - Request URL:
https://us1.pdfgeneratorapi.com/api/v4/einvoice - Documentation: Official API Docs
data object follows the schema returned by the Get Schema endpoint to avoid validation errors.Request Body
{
"data": {},
"type": "UBL",
"output": "base64"
}
Field Descriptions
data(required) – JSON payload representing a Peppol BIS Billing 3.0 invoice.type– Defines the output invoice format:"UBL"(default) – Universal Business Language format or"CII"– Cross-Industry Invoice format.output– Defines the response format:"base64"(default) – returns encoded content in the response or"file"– returns the file directly inline.
Response Example
{
"response": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvVHlwZSA...",
"meta": {
"encoding": "base64",
"content-type": "application/xml"
}
}
The response field contains the generated XML invoice, while meta provides information about encoding and content type.
cURL Example
For quick testing or integration, you can use the following cURL command:
curl --request POST \
--url https://us1.pdfgeneratorapi.com/api/v4/einvoice \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"data":{},"type":"UBL","output":"base64"}'
3. Create XRechnung eInvoice
If you need to generate invoices specifically for the German market, you can use the XRechnung endpoint. This format is commonly required for B2G transactions and increasingly used in B2B scenarios.
While the structure of the request remains the same as in the Create eInvoice endpoint, this endpoint ensures that the generated output complies with XRechnung specifications in addition to EN 16931.
Endpoint Details
- HTTP Method:
POST - Request URL:
https://us1.pdfgeneratorapi.com/api/v4/einvoice/xrechnung - Documentation: Official API Docs
Request Body
{
"data": {},
"type": "UBL",
"output": "base64"
}
Field Descriptions
data(required) – JSON payload representing a Peppol BIS Billing 3.0 invoice.type– Defines the output invoice format:"UBL"(default) – Universal Business Language format or"CII"– Cross-Industry Invoice format.output– Defines the response format:"base64"(default) – returns encoded content in the response or"file"– returns the file directly inline.
Response Example
{
"response": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvVHlwZSA...",
"meta": {
"encoding": "base64",
"content-type": "application/xml"
}
}
Similar to the Create eInvoice endpoint, the response field contains the generated XML invoice, while meta provides details about encoding and content type.
cURL Example
To quickly generate an XRechnung invoice, use the following cURL command:
curl --request POST \
--url https://us1.pdfgeneratorapi.com/api/v4/einvoice/xrechnung \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"data":{},"type":"UBL","output":"base64"}'
4. Create Factur-X / ZUGFeRD eInvoice
For use cases requiring both human-readable and machine-readable invoices, the Factur-X / ZUGFeRD format combines a PDF document with embedded structured XML. This endpoint generates a PDF/A-3 invoice with compliant XML embedded, suitable for workflows that need both a readable invoice and structured data for automation or compliance purposes, using a template and invoice data provided in the request.
To get started quickly, you can use our ready-made invoice template, so you don’t need to create one from scratch. If you prefer to create your own template, you can learn more about using the editor here.
Endpoint Details
- HTTP Method:
POST - Request URL:
https://us1.pdfgeneratorapi.com/api/v4/einvoice/facturx - Documentation: Official API Docs
Request Body
{
"template": {
"id": "REPLACE_TEMPLATE_ID",
"version_id": 12,
"data": {}
},
"profile": "basic",
"output": "base64",
"name": "Invoice 123",
"metadata": {
"author": "Organization name",
"language": "en"
}
}
Field Descriptions
template(required) – PDF template defining the invoice layout, includingid,version_id, anddata, which contains invoice data in Peppol BIS Billing 3.0 format and is used to populate the template and generate the embedded XML.profile– Factur-X / ZUGFeRD compliance level. Determines how much structured data is included:
|
|
|
|
|
|
output– Defines the response format:"base64"(default) – returns encoded content in the response;"file"– returns the file inline;"url"or"viewer"– stores the document for 30 days and deletes it automatically.name– Name of the generated document.metadata– Object containing additional document information, e.g.,author,language.
Response Example
{
"response": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvVHlwZSA...",
"meta": {
"name": "a2bd25b8921f3dc7a440fd7f427f90a4.pdf",
"display_name": "a2bd25b8921f3dc7a440fd7f427f90a4",
"encoding": "base64",
"content-type": "application/pdf",
"public_id": "a2bd25b8921f3dc7a440fd7f427f90a4"
}
}
The response contains the generated PDF invoice, including embedded XML, while meta provides document metadata and identification details.
cURL Example
To generate a hybrid Factur-X / ZUGFeRD invoice, use the following cURL command:
curl --request POST \
--url https://us1.pdfgeneratorapi.com/api/v4/einvoice/facturx \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"template":{"id":"REPLACE_TEMPLATE_ID","version_id":12,"data":{}},"profile":"basic","output":"base64","name":"Invoice 123","metadata":{"author":"Organization name","language":"en"}}'
Which endpoint should I use?
- Use Create eInvoice for standard EN 16931 XML invoices (UBL or CII).
- Use Create XRechnung eInvoice for invoices required in Germany.
- Use Create Factur-X / ZUGFeRD eInvoice for hybrid PDF/XML invoices (commonly used in France and Germany).
Related articles you may find helpful
- How to create a JSON Web Token (JWT)?
- How to integrate PDF Generator API with n8n
- Is PDF Generator API GDPR compliant?
Updated on: 18/03/2026
Thank you!
