curatedapi
Browse the docs

Guides

Finance

Excel functions

Late payments

E-invoices

Accounting

Number checks

Live lookups

VAT and GST

Billing and pricing

Money and currencies

Dates and time

Math

Unit conversion

Everyday

Health

Peppol BIS Billing 3.0 creator (UBL) API

Send the invoice as JSON, get back a Peppol BIS Billing 3.0 UBL file that passes OpenPeppol's official rules.

POST https://api.curatedapi.com/v1/create/einvoice/peppol-bis

Builds a Peppol BIS Billing 3.0 invoice or credit note in UBL 2.1 from plain JSON, works out every total the way EN 16931 defines it, and runs the EN 16931 and Peppol BIS rules on the file before returning it. Sending it over the Peppol network is not included: hand the file to your Peppol access point.

  • Peppol needs both parties' electronic addresses with an EAS scheme (an email address is not accepted), and a buyer reference or an order reference.
  • Sending over the Peppol network needs a certified access point; this API creates the file only.

Inputs

Send numbers as strings to keep every digit. A file that would break an official rule is not returned: the call fails with INVOICE_NOT_VALID (see creating e-invoices).

InputTypeDescription
invoice required object The invoice. Field names follow EN 16931; the BT numbers in the descriptions are the standard's own.
invoice.type invoice | credit_note | corrected_invoice | partial_invoice invoice (380, default), credit_note (381), corrected_invoice (384) or partial_invoice (326).
invoice.number required string Invoice number (BT-1).
invoice.issue_date required date (YYYY-MM-DD) BT-2, YYYY-MM-DD.
invoice.due_date date (YYYY-MM-DD) BT-9.
invoice.currency string ISO 4217 code; EUR when left out (BT-5).
invoice.buyer_reference string The buyer's reference; for German public buyers the Leitweg-ID. Required by XRechnung (BT-10).
invoice.order_reference string Purchase order number (BT-13).
invoice.contract_reference string BT-12.
invoice.project_reference string BT-11.
invoice.preceding_invoice object The invoice a credit note or corrected invoice refers to (BG-3).
invoice.preceding_invoice.number string
invoice.preceding_invoice.issue_date date (YYYY-MM-DD)
invoice.delivery_date date (YYYY-MM-DD) BT-72.
invoice.period object Invoicing period (BG-14).
invoice.period.start date (YYYY-MM-DD)
invoice.period.end date (YYYY-MM-DD)
invoice.notes list of string Invoice notes (BT-22).
invoice.seller required object
invoice.seller.name required string Legal name (BT-27 / BT-44).
invoice.seller.trading_name string Trading name, if different (BT-28 / BT-45).
invoice.seller.address required object
invoice.seller.address.line1 string Street and number (BT-35).
invoice.seller.address.line2 string Additional line (BT-36).
invoice.seller.address.line3 string Third line (BT-162).
invoice.seller.address.city string City (BT-37).
invoice.seller.address.postcode string Post code (BT-38).
invoice.seller.address.region string Region or state (BT-39).
invoice.seller.address.country required string ISO 3166 two-letter code, e.g. DE (BT-40).
invoice.seller.vat_id string VAT number with country prefix (BT-31 / BT-48).
invoice.seller.registration_id string or object Legal registration, e.g. HRB 12345 (BT-30 / BT-47).
invoice.seller.id string or object Seller or buyer identifier (BT-29 / BT-46).
invoice.seller.electronic_address string or object Where e-invoices are delivered (BT-34 / BT-49): an email address, or {"id", "scheme"} with an EAS code such as 0204 (Leitweg-ID) or 9930 (German VAT number). Required by XRechnung and Peppol.
invoice.seller.contact object Contact person, phone and email (BG-6 / BG-9). XRechnung requires all three for the seller.
invoice.seller.contact.name string
invoice.seller.contact.phone string
invoice.seller.contact.email string
invoice.seller.tax_number string National tax number, e.g. Steuernummer (BT-32).
invoice.seller.legal_info string Additional legal information: managing directors, court of registration, share capital (BT-33).
invoice.buyer required object
invoice.buyer.name required string Legal name (BT-27 / BT-44).
invoice.buyer.trading_name string Trading name, if different (BT-28 / BT-45).
invoice.buyer.address required object
invoice.buyer.address.line1 string Street and number (BT-35).
invoice.buyer.address.line2 string Additional line (BT-36).
invoice.buyer.address.line3 string Third line (BT-162).
invoice.buyer.address.city string City (BT-37).
invoice.buyer.address.postcode string Post code (BT-38).
invoice.buyer.address.region string Region or state (BT-39).
invoice.buyer.address.country required string ISO 3166 two-letter code, e.g. DE (BT-40).
invoice.buyer.vat_id string VAT number with country prefix (BT-31 / BT-48).
invoice.buyer.registration_id string or object Legal registration, e.g. HRB 12345 (BT-30 / BT-47).
invoice.buyer.id string or object Seller or buyer identifier (BT-29 / BT-46).
invoice.buyer.electronic_address string or object Where e-invoices are delivered (BT-34 / BT-49): an email address, or {"id", "scheme"} with an EAS code such as 0204 (Leitweg-ID) or 9930 (German VAT number). Required by XRechnung and Peppol.
invoice.buyer.contact object Contact person, phone and email (BG-6 / BG-9). XRechnung requires all three for the seller.
invoice.buyer.contact.name string
invoice.buyer.contact.phone string
invoice.buyer.contact.email string
invoice.delivery object Deliver-to party and address (BG-13, BG-15).
invoice.delivery.name string
invoice.delivery.address object
invoice.delivery.address.line1 string Street and number (BT-35).
invoice.delivery.address.line2 string Additional line (BT-36).
invoice.delivery.address.line3 string Third line (BT-162).
invoice.delivery.address.city string City (BT-37).
invoice.delivery.address.postcode string Post code (BT-38).
invoice.delivery.address.region string Region or state (BT-39).
invoice.delivery.address.country string ISO 3166 two-letter code, e.g. DE (BT-40).
invoice.delivery.location_id string or object
invoice.payment object Payment instructions (BG-16). XRechnung requires them.
invoice.payment.method sepa_credit_transfer | credit_transfer | sepa_direct_debit sepa_credit_transfer (58), credit_transfer (30) or sepa_direct_debit (59).
invoice.payment.iban string The seller's account (BT-84).
invoice.payment.bic string BT-86.
invoice.payment.account_name string BT-85.
invoice.payment.reference string Remittance information (BT-83).
invoice.payment.terms string Payment terms as text (BT-20).
invoice.payment.mandate_reference string Direct debit mandate (BT-89).
invoice.payment.creditor_id string SEPA creditor ID (BT-90).
invoice.payment.debtor_iban string The account debited (BT-91).
invoice.lines required list of objects
invoice.lines[].id string Line number; 1, 2, 3 … when left out (BT-126).
invoice.lines[].name required string Item name (BT-153).
invoice.lines[].description string Item description (BT-154).
invoice.lines[].note string Line note (BT-127).
invoice.lines[].quantity required ['number', 'string'] Up to 4 decimals; negative for a return.
invoice.lines[].unit string UN/ECE Recommendation 20 code: C62 piece (default), HUR hour, DAY day, MON month, KGM kilogram, LS lump sum …
invoice.lines[].unit_price required ['number', 'string'] Net price per unit, up to 4 decimals (BT-146).
invoice.lines[].price_base_quantity ['number', 'string'] The quantity the price is for, e.g. 100 for a price per 100 (BT-149).
invoice.lines[].vat_category required S | Z | E | AE | K | G | O S standard, Z zero, E exempt, AE reverse charge, K intra-EU supply, G export, O not subject to VAT (BT-151).
invoice.lines[].vat_rate ['number', 'string'] Percent, e.g. 19; 0 for Z, E, AE, K, G; left out for O (BT-152).
invoice.lines[].seller_item_id string
invoice.lines[].buyer_item_id string
invoice.lines[].standard_item_id string or object E.g. {"id": "4012345001235", "scheme": "0160"} for a GTIN (BT-157).
invoice.lines[].order_line_reference string
invoice.lines[].period object
invoice.lines[].period.start date (YYYY-MM-DD)
invoice.lines[].period.end date (YYYY-MM-DD)
invoice.lines[].allowances list of objects
invoice.lines[].allowances[].amount ['number', 'string'] A number, or a number as a string to keep every digit ("12.50").
invoice.lines[].allowances[].percent ['number', 'string'] Percentage of base_amount, instead of amount.
invoice.lines[].allowances[].base_amount ['number', 'string'] Base for percent. On a line it defaults to quantity × price.
invoice.lines[].allowances[].reason string
invoice.lines[].allowances[].reason_code string UNTDID 5189 (allowances) or 7161 (charges).
invoice.lines[].charges list of objects
invoice.lines[].charges[].amount ['number', 'string'] A number, or a number as a string to keep every digit ("12.50").
invoice.lines[].charges[].percent ['number', 'string'] Percentage of base_amount, instead of amount.
invoice.lines[].charges[].base_amount ['number', 'string'] Base for percent. On a line it defaults to quantity × price.
invoice.lines[].charges[].reason string
invoice.lines[].charges[].reason_code string UNTDID 5189 (allowances) or 7161 (charges).
invoice.allowances list of objects Document allowances (BG-20).
invoice.allowances[].amount ['number', 'string'] A number, or a number as a string to keep every digit ("12.50").
invoice.allowances[].percent ['number', 'string'] Percentage of base_amount, instead of amount.
invoice.allowances[].base_amount ['number', 'string'] Base for percent. On a line it defaults to quantity × price.
invoice.allowances[].reason string
invoice.allowances[].reason_code string UNTDID 5189 (allowances) or 7161 (charges).
invoice.allowances[].vat_category S | Z | E | AE | K | G | O
invoice.allowances[].vat_rate ['number', 'string'] A number, or a number as a string to keep every digit ("12.50").
invoice.charges list of objects Document charges (BG-21).
invoice.charges[].amount ['number', 'string'] A number, or a number as a string to keep every digit ("12.50").
invoice.charges[].percent ['number', 'string'] Percentage of base_amount, instead of amount.
invoice.charges[].base_amount ['number', 'string'] Base for percent. On a line it defaults to quantity × price.
invoice.charges[].reason string
invoice.charges[].reason_code string UNTDID 5189 (allowances) or 7161 (charges).
invoice.charges[].vat_category S | Z | E | AE | K | G | O
invoice.charges[].vat_rate ['number', 'string'] A number, or a number as a string to keep every digit ("12.50").
invoice.prepaid_amount ['number', 'string'] Already paid (BT-113).
invoice.rounding_amount ['number', 'string'] BT-114.
invoice.vat_exemption_reasons object The reason for each VAT category other than S and Z, e.g. {"E": "Kleinunternehmer gemäß § 19 UStG"} or {"E": {"code": "VATEX-EU-132", "text": "…"}} (BT-120, BT-121). AE, K, G and O get the standard wording when left out; E must be given.

