Skip to main content

Overview

If your system generates UBL XML files, you can send them through e-invoice.be without a conversion to JSON. Use this method when:
  • Your ERP system generates UBL XML.
  • You migrate from a different Peppol Access Point.
  • You have existing UBL files to send.
  • You want full control of the UBL structure.
If your ERP can only send invoices by email, see Send invoices by email (Mailbox).

Prerequisites

Your UBL XML must:
  • Be in the Peppol BIS Billing 3.0 format.
  • Be an invoice (Invoice) or a credit note (CreditNote).
  • Have your company as the supplier. The send request returns 409 if the sender Peppol ID is not one of the peppol_ids of your company.
The three steps are:
  1. Validate the UBL XML (recommended while you develop).
  2. Create the document from the UBL file.
  3. Send the document.
POST /api/validate/ubl and POST /api/documents/ubl accept multipart/form-data with one form field with the name file. A raw XML body (Content-Type: application/xml) gives 422 with the message Field required for body.file.

Validate the UBL XML

Validation does not create a document. POST /api/validate/ubl accepts only a file part with the content type application/xml or text/xml.
cURL
The validation guide has this request in Node.js, Python, PHP and C#. Response for a valid file (201):
Response for a file that is not valid (201, is_valid is false):

Create the document from UBL

POST /api/documents/ubl validates the file again and creates the document in state DRAFT. If the file has a fatal validation issue, the request returns 415 and no issue list. Thus use POST /api/validate/ubl to find the cause.
Response (201, shortened; the full response also has the line items, the tax details and the attachments):
Files that are embedded in the UBL become attachments of the document. See Attachments and PDF.

Send the document

Send the document with the id from the create response. The samples read the ID from the environment variable DOCUMENT_ID.
Response (200, shortened):
To follow the document after the send, see Document lifecycle and delivery tracking.

Peppol ID routing

When you create a document from UBL, the API stores the cbc:EndpointID values of the supplier and the customer with the document. The send request uses these values if you do not give query parameters. When you send a document, the API finds the sender and receiver Peppol IDs in this order:
  1. The query parameters of the send request.
  2. The Peppol IDs that the API stored with the UBL of the document.
  3. The identifiers in the document: vendor_tax_id or vendor_company_id for the sender, and customer_peppol_id, customer_tax_id or customer_company_id for the receiver.
For a Belgian party, the API derives scheme 0208 and the enterprise number: the tax ID BE1018265814 gives the Peppol ID 0208:1018265814. For other countries, the derived scheme can be different from the scheme that the receiver registered. Thus the best practice is to give all four query parameters:
cURL
string
Scheme of the sender Peppol ID. Example: 0208.
string
Identifier of the sender, without the scheme. Example: 1018265814.
string
Scheme of the receiver Peppol ID. Example: 0208.
string
Identifier of the receiver, without the scheme. Example: 0848934496.
The API returns 400 if it cannot find a complete sender and receiver Peppol ID. It returns 409 if the sender Peppol ID is not one of the peppol_ids of your company.
Before you send, make sure that the receiver is registered on the Peppol network with the Peppol ID that you use. See Look up Peppol participants.

Example UBL invoice

This is a minimal invoice in the Peppol BIS Billing 3.0 format. Replace the supplier data with the data of your company.

UBL credit notes

A credit note uses the same three steps. The root element is CreditNote, and the type code element is cbc:CreditNoteTypeCode:

Complete example

The example validates a UBL file, creates the document and sends it. It needs only the environment variable E_INVOICE_API_KEY.

Get the UBL of a document

GET /api/documents/{document_id}/ubl gives the UBL of a document, also for a document that you created from JSON. The response is JSON with a signed_url for the download of the XML file, not the XML itself.
cURL
For the response and the lifetime of the URL, see Attachments and PDF.

Errors and frequent validation issues

Frequent causes of validation issues:
  • Profile ID: cbc:ProfileID must be urn:fdc:peppol.eu:2017:poacc:billing:01:1.0.
  • Customisation ID: cbc:CustomizationID must be urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0.
  • Endpoint ID: the supplier party and the customer party each need a cbc:EndpointID with a schemeID attribute, for example <cbc:EndpointID schemeID="0208">1018265814</cbc:EndpointID>.
  • Tax category: cac:TaxCategory/cbc:ID must be a code from the UNCL5305 list (S, E, Z, AE and others).
  • Namespaces: the root element must declare the three UBL namespaces that the example shows.
For all status codes and error formats, see Errors and troubleshooting.

Best practices

  • Validate with POST /api/validate/ubl while you develop. The create request rejects a file that is not valid, but it does not return the issues.
  • Give the four Peppol ID query parameters on the send request, and make sure that the receiver is registered before you send. See Look up Peppol participants.
  • Develop and test with a sandbox company. See Test mode and sandbox companies.
  • Keep a copy of the original UBL file for your audit records.

Resources

Next Steps

Create documents from PDF

Extract the invoice data from a PDF file

Validation during development

Validate JSON and UBL while you develop

Look up Peppol participants

Make sure that the receiver is registered on Peppol

Errors and troubleshooting

Status codes, error formats and retry rules