XRechnung example: what the XML looks like

An XRechnung is not a designed page but an XML file: each invoice detail is stored in its own precisely named element, for example the invoice number in cbc:ID and the amount due in cbc:PayableAmount. If you open it in a text editor, you see nested tags instead of letterhead. The following XRechnung example shows a complete, deliberately small invoice in UBL syntax and explains the individual blocks.
What does an XRechnung look like?
XRechnung is based on the European standard EN 16931. The standard defines which details an invoice contains and assigns each a number, for example BT-1 for the invoice number. Technically, XRechnung may be written in two XML syntaxes:
- UBL (Universal Business Language, OASIS UBL 2.1): root element
InvoiceorCreditNote. Widely used in the Peppol network. - CII (UN/CEFACT Cross Industry Invoice): root element
CrossIndustryInvoice. ZUGFeRD uses the same syntax.
Both variants carry the same content; only the element names and the nesting differ. The current version is XRechnung 3.0 in release 3.0.2.
XRechnung example as XML (UBL)
The example shows an invoice between two businesses for ten hours of consulting at 100 euros each plus 19 percent VAT. Names, addresses and numbers are fictitious.
<?xml version="1.0" encoding="UTF-8"?>
<ubl:Invoice xmlns:ubl="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#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</cbc:CustomizationID>
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
<cbc:ID>RE-2026-0042</cbc:ID>
<cbc:IssueDate>2026-09-28</cbc:IssueDate>
<cbc:DueDate>2026-10-12</cbc:DueDate>
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>PO-4711</cbc:BuyerReference>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">rechnung@muster-gmbh.de</cbc:EndpointID>
<cac:PostalAddress>
<cbc:StreetName>Musterstraße 1</cbc:StreetName>
<cbc:CityName>Mannheim</cbc:CityName>
<cbc:PostalZone>68159</cbc:PostalZone>
<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>Muster GmbH</cbc:RegistrationName>
</cac:PartyLegalEntity>
<cac:Contact>
<cbc:Name>Erika Muster</cbc:Name>
<cbc:Telephone>+49 621 1234567</cbc:Telephone>
<cbc:ElectronicMail>buchhaltung@muster-gmbh.de</cbc:ElectronicMail>
</cac:Contact>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">rechnungseingang@kunde-ag.de</cbc:EndpointID>
<cac:PostalAddress>
<cbc:StreetName>Am Platz 2</cbc:StreetName>
<cbc:CityName>Köln</cbc:CityName>
<cbc:PostalZone>50667</cbc:PostalZone>
<cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country>
</cac:PostalAddress>
<cac:PartyLegalEntity>
<cbc:RegistrationName>Kunde AG</cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:PaymentMeans>
<cbc:PaymentMeansCode>58</cbc:PaymentMeansCode>
<cac:PayeeFinancialAccount>
<cbc:ID>DE02120300000000202051</cbc:ID>
</cac:PayeeFinancialAccount>
</cac:PaymentMeans>
<cac:PaymentTerms>
<cbc:Note>Zahlbar innerhalb von 14 Tagen ohne Abzug.</cbc:Note>
</cac:PaymentTerms>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="EUR">190.00</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="EUR">1000.00</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="EUR">190.00</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:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="EUR">1000.00</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="EUR">1000.00</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="EUR">1190.00</cbc:TaxInclusiveAmount>
<cbc:PayableAmount currencyID="EUR">1190.00</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="HUR">10</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">1000.00</cbc:LineExtensionAmount>
<cac:Item>
<cbc:Name>Beratungsleistung</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">100.00</cbc:PriceAmount>
</cac:Price>
</cac:InvoiceLine>
</ubl:Invoice>
The blocks in the example explained
Identifier and invoice header
CustomizationID (BT-24) tells the recipient which set of rules the file is to be validated against. The value containing xrechnung_3.0 identifies the file as XRechnung 3.0. If the value here is wrong, validation fails even if the content is correct. ProfileID (BT-23) describes the business process, here the usual value from Peppol. This is followed by the invoice number (BT-1), invoice date (BT-2), due date (BT-9), invoice type (BT-3, 380 stands for a normal invoice) and currency (BT-5).
Buyer reference
BuyerReference (BT-10) is mandatory in XRechnung. For public authorities, this is where the Leitweg-ID goes; for businesses, an agreed reference such as the purchase order number.
Seller and buyer
AccountingSupplierParty is the seller, with electronic address (BT-34), postal address, VAT ID (BT-31), company name (BT-27) and contact (BG-6). For the seller, XRechnung requires the name, telephone number and email address of the contact person. AccountingCustomerParty is the buyer, with electronic address (BT-49), postal address and name. The attribute schemeID="EM" identifies the address as an email address.
Payment
PaymentMeans contains the payment method (BT-81, code 58 for SEPA credit transfer) and the IBAN (BT-84). PaymentTerms holds the payment terms as text (BT-20).
Tax and totals
TaxTotal summarises the VAT per category: category S stands for the standard rate. LegalMonetaryTotal contains the totals: net line items, net invoice amount, gross invoice amount and amount due. These values must match each other and the line items exactly, otherwise validation reports an error.
Line items
Each InvoiceLine has a number (BT-126), a quantity with unit code (BT-129 and BT-130, HUR stands for hours), the net amount of the line (BT-131), the item name (BT-153), the tax category and the unit price (BT-146). You can find the meaning of all the numbers in the article XRechnung fields: all BT numbers explained.
The same invoice in CII
In CII syntax, the elements have different names and are structured into context, document and trade transaction. The beginning of the same invoice looks like this:
<rsm:CrossIndustryInvoice
xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
<rsm:ExchangedDocumentContext>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID>RE-2026-0042</ram:ID>
<ram:TypeCode>380</ram:TypeCode>
<ram:IssueDateTime>
<udt:DateTimeString format="102">20260928</udt:DateTimeString>
</ram:IssueDateTime>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<!-- Line items, agreements, delivery, settlement -->
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>
The SupplyChainTradeTransaction block is followed by the line items (IncludedSupplyChainTradeLineItem), the details of seller, buyer and references (ApplicableHeaderTradeAgreement), the delivery (ApplicableHeaderTradeDelivery) and taxes, payment and totals (ApplicableHeaderTradeSettlement). Note that in CII the date is in the format YYYYMMDD, in UBL as YYYY-MM-DD.
XML schema and validation
An XRechnung is validated in two stages:
- XML schema (XSD): are the element names, order and data types correct? For UBL, this is the OASIS UBL 2.1 schema; for CII, the UN/CEFACT schema.
- Business rules (Schematron): is the content correct? This is where the rules of EN 16931 apply (for example BR-CO-15: gross amount equals net amount plus tax), as well as the additional German XRechnung rules (BR-DE, for example the requirement for a buyer reference).
KoSIT provides a freely available validator with a suitable configuration for XRechnung for this purpose. The example above is reduced to the structure. Before you send a file of your own, you should always validate it against the current configuration.
Creating and receiving XRechnungen
Nobody writes XRechnungen by hand. In practice, software or an API generates the file from your invoice data and checks it before sending. On the recipient side, faktoora reads in incoming XRechnungen, validates them and displays them as a readable PDF; find out more under Receiving e-invoices. The article Opening and displaying an XRechnung explains how to open an XRechnung without software.
Frequently asked questions
What file extension does an XRechnung have?
Usually .xml. The file can be opened in any text editor, but only becomes readable with a viewer or visualisation.
Is XRechnung UBL or CII?
Both are permitted. XRechnung defines the content; UBL and CII are two equivalent ways of writing it. Anyone receiving e-invoices should therefore be able to process both variants.
Can I use the XRechnung example as a template?
As a guide, yes; as a finished template, no. Depending on the case, real invoices need further details, such as the date of service, discounts or several tax rates, and must be validated before sending.
Where can I find official XRechnung examples?
KoSIT publishes test files in UBL and CII for the specification. You can find the currently valid bundles at xeinkauf.de.