Result

Under result in the answer, next to validator and rules (the official artefacts used, with their versions).

ResultTypeDescription
validbooleanAlways true: a file that breaks a rule is not returned.
formatstringWhat was made, e.g. XRechnung 3.0 (UBL).
specification_idstringBT-24 as written in the file.
filenamestringA file name made from the invoice number.
xmlstringThe invoice XML (UTF-8).
totalsobjectEvery amount as EN 16931 calculates it, as strings with 2 decimals: line_total (BT-106), allowance_total, charge_total, total_without_vat (BT-109), vat_total (BT-110), total_with_vat (BT-112), prepaid_amount, rounding_amount, amount_due (BT-115), vat_breakdown (BG-23) and each line's net_amount (BT-131).
checkobjectThe official rules' report on the file returned: the same answer the matching /v1/validate/einvoice/… endpoint gives.

Examples

Peppol BIS base example rebuilt from JSON

Requestcurl
curl https://api.curatedapi.com/v1/create/einvoice/peppol-bis \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "invoice": {"number": "Snippet1", "issue_date": "2017-11-13", "due_date": "2017-12-01", "currency": "EUR", "buyer_reference": "0150abc", "seller": {"name": "SupplierOfficialName Ltd", "trading_name": "SupplierTradingName Ltd.", "id": "99887766", "address": {"line1": "Main street 1", "line2": "Postbox 123", "city": "London", "postcode": "GB 123 EW", "country": "GB"}, "vat_id": "GB1232434", "registration_id": "GB983294", "electronic_address": {"id": "9482348239847239874", "scheme": "0088"}}, "buyer": {"name": "Buyer Official Name", "trading_name": "BuyerTradingName AS", "id": {"id": "FR23342", "scheme": "0002"}, "address": {"line1": "Hovedgatan 32", "line2": "Po box 878", "city": "Stockholm", "postcode": "456 34", "country": "SE"}, "vat_id": "SE4598375937", "registration_id": {"id": "39937423947", "scheme": "0183"}, "electronic_address": {"id": "FR23342", "scheme": "0002"}, "contact": {"name": "Lisa Johnson", "phone": "23434234", "email": "[email protected]"}}, "delivery_date": "2017-11-01", "delivery": {"name": "Delivery party Name", "location_id": {"id": "9483759475923478", "scheme": "0088"}, "address": {"line1": "Delivery street 2", "line2": "Building 56", "city": "Stockholm", "postcode": "21234", "country": "SE"}}, "payment": {"method": "credit_transfer", "iban": "GB33BUKB20201555555555", "bic": "BUKBGB22", "account_name": "AccountName", "reference": "Snippet1", "terms": "Payment within 10 days, 2% discount"}, "charges": [{"amount": 25, "reason": "Insurance", "vat_category": "S", "vat_rate": 25}], "lines": [{"id": "1", "name": "item name", "description": "Description of item", "quantity": 7, "unit": "DAY", "unit_price": 400, "vat_category": "S", "vat_rate": 25, "order_line_reference": "123", "standard_item_id": {"id": "21382183120983", "scheme": "0088"}}, {"id": "2", "name": "item name 2", "description": "Description 2", "quantity": -3, "unit": "DAY", "unit_price": 500, "vat_category": "S", "vat_rate": 25, "order_line_reference": "123", "standard_item_id": {"id": "21382183120983", "scheme": "0088"}}]}
  }'
