Mapping JSON Invoice Fields to UBL XML (EN 16931 / Peppol BIS 3.0)

Invoice Field Mapping Guide (B2Brouter API ↔ Business Terms ↔ UBL XPath)

This guide details the mapping between the B2Brouter Invoice API fields, the corresponding Business Terms (BT) as defined by the European e-Invoicing standard (EN 16931), and the XML paths in the UBL 2.1 model (including Peppol BIS Billing 3.0).


Header-Level Mapping

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-1Invoice numberinvoice.numbercbc:ID
BT-2Invoice Issue Dateinvoice.datecbc:IssueDate
BT-3Invoice Type Codeinvoice.type_code (api 2026-03-02)cbc:InvoiceTypeCode (or cbc:CreditNoteTypeCode)
BT-5Document Currencyinvoice.currencycbc:DocumentCurrencyCode
BT-6Tax Currency Codeinvoice.contact.currencycbc:TaxCurrencyCode
BT-7Tax Point Dateinvoice.tax_point_datecbc:TaxPointDate
BT-9Payment Due Dateinvoice.due_datecbc:DueDate
BT-10Buyer Referenceinvoice.buyer_referencecbc:BuyerReference
BT-19Accounting Costinvoice.buyer_accounting_referencecbc:AccountingCost
BT-22Note (Header)invoice.extra_infocbc:Note
Notes:
  • BT-6: Emitted only when the buyer contact's currency differs from the invoice currency (BT-5) and tax amounts in that currency are present. When set, a second cac:TaxTotal block is rendered with amounts in this currency.

References & Periods

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-13Purchase Order Referenceinvoice.ponumbercac:OrderReference/cbc:ID
BT-14Sales Order Referenceinvoice.sales_order_referencecac:OrderReference/cbc:SalesOrderID
BT-12Contract Referenceinvoice.contract_numbercac:ContractDocumentReference/cbc:ID
BT-15Receiving Advice Referenceinvoice.receiving_advice_referencecac:ReceiptDocumentReference/cbc:ID
BT-16Despatch Advice Referenceinvoice.delivery_note_numbercac:DespatchDocumentReference/cbc:ID
BT-25Preceding Invoice Refinvoice.amended_numbercac:BillingReference/cac:InvoiceDocumentReference/cbc:ID
BT-26Preceding Invoice Dateinvoice.amended_datecac:BillingReference/cac:InvoiceDocumentReference/cbc:IssueDate
BT-73Invoicing Period Startinvoice.invoicing_period_startcac:InvoicePeriod/cbc:StartDate
BT-74Invoicing Period Endinvoice.invoicing_period_endcac:InvoicePeriod/cbc:EndDate
BT-11Project Referenceinvoice.file_referencecac:ProjectReference/cbc:ID
Originator Document Refinvoice.lot_referencecac:OriginatorDocumentReference/cbc:ID
Notes:
  • For credit notes, file_reference (BT-11) is emitted as cac:AdditionalDocumentReference/cbc:ID instead of cac:ProjectReference/cbc:ID.

Parties Mapping

This mapping is described for an issued invoice, if you want to map received invoice swap the AccountingSupplierParty and AccountingCustomerParty.

Self-billing (IssuedSelfInvoice / ReceivedSelfInvoice): in self-billing the buyer issues the invoice on behalf of the supplier, so the party roles in the XML are inverted relative to the API fields. For an IssuedSelfInvoice, account data appears in AccountingCustomerParty (your company is the buyer) and invoice.contact data appears in AccountingSupplierParty (the contact is the supplier). The same applies symmetrically to ReceivedSelfInvoice. All XPaths in the tables below are filled from the appropriate party for the given role — the API field columns describe the normal issued mapping; for self-billing, swap accountinvoice.contact.

