Skip to content
CRYSTAL ITIT SolutionsHome
Electronic invoicing

UBL 2.1 format for electronic invoicing in Morocco: complete guide

July 13, 20267 min read
UBL 2.1 format for electronic invoicing in Morocco: complete guide

The UBL 2.1 format is one of the two structured invoice standards cited for Morocco's electronic invoicing reform, alongside UN/CEFACT CII. The logic is simple: an electronic invoice within the meaning of the reform is not a PDF sent by email, but a data file that systems can read without re-entry. The DGI has announced that these invoices will go through its electronic invoicing platform, developed by xHub, on the basis of prior validation (known as 'clearance'). However, neither the public name of this platform, nor its technical specification, nor the Moroccan profile of the format (exact list of required fields, signature, transmission method) has been published to date. This guide explains what the UBL 2.1 standard is, why a PDF is not structured data, which details are already mandatory on a Moroccan invoice, what is known about the timetable, and what you can reasonably expect from your software. For a general introduction to the reform, see our pillar article on electronic invoicing in Morocco 2026 (Electronic invoicing in Morocco in 2026), and for the announced phases, our guide to the timetable (Electronic invoicing timeline in Morocco). Official texts and dates are those published on the DGI portal (tax.gov.ma).

UBL 2.1 and UN/CEFACT CII: two public structured invoice standards

UBL 2.1 (Universal Business Language) is an open standard published by OASIS, a standards consortium. It defines, in XML, a family of business documents — order, delivery note, credit note, invoice — with a common tag vocabulary. UN/CEFACT CII (Cross Industry Invoice) is the equivalent standard from the United Nations Centre for Trade Facilitation and Electronic Business. They are the two standards cited for the Moroccan reform; they also serve as a basis, in the form of national profiles, in several countries that have made electronic invoicing mandatory.

In practice, a UBL 2.1 invoice is an XML document in which each piece of information sits in a tag defined by the standard: the issuer and the recipient (name, address, identifiers), the invoice number and date, the currency, the lines (description, quantity, unit price, amount), the taxes (base, rate and amount per rate) and the totals. Software can therefore read the invoice without re-entry or interpretation. The standard sets the general syntax; a national profile specifies which elements are mandatory, which identifiers to use and which validation rules apply. For Morocco, this profile has not yet been published.

  • UBL 2.1 is an open OASIS standard; UN/CEFACT CII is a United Nations standard.
  • They are the two structured formats cited for Morocco's electronic invoicing reform.
  • A UBL 2.1 invoice is an XML file: issuer, recipient, number, date, currency, lines, taxes and totals.
  • The standard defines the syntax; a national profile sets the required fields and validation rules.
  • The Moroccan profile (required fields, signature, transmission) has not been published to date.

Why a PDF is not a structured invoice

PDF remains the most common format for sending an invoice, but it is a layout document: it is designed to be read by a person, not processed by a program. To extract the VAT amount per rate, the client's ICE or a line total, it has to be re-keyed or run through character recognition, with the errors that entails. A structured XML file, by contrast, carries each piece of data in a defined location, identical from one issuer to the next.

This is why electronic invoicing reforms rely on structured formats. In Morocco, the DGI has announced a principle of prior validation of invoices by its electronic invoicing platform (the so-called 'clearance' model); its technical arrangements have not yet been published. What is certain is that automated processing requires structured data: software that only produces PDFs will have to evolve. The penalties announced for non-compliant invoices include tax penalties, the disallowance of the related expenses and prosecution in cases of serious fraud; no amounts have been published.

  • PDF is a layout format, readable by a person, not by a program.
  • Extracting data from a PDF requires re-keying or character recognition, both sources of error.
  • Structured XML places each piece of data in a defined tag, identical from one issuer to the next.
  • Prior validation by the DGI platform has been announced; its technical arrangements have not been published.
  • Announced penalties: tax penalties, disallowance of expenses, prosecution in cases of serious fraud — no amounts published.

Invoice details: what is established and what remains to be published