200 OKResponse
{
  "creator": "einvoice/peppol-bis@1",
  "result": {
    "valid": true,
    "format": "Peppol BIS Billing 3.0 (UBL 2.1)",
    "specification_id": "urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0",
    "filename": "Snippet1.xml",
    "totals": {
      "currency": "EUR",
      "line_total": "1300.00",
      "allowance_total": "0.00",
      "charge_total": "25.00",
      "total_without_vat": "1325.00",
      "vat_total": "331.25",
      "total_with_vat": "1656.25",
      "prepaid_amount": "0.00",
      "rounding_amount": "0.00",
      "amount_due": "1656.25",
      "vat_breakdown": [
        {
          "category": "S",
          "rate": "25",
          "taxable_amount": "1325.00",
          "vat_amount": "331.25"
        }
      ],
      "lines": [
        {
          "id": "1",
          "net_amount": "2800.00"
        },
        {
          "id": "2",
          "net_amount": "-1500.00"
        }
      ]
    },
    "check": {
      "scenario": "Peppol BIS Billing 3.0 (UBL Invoice)",
      "document_type": "UBL Invoice",
      "specification_id": "urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0",
      "errors": 0,
      "warnings": 0,
      "notices": 0,
      "error_rules": [],
      "checks": [
        {
          "check": "XML syntax",
          "passed": true
        },
        {
          "check": "UBL 2.1 Invoice schema",
          "passed": true
        },
        {
          "check": "EN 16931 rules (Peppol BIS 3.0.22 copy)",
          "passed": true
        },
        {
          "check": "Peppol BIS Billing 3.0.22 rules",
          "passed": true
        }
      ],
      "messages": [],
      "messages_truncated": false
    },
    "xml": "<?xml version='1.0' encoding='UTF-8'?>\n<Invoice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" xmlns:cac=\"urn:oasis:names:specification:ubl:sche… (7,516 characters in all)"
  },
  "rules": [
    {
      "name": "OpenPeppol BIS Billing 3.0 Schematron (compiled with SchXslt 1.10.1)",
      "version": "3.0.22",
      "url": "https://github.com/OpenPEPPOL/peppol-bis-invoice-3/releases/tag/3.0.22"
    }
  ]
}

Rules used

A check shows whether the invoice passes the official rule sets listed, at the versions listed. It is not legal or tax advice, and passing does not promise that a tax authority or buyer will accept the invoice. See the terms.

Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.