Seller Party

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-34Seller Endpoint IDaccount.pin_valuecac:AccountingSupplierParty/cac:Party/cbc:EndpointID @schemeID
BT-27Seller Legal Nameaccount.namecac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName
BT-31Seller VAT Identifieraccount.tin_valuecac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID
BT-35Seller Address Streetaccount.addresscac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:StreetName
BT-36Seller Address Street 2account.address2cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:AdditionalStreetName
BT-37Seller Address Cityaccount.citycac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:CityName
BT-38Seller Address Postal Codeaccount.postalcodecac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:PostalZone
BT-39Seller Provinceaccount.provincecac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity
BT-40Seller Countryaccount.countrycac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode
BT-41Seller Contact Nameaccount.contact_personcac:AccountingSupplierParty/cac:Party/cac:Contact/cbc:Name
BT-42Seller Contact Phoneaccount.phonecac:AccountingSupplierParty/cac:Party/cac:Contact/cbc:Telephone
BT-43Seller Contact Emailaccount.emailcac:AccountingSupplierParty/cac:Party/cac:Contact/cbc:ElectronicMail

Buyer Party

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-49Buyer Endpoint IDinvoice.contact.pin_valuecac:AccountingCustomerParty/cac:Party/cbc:EndpointID @schemeID
BT-44Buyer Legal Nameinvoice.contact.namecac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName
BT-45Buyer Trade Nameinvoice.contact.namecac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name
BT-48Buyer VAT Identifierinvoice.contact.tin_valuecac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID
BT-50Buyer Address Streetinvoice.contact.addresscac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:StreetName
BT-51Buyer Address Street 2invoice.contact.address2cac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:AdditionalStreetName
BT-52Buyer Address Cityinvoice.contact.citycac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:CityName
BT-53Buyer Address Postal Codeinvoice.contact.postalcodecac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:PostalZone
BT-54Buyer Provinceinvoice.contact.provincecac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity
BT-55Buyer Countryinvoice.contact.countrycac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode
BT-56Buyer Contact Nameinvoice.contact.contact_personcac:AccountingCustomerParty/cac:Party/cac:Contact/cbc:Name
BT-57Buyer Contact Phoneinvoice.contact.phonecac:AccountingCustomerParty/cac:Party/cac:Contact/cbc:Telephone
BT-58Buyer Contact Emailinvoice.contact.emailcac:AccountingCustomerParty/cac:Party/cac:Contact/cbc:ElectronicMail

Delivery

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-72Delivery Dateinvoice.delivery_datecac:Delivery/cbc:ActualDeliveryDate
BT-71Delivery Location IDinvoice.delivery_location_idcac:Delivery/cac:DeliveryLocation/cbc:ID
BT-75Delivery Address Streetinvoice.delivery_addresscac:Delivery/cac:DeliveryLocation/cac:Address/cbc:StreetName
BT-76Delivery Address Street 2invoice.delivery_address2cac:Delivery/cac:DeliveryLocation/cac:Address/cbc:AdditionalStreetName
BT-77Delivery Cityinvoice.delivery_citycac:Delivery/cac:DeliveryLocation/cac:Address/cbc:CityName
BT-78Delivery Postal Codeinvoice.delivery_postalcodecac:Delivery/cac:DeliveryLocation/cac:Address/cbc:PostalZone
BT-79Delivery Provinceinvoice.delivery_provincecac:Delivery/cac:DeliveryLocation/cac:Address/cbc:CountrySubentity
BT-80Delivery Countryinvoice.delivery_countrycac:Delivery/cac:DeliveryLocation/cac:Address/cac:Country/cbc:IdentificationCode
BT-70Delivery Party Nameinvoice.delivery_party_namecac:Delivery/cac:DeliveryParty/cac:PartyName/cbc:Name

