This page presents real-world example invoices that demonstrate the capabilities of the gobl.ubl conversion system. These examples are located in the test data directory and serve both as test fixtures and documentation of supported features. For information about the test framework that uses these examples, see Test Framework. For details about specific document types and tags, see Document Types and Tags.
The example documents are organized in two main categories based on conversion direction:
Sources: test/data/parse/out/ubl-example1.json1-578 test/data/parse/out/ubl-example4.json1-252 test/data/parse/out/base-example.json1-285
The parse/ directory contains UBL XML documents and their expected GOBL JSON output after parsing. The convert/ directory contains GOBL JSON documents and their expected UBL XML output after conversion.
The following table categorizes example documents by the features they demonstrate:
| Example File | Profile | Tax Rates | Charges | Advances | Delivery | Credit Note | Notes |
|---|---|---|---|---|---|---|---|
ubl-example1.json | EN16931 | 2 (6%, 21%) | No | No | No | No | Large item list (20 lines) |
ubl-example3.json | EN16931 | 2 (25%, 10%) | Yes | No | No | No | Document-level charges |
ubl-example4.json | EN16931 | 2 (25%, 12%) | No | No | Yes | No | Multi-rate with delivery |
ubl-example6.json | EN16931 | 2 (25%, 12%) | No | No | No | No | Minimal supplier/customer |
ubl-example7.json | EN16931 | 1 (Outside scope) | No | No | No | No | Non-VAT taxation |
ubl-example8.json | EN16931 | 1 (21%) | No | No | Yes | No | Utility invoice with metadata |
ubl-example9.json | EN16931 | 1 (21%) | No | No | No | No | Subscription service |
base-example.json | EN16931 | 1 (25%) | Yes | No | Yes | No | Full featured standard |
base-creditnote-correction.json | EN16931 | 1 (25%) | Yes | No | Yes | Yes | Credit note with preceding |
base-negative-inv-correction.json | EN16931 | 1 (25%) | Yes | No | Yes | No | Negative correction invoice |
sales-order-example.json | EN16931 | 1 (25%) | Yes | No | Yes | No | With purchase order |
invoice-peppol.json | Peppol | 1 (25%) | Yes | No | No | No | Peppol routing identifiers |
credit-note1.json | None | 0 (No tax) | No | No | No | Yes | Simple credit note |
vat-category-E.json | EN16931 | 1 (0% exempt) | No | No | No | No | VAT exemption |
vat-category-O.json | EN16931 | 1 (Outside scope) | No | No | No | No | Non-EU VAT treatment |
Sources: test/data/parse/out/ubl-example1.json1-578 test/data/parse/out/ubl-example3.json1-227 test/data/parse/out/ubl-example4.json1-252 test/data/parse/out/sales-order-example.json1-290 test/data/parse/out/invoice-peppol.json1-267
A typical standard invoice example demonstrates the complete invoice structure with all major components:
Sources: test/data/parse/out/base-example.json1-285
This example (base-example.json) demonstrates:
Credit notes use the credit-note type and reference preceding invoices:
Sources: test/data/parse/out/base-creditnote-correction.json1-288
Key characteristics of credit notes:
type field set to "credit-note" at test/data/parse/out/base-creditnote-correction.json17preceding array references the original invoice at test/data/parse/out/base-creditnote-correction.json21-24381 in tax extensions at test/data/parse/out/base-creditnote-correction.json29An alternative to credit notes is using a standard invoice with negative line items:
Sources: test/data/parse/out/base-negative-inv-correction.json1-290
Negative invoice corrections:
type: "standard" instead of "credit-note" at test/data/parse/out/base-negative-inv-correction.json17380 (invoice) at test/data/parse/out/base-negative-inv-correction.json29Many jurisdictions apply different VAT rates to different product categories. Example ubl-example1.json demonstrates this:
Sources: test/data/parse/out/ubl-example1.json71-511 test/data/parse/out/ubl-example1.json536-571
The tax breakdown at test/data/parse/out/ubl-example1.json539-567 shows:
Document-level charges (or allowances) apply to the entire invoice rather than individual lines:
Sources: test/data/parse/out/ubl-example3.json133-148 test/data/parse/out/ubl-example3.json184-219
The charges structure at test/data/parse/out/ubl-example3.json133-148 shows:
i) to order chargesreason fieldamount field for the charge valuetaxes array specifying the applicable tax ratePeppol invoices include routing identifiers and follow the Peppol BIS Billing 3.0 specification:
Sources: test/data/parse/out/invoice-peppol.json12-14 test/data/parse/out/invoice-peppol.json43-46 test/data/parse/out/invoice-peppol.json72-76
Peppol-specific features:
inboxes array with Peppol participant identifiers at test/data/parse/out/invoice-peppol.json43-46Delivery details include receiver information, addresses, and dates:
Sources: test/data/parse/out/ubl-example4.json197-209
The delivery structure at test/data/parse/out/ubl-example4.json197-209 includes:
receiver party with address informationdate separate from invoice issue datePayment information includes terms, due dates, and detailed instructions:
Sources: test/data/parse/out/ubl-example4.json174-196
Payment components:
terms with due_dates array at test/data/parse/out/ubl-example4.json175-183instructions with payment method key at test/data/parse/out/ubl-example4.json184-195credit_transfer array for bank details at test/data/parse/out/ubl-example4.json187-190Utility invoices often include additional metadata on line items:
Sources: test/data/parse/out/ubl-example8.json71-96
Line item metadata at test/data/parse/out/ubl-example8.json78-83 includes:
item.meta mapSome transactions use special VAT treatment categories:
Sources: test/data/parse/out/vat-category-E.json91-99 test/data/parse/out/vat-category-E.json132-140
Sources: test/data/parse/out/vat-category-O.json80-86 test/data/parse/out/vat-category-O.json119-127
Special VAT categories:
Orders and contracts link invoices to business agreements:
Sources: test/data/parse/out/sales-order-example.json206-212 test/data/parse/out/sales-order-example.json118
Ordering structures:
ordering.code at test/data/parse/out/sales-order-example.json207purchases array with purchase order references at test/data/parse/out/sales-order-example.json208-211order field at test/data/parse/out/sales-order-example.json118contracts array for contract references (see test/data/parse/out/ubl-example9.json100-104)period for contract or billing periods (see test/data/parse/out/ubl-example8.json318-322)Line items include comprehensive product and pricing information:
Sources: test/data/parse/out/sales-order-example.json115-150
Complete line item structure:
i for ordering at test/data/parse/out/sales-order-example.json116quantity and order (purchase order line ref) at test/data/parse/out/sales-order-example.json117-118cost for accounting strings at test/data/parse/out/sales-order-example.json119item with name, identities, description at test/data/parse/out/sales-order-example.json120-137identities with ISO scheme IDs at test/data/parse/out/sales-order-example.json122-132price, unit, origin at test/data/parse/out/sales-order-example.json135-137sum and total at test/data/parse/out/sales-order-example.json139-150Let's examine ubl-example4.json as a comprehensive example demonstrating multiple features:
Document Header
Parties
Line Items (3 items)
Ordering
Payment
Delivery
Financial Totals
Notes
Sources: test/data/parse/out/ubl-example4.json1-252
This example demonstrates: multiple tax rates, purchase order references, payment instructions, delivery information, party contact details, and financial calculations.
Refresh this wiki