What is UBL?
Universal Business Language (UBL) is an international standard for electronic business documents developed by OASIS (Organization for the Advancement of Structured Information Standards). UBL 2.1 provides a library of XML schemas for common business documents like invoices, orders, and shipping notices.UBL 2.1 is the foundation for electronic invoicing systems worldwide, including mandatory e-invoicing implementations in countries like Colombia (DIAN), Peru (SUNAT), and across the European Union.
Why UBL Matters
UBL standardizes the structure and semantics of business documents, enabling:Interoperability
Systems from different vendors can exchange documents seamlessly without custom integrations
Compliance
Meet tax authority requirements for electronic invoicing in multiple jurisdictions
Automation
Machine-readable formats enable automated processing and validation
Global Adoption
Widely adopted standard supported by governments and enterprises worldwide
UBL 2.1 Key Features
Schema-Based Validation
UBL documents are validated against XML schemas that define:- Required and optional elements
- Data types and formats
- Business rules and constraints
- Cardinality (min/max occurrences)
Hierarchical Structure
UBL documents follow a hierarchical organization:Namespace Organization
UBL uses multiple XML namespaces to organize components:Common Basic Components (cbc)
Common Basic Components (cbc)
Simple data elements like IDs, dates, amounts, and text fields.Namespace:
urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2Examples: cbc:ID, cbc:IssueDate, cbc:TaxAmountCommon Aggregate Components (cac)
Common Aggregate Components (cac)
Complex structures that group related data elements together.Namespace:
urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2Examples: cac:Party, cac:TaxTotal, cac:InvoiceLineExtension Components (ext)
Extension Components (ext)
Allows custom extensions while maintaining UBL compliance.Namespace:
urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2Used for: Country-specific requirements, digital signatures, custom fieldsUBL Document Types
While this library focuses on invoices, UBL 2.1 defines many document types:| Document Type | Purpose |
|---|---|
| Invoice | Request for payment for goods or services |
| Credit Note | Adjustment reducing amount owed |
| Debit Note | Adjustment increasing amount owed |
| Order | Purchase order from buyer to seller |
| Despatch Advice | Notification of goods shipment |
| Receipt Advice | Confirmation of goods received |
Country-Specific Implementations
Colombia (DIAN)
This library includes specialized support for Colombia’s DIAN (Dirección de Impuestos y Aduanas Nacionales) requirements:- CUFE calculation: Cryptographic hash for document uniqueness
- QR code generation: For mobile verification
- Digital signatures: Using XAdES standard
- Software provider validation: PIN and security codes
Official UBL Resources
OASIS UBL TC
Official UBL Technical Committee page
UBL 2.1 Schemas
Download XSD schemas and documentation
UBL Library
Searchable schema documentation
DIAN Technical Annex
Colombia’s electronic invoicing specifications
Next Steps
Document Structure
Learn how UBL documents are organized in the libraryExplore Document Structure →
XML Generation
Understand how the library converts objects to valid UBL XMLLearn XML Generation →
Build Your First Invoice
Follow the quickstart guide to create a complete invoiceStart Building →