Payment

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-81Payment Means Codeinvoice.payment_methodcac:PaymentMeans/cbc:PaymentMeansCode @listID='UNCL4461'
BT-82Payment Means Textinvoice.payment_method_textcac:PaymentMeans/cbc:PaymentMeansCode @name
BT-83Remittance Informationinvoice.remittance_informationcac:PaymentMeans/cbc:PaymentID
BT-84Payee Bank Account IBANinvoice.bank_account.ibancac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID
BT-84-0Payee Bank Account Numberinvoice.bank_account.numbercac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID (fallback when no IBAN)
BT-85Payee Bank Account Nameinvoice.bank_account.namecac:PaymentMeans/cac:PayeeFinancialAccount/cbc:Name (currently not rendered)
BT-86Payee Bank Account BICinvoice.bank_account.biccac:PaymentMeans/cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID
BT-87Card Account Numberinvoice.card_account_attributes.account_numbercac:PaymentMeans/cac:CardAccount/cbc:PrimaryAccountNumberID
BT-87-0Card Account Holder Nameinvoice.card_account_attributes.holder_namecac:PaymentMeans/cac:CardAccount/cbc:HolderName
BT-88Card Account Network IDinvoice.card_account_attributes.networkcac:PaymentMeans/cac:CardAccount/cbc:NetworkID
BT-20Payment Termsinvoice.payment_termscac:PaymentTerms/cbc:Note
BT-89Mandate Reference (SEPA DD only)invoice.mandate_reference_identifiercac:PaymentMeans/cac:PaymentMandate/cbc:ID
BT-90Creditor Reference (SEPA DD)invoice.bank_assigned_creditor_referencecac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID @schemeID='SEPA'
BT-91Debtor Account IBAN (SEPA DD)invoice.contact_ibancac:PaymentMeans/cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID

Totals & Taxes

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-106Line Net Amount Total(calculated)cac:LegalMonetaryTotal/cbc:LineExtensionAmount
BT-109Tax Exclusive Amount(calculated)cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount
BT-107Allowance Total Amount(calculated)cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount
BT-108Charge Total Amount(calculated)cac:LegalMonetaryTotal/cbc:ChargeTotalAmount
BT-112Tax Inclusive Amount(calculated)cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount
BT-113Total Prepaid Amountinvoice.payments_on_accountcac:LegalMonetaryTotal/cbc:PrepaidAmount
BT-114Rounding Amount(from invoice adjustment)cac:LegalMonetaryTotal/cbc:PayableRoundingAmount
BT-115Amount Due for Paymentinvoice.payable_amountcac:LegalMonetaryTotal/cbc:PayableAmount
BT-110Invoice Total VAT Amount(calculated)cac:TaxTotal/cbc:TaxAmount
BT-116VAT Category Taxable Amount(calculated from lines)cac:TaxTotal/cac:TaxSubtotal/cbc:TaxableAmount
BT-117VAT Category Tax Amount(calculated from lines)cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount
Withheld Amountinvoice.withheld_percentcac:AllowanceCharge/cbc:Amount
Withheld Reasoninvoice.amounts_withheld_reasoncac:AllowanceCharge/cbc:AllowanceChargeReason

Header Allowances & Charges

BTBusiness TermAPI Field (B2Brouter)UBL XPath
BT-92Allowance Amountallowance_charges_attributes[]{allowance_charge_indicator: "allowance", amount: X}cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:Amount
BT-93Allowance Base Amount(calculated when percent-based)cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:BaseAmount
BT-94Allowance Percentallowance_charges_attributes[]{allowance_charge_indicator: "allowance", percentage: X}cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:MultiplierFactorNumeric
BT-97Allowance Reasonallowance_charges_attributes[]{allowance_charge_indicator: "allowance", description: "..."}cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:AllowanceChargeReason
BT-99Charge Amountallowance_charges_attributes[]{allowance_charge_indicator: "charge", amount: X}cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:Amount
BT-100Charge Base Amount(calculated when percent-based)cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:BaseAmount
BT-101Charge Percentallowance_charges_attributes[]{allowance_charge_indicator: "charge", percentage: X}cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:MultiplierFactorNumeric
BT-104Charge Reasonallowance_charges_attributes[]{allowance_charge_indicator: "charge", description: "..."}cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:AllowanceChargeReason
BT-102Apply Tax To Allowance/Chargeallowance_charges_attributes[]{apply_taxes: true}cac:AllowanceCharge/cac:TaxCategory

