Skip to main content

Overview

The e-invoice.be API allows you to create documents directly from PDF files using AI-powered data extraction. This is useful when:
  • You have existing PDF invoices you want to send via Peppol
  • Your system generates PDF invoices but not structured data
  • You want to digitize paper invoices
  • You’re migrating from traditional PDF invoicing to e-invoicing

How It Works

Upload a PDF invoice and the API automatically extracts invoice data and attempts to generate a valid UBL document. If the ubl_document field is present in the response, sufficient details were extracted to create a Peppol-compliant document ready for sending. The API provides two processing modes:
  1. Synchronous - Immediate processing with instant results (recommended for most cases)
  2. Asynchronous - Long-running conversions with task polling (for complex PDFs)

Method 1: Synchronous PDF Upload

Upload a PDF file and receive immediate extraction results.

Basic Upload

Providing tax IDs improves extraction accuracy:

Response

The response contains extracted invoice data and, if successful, a UBL document ready for sending:
If the ubl_document field is present in the response, the PDF contained sufficient information to generate a valid UBL document. You can then create a document from this UBL and send it via Peppol.

Creating a Document from Extracted UBL

If the response contains a ubl_document, create and send it:

Method 2: Asynchronous PDF Upload

For complex PDFs or when immediate processing isn’t required, use the asynchronous endpoint.

Step 1: Initiate Conversion

Response:

Step 2: Check Status

Response:
Status values: pending, completed, failed

Step 3: Retrieve Result

Response contains the same structure as the synchronous endpoint.

Code Examples

Node.js - Synchronous Upload

Python - Synchronous Upload

Node.js - Asynchronous Upload with Polling

Complete Workflow Example

Here’s a complete example that extracts data from a PDF and sends it via Peppol:

PDF Requirements

File Format

  • Format: PDF (Portable Document Format)
  • Content: Must be valid and non-empty
  • Text extraction: PDFs with readable text produce better results
Text-based PDFs generated from software (not scanned documents) produce the most accurate extraction results. Providing vendor and customer tax IDs as query parameters significantly improves extraction accuracy.

Best Practices for PDFs

  1. Use text-based PDFs: Generated from software rather than scanned images
  2. Clear layout: Structured format with clear sections for vendor, customer, line items
  3. Readable fonts: Standard fonts with good contrast
  4. Complete information: All required invoice fields clearly visible
  5. Single invoice per PDF: Don’t combine multiple invoices in one file
  6. Provide tax IDs: Include vendor_tax_id and customer_tax_id query parameters

Common Issues

Invalid or Empty PDF

Status Code: 415 Unsupported Media Type Solution:
  • Ensure the file is a valid PDF document
  • Check the file is not corrupted
  • Verify the file is not empty

No UBL Document Generated

Issue: Response contains extracted data but no ubl_document field Cause: The PDF didn’t contain sufficient information to generate a complete UBL document Solution:
  • Review the extracted data in the response
  • Provide vendor_tax_id and customer_tax_id query parameters
  • Use a more detailed PDF with complete invoice information
  • Manually create the document using the JSON API with the extracted data as a starting point

Extraction Inaccuracies

Issue: Extracted amounts, dates, or tax IDs are incorrect Solution:
  • Always provide vendor_tax_id and customer_tax_id as query parameters
  • Use text-based PDFs rather than scanned images
  • Ensure the PDF has a clear, structured layout
  • Review extracted data before creating documents

Authentication Errors

Status Code: 401 Unauthorized Solution:
  • Verify your API key is correct
  • Ensure the Authorization header is properly formatted: Bearer YOUR_API_KEY
  • Check your API key has not expired

Best Practices

Include vendor and customer tax IDs as query parameters for better extraction:
Always check if a UBL document was generated before proceeding:
For processing multiple PDFs, use the async endpoint to avoid timeouts:
Store original PDFs for audit and compliance purposes:
Review extracted data before sending, especially for critical fields:

Next Steps

Creating Invoices

Learn standard JSON invoice creation

UBL Documents

Create from UBL XML files

Validation Guide

Test invoice data

API Reference

Explore all endpoints