The format alone is not enough: the file must also contain the right information. Part of it is already established, because it applies to Moroccan invoices regardless of the reform: the ICE (Identifiant Commun de l'Entreprise) is already mandatory on invoices, alongside the usual details, namely the identity of the parties, the number, the date, the description of goods or services, the amounts excluding tax, the VAT and the total.

What the reform will add, however, is not yet known in detail: the exact list of elements required in the file, the codes and identifiers to use, the validation rules applied by the platform and the signature arrangements have not been published. Any 'official' list of blocking fields presented today goes beyond what the DGI has made public. The prudent approach is to make reliable, starting now, the data that any profile will require: party identifiers, numbering, VAT breakdown by rate and detailed lines.

  • ICE: already mandatory on invoices in Morocco — check it in your client records.
  • Tax identifiers of the parties: keep them up to date in client and supplier master data.
  • VAT breakdown by rate: taxable base and amount for each rate applied.
  • Detailed lines: description, quantity, unit price and amount per line.
  • Unique invoice number, issue date and currency.
  • Moroccan profile (required fields, codes, signature): not published to date.

Who is concerned and when: the announced timetable

According to the timetable announced and reported by the press in June 2026, the roll-out takes place in stages. In 2026, the first phase covers B2G transactions, i.e. invoicing to the State and public bodies, for around 1,655 large companies with turnover above 200 million dirhams. In 2027-2028, the obligation is to extend to SMEs and mid-sized companies. After 2028, very small businesses are to be brought in through simplified solutions.

No exact dates have been set: the precise timetable is to be laid down by a decree, which has not been published to date. Be wary of deadlines presented as final. For a detailed analysis of the announced phases, see our dedicated guide (Electronic invoicing timeline in Morocco), and always check your situation on the official DGI portal (tax.gov.ma).

  • 2026: B2G transactions of around 1,655 large companies with turnover above MAD 200 million.
  • 2027-2028: announced extension to SMEs and mid-sized companies.
  • After 2028: very small businesses, through simplified solutions.
  • The precise timetable is to be set by decree, not published to date.
  • Reference: the official DGI portal (tax.gov.ma).

What your software should be able to do today

As long as the platform's specification has not been published, no software can claim to be connected to it. It is, however, possible to prepare the ground. Serious invoicing software should produce your invoices from structured data rather than layout documents, check the presence and format of the ICE and mandatory details at data entry, break down VAT by rate, and be able to export a file in a structured standard such as UBL 2.1. This clean data will be useful whatever profile is adopted.

Be wary of promises of 'compliance' or 'automatic transmission': they cannot be verified until the DGI's technical rules are published. Instead, ask your vendor what its software already does (checks, structured export) and how it will integrate the official specification once it is released. To compare offerings, see our dedicated guide (DGI electronic invoicing: preparing your invoicing software).

  • Invoices produced from structured data, not just PDFs.
  • ICE and mandatory details checked at data entry.
  • VAT breakdown by rate on every invoice.
  • Export in a public structured standard, such as UBL 2.1.
  • A clear commitment to integrate the DGI specification as soon as it is published.

Crystal ERP: readiness check and UBL 2.1 export

Crystal ERP (erp.crystalit.ma) is the SaaS ERP developed and maintained by CRYSTAL IT, a software publisher based in Rabat with more than 20 years of experience in management software for Moroccan companies. For electronic invoicing, it does two things today: it checks each invoice's readiness (presence of the ICE, mandatory details, structure) and exports it in standard UBL 2.1 format.

Transmission to the DGI's electronic invoicing platform will be added once its technical specification is published; until then, Crystal ERP does not send any invoice to the DGI. Invoicing is part of a complete management flow — quotes, orders, deliveries, accounting — so that your data is clean and structured on the day the Moroccan profile is released. For an overview of the reform, see our pillar article on electronic invoicing in Morocco 2026 (Electronic invoicing in Morocco in 2026).

UBL 2.1 and UN/CEFACT CII are the structured invoice standards cited for the Moroccan reform: an electronic invoice within the meaning of the reform is a data file, not a PDF. Beyond that, what is established must be distinguished from what is announced. Established: the ICE and the usual invoice details. Announced: prior validation by the DGI's electronic invoicing platform and a phased timetable, from 2026 for B2G transactions of large companies to after 2028 for very small businesses. Not published: the Moroccan profile of the format, the platform specification and the dates, which are to be set by decree. The right move is to make your data reliable now. Crystal ERP (erp.crystalit.ma), CRYSTAL IT's SaaS solution based in Rabat, checks the readiness of your invoices and exports them in standard UBL 2.1; transmission to the DGI will be added as soon as the specification is published. Check your obligations on the official DGI portal (tax.gov.ma) and contact the CRYSTAL IT team for a demonstration.

Have a project or a question? Let's talk with a CRYSTAL IT expert.

Request a demo