Invoice Line-Level Mapping

All attributes below are properties of objects in: invoice.invoice_lines_attributes[].

BTBusiness TermAPI Field (invoice line)UBL XPath
BT-126Invoice Line IDpositioncac:InvoiceLine/cbc:ID
BT-129Invoiced Quantityquantitycac:InvoiceLine/cbc:InvoicedQuantity
BT-130Invoiced Quantity (Unit)unitcac:InvoiceLine/cbc:InvoicedQuantity @unitCode
BT-131Line Extension Amountextension_amount (or calculated)cac:InvoiceLine/cbc:LineExtensionAmount
BT-146Price Amountpricecac:InvoiceLine/cac:Price/cbc:PriceAmount
BT-153Item Namedescriptioncac:InvoiceLine/cac:Item/cbc:Name
BT-154Item Descriptionnotescac:InvoiceLine/cac:Item/cbc:Description
BT-155Seller Item IDarticle_codecac:InvoiceLine/cac:Item/cac:SellersItemIdentification/cbc:ID
BT-156Buyer Item IDarticle_code_buyercac:InvoiceLine/cac:Item/cac:BuyersItemIdentification/cbc:ID
BT-157Standard Item IDarticle_code2cac:InvoiceLine/cac:Item/cac:StandardItemIdentification/cbc:ID @schemeID
BT-157-1Standard Item ID Schemearticle_code2_schemecac:InvoiceLine/cac:Item/cac:StandardItemIdentification/cbc:ID @schemeID (defaults to 0160)
BT-158Classification Codeclassification_codecac:InvoiceLine/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode @listID
BT-158-1Classification Code Schemeclassification_code_schemecac:InvoiceLine/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode @listID
BT-151VAT Category (per line)taxes_attributes[].categorycac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID
BT-152VAT Percent (per line)taxes_attributes[].percentcac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent
BT-120Tax Exemption Reasontaxes_attributes[].commentcac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:TaxExemptionReason
BT-160Additional Item Property Nameadditional_item_properties_attributes[].namecac:InvoiceLine/cac:Item/cac:AdditionalItemProperty/cbc:Name
BT-161Additional Item Property Valueadditional_item_properties_attributes[].valuecac:InvoiceLine/cac:Item/cac:AdditionalItemProperty/cbc:Value
BT-133Buyer Accounting Referencecontact_referencecac:InvoiceLine/cbc:AccountingCost
BT-134Invoicing Line Period Startinvoicing_period_startcac:InvoiceLine/cac:InvoicePeriod/cbc:StartDate
BT-135Invoicing Line Period Endinvoicing_period_endcac:InvoiceLine/cac:InvoicePeriod/cbc:EndDate
BT-136Line Allowance Amountallowance_charges_attributes[]{allowance_charge_indicator: "allowance", amount: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:Amount
BT-138Line Allowance Percentallowance_charges_attributes[]{allowance_charge_indicator: "allowance", percentage: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:MultiplierFactorNumeric
BT-139Line Allowance Reasonallowance_charges_attributes[]{allowance_charge_indicator: "allowance", description: "..."}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:AllowanceChargeReason
BT-141Line Charge Amountallowance_charges_attributes[]{allowance_charge_indicator: "charge", amount: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:Amount
BT-143Line Charge Percentallowance_charges_attributes[]{allowance_charge_indicator: "charge", percentage: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:MultiplierFactorNumeric
BT-144Line Charge Reasonallowance_charges_attributes[]{allowance_charge_indicator: "charge", description: "..."}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:AllowanceChargeReason
BT-128Purchase Order Reference (line)invoice_lines_attributes[].ponumbercac:InvoiceLine/cac:DocumentReference/cbc:ID
BT-132PO Line Referenceinvoice_lines_attributes[].sequence_numbercac:InvoiceLine/cac:OrderLineReference/cbc:LineID