Introduction
The DIAN in Colombia stands for Dirección de Impuestos y Aduanas Nacionales (National Directorate of Taxes and Customs). It is the government agency responsible for managing and overseeing tax collection, customs operations, and facilitating international trade. Electronic invoicing in Colombia is mandatory and operates on a real-time clearance model whereby every invoice must receive a unique identifier called a CUFE (Código Único de Factura Electrónica) issued by the DIAN; credit and debit notes receive the equivalent CUDE. Invopop has partnered with Alegra, an authorized technology provider for DIAN electronic invoicing, to issue documents in Colombia. This guide walks you through setting up the workflow that issues GOBL documents through the DIAN. For onboarding suppliers, see the companion guide: Supplier registration in Colombia.Prerequisites
In order to complete this guide, you will need:- A registered supplier: follow the supplier registration guide to create the supplier’s Alegra account and complete the DIAN enablement before issuing.
- Customer details for B2B transactions, including name, NIT or international ID, and address, plus the DIAN municipality code for customers identified by a Colombian NIT (see When is the municipality code required?).
- Line and item details, including quantity, price, description, and taxes to apply. Colombia can be complicated, as a single invoice may need to apply up to three different value added and retained taxes.
Document types
The same workflow handles all three DIAN document types:Setup
Create the send workflow
Colombia send invoice workflow
- Workflow
- Code
series gets its own counter, starting at 1. Invoice codes must fall within the series’ numbering resolution, so if the authorized range starts elsewhere (the sandbox SETP range starts at 990000000), create a series with a matching start number and select it in the step instead.Send an invoice
Upload the invoice as a silo entry and run the workflow on it, either from the Invopop Console or via the API.- adds the
dian-cudestamp to the envelope, holding the CUFE (invoices) or CUDE (credit and debit notes), - adds the
dian-qrstamp with the DIAN QR code content, used by the PDF step to render a compliant invoice, - adds the
dian-resolutionstamp with the numbering resolution (invoices only) and theemail-subjectstamp with the subject the DIAN expects on the email notification, and, - attaches the signed DIAN XML (AttachedDocument) to the entry as a file.
Validation notes
Before sending, the document is validated against the DIAN add-on rules plus a few DIAN transmission requirements:- The issue date must be the current date in Colombia: the DIAN rejects back-dated documents.
- The
codemust contain digits only; letters belong in theseries. - For invoices, the series must match one of the supplier’s numbering resolutions, and the code must be within the authorized range and validity dates. Resolutions are refreshed from the DIAN automatically once the range is linked to Alegra.
- Every tax combo must include a percent; you can set percents explicitly or use one of the supported rates of the GOBL Colombia tax regime.
- All line items must have a price greater than zero, and due dates cannot be earlier than the issue date.
- Totals rounding (
totals.rounding) isn’t supported. - Amounts in other currencies are converted to COP automatically. Invoices in a currency other than COP must include
exchange_rateswith a rate to COP, or the conversion fails.
When is the municipality code required?
Theco-dian-municipality extension in a party’s ext identifies its municipality. Whether a party needs it depends on how it’s identified:
- The value is the 5-digit DIAN municipality code (DIVIPOLA), such as
11001for Bogotá or05001for Medellín, not the 6-digit postal code. See the DIAN list of municipality codes. - When a required code is missing, the GOBL build fails with
extension 'co-dian-municipality' is requiredon$.supplier.extor$.customer.ext, so the invoice never reaches the DIAN. - Invopop can’t derive the code from the NIT, so collect it with the rest of your customer data for each Colombian business customer, for example in your customer form. Foreign and consumer customers don’t need the field.
Transmitting invoices issued during a contingency
The DIAN defines what to do when invoices can’t be issued electronically in Resolución 000165 de 2023. The required action depends on where the outage is:While offline: issue on paper
During the outage, invoices are issued by hand or printed from any other system (facturas de talonario o de papel). These paper invoices:- Must be numbered from a contingency range, which the supplier needs to request from the DIAN ahead of time.
- Can only be issued while the outage lasts, and are valid support for the sale for both the supplier and the customer.
Once back online: transmit the invoices
Within 48 hours of the outage ending, each paper invoice must be captured and sent to the DIAN through Invopop.-
Create a GOBL invoice replicating the paper invoice, with the same customer, lines, and taxes, and with these specifics:
- The
seriesandcodeare the paper invoice’s contingency prefix and number. - The
issue_dateis the date the paper invoice was issued. - The
co-dian-invoice-typeextension intax.extis set to03.
This partial example shows only the contingency-specific fields. Complete the document with the supplier, customer, and lines copied from the paper invoice. - The
- Run your regular send workflow on the document. It’s sent to the DIAN as a type 03 invoice and gets the same stamps as a regular invoice, with a CUDE instead of a CUFE.
- Credit and debit notes have no contingency procedure: wait until the systems are back and issue them with your usual note series. They can correct a transmitted contingency invoice like any other invoice.
- Outages on the DIAN’s side (type 04 contingency) are handled by Invopop and need no changes to your documents.
- In sandbox, upload a contingency resolution with any values first, such as prefix
CONTand range1–5000. The DIAN test environment doesn’t check contingency ranges, but Invopop still checks the invoice’s code and date against the uploaded resolution.
Example invoices
The following examples are of GOBL documents you can copy and paste directly into the Invopop Console or store via the API as silo entries. Then, you must run the Colombia workflow created during setup. GOBL Invoices sent to the DIAN require the following properties to perform the correct normalization and validation steps:$schemato be set tohttps://gobl.org/draft-0/bill/invoice$addonsto includeco-dian-v2, so the document is validated with the DIAN rulessupplier.tax_id.countryto be set toCOsupplier.extto include the DIAN municipality code under theco-dian-municipalityextension. Customers identified by a Colombian NIT need it too; foreign andsimplifiedB2C customers don’t. See When is the municipality code required?.
9005590882 and the SETP test series. Before sending, set the issue date to today and change the code to another one between 990000000 and 995000000, since the range is shared.Example B2B invoice
Example B2B invoice
- the
$schemais set tohttps://gobl.org/draft-0/bill/invoice, - we’ve added the
co-dian-v2addon, so the document is validated with the DIAN rules built into GOBL and gets its defaults, such as theR-99-PNfiscal responsibility, - the supplier uses Alegra’s sandbox NIT and the
seriesis theSETPtest series, so the example can be sent in the sandbox, - both parties carry the DIAN municipality code in the
co-dian-municipalityextension, required here because the customer is identified by a Colombian NIT, - the invoice includes VAT at the standard Colombian rate of 19%,
- payment terms are specified with a due date and payment amount, and,
- there are no calculations in some fields; these will be made automatically when uploading.
Example B2C invoice
Example B2C invoice
- we’ve set the
simplifiedtag in thetax.tagsfield; this indicates the invoice is for a final consumer, - the customer information is omitted, as it’s not required for B2C transactions; the DIAN receives it as Consumidor final, and no customer municipality code is needed,
- the invoice includes a prepayment advance of 100%, meaning the invoice has been fully paid,
- the totals section shows the
advanceanddueamounts, with the latter being zero since the invoice is fully paid, and, - there are no calculations in some fields; these will be made automatically when uploading.
Example credit note
Example credit note
- the
typeis set tocredit-note, - the
seriesis set to a dedicated credit note series, separate from the invoice series, - the
precedingarray references the original invoice being corrected by itsseries,code, andissue_date, along with areasonfor the correction, - the correction concept is set with the
co-dian-credit-codeextension on the preceding entry, - the lines describe the amounts being credited — a credit note can cover the full original invoice or just part of it, and,
- there are no calculations in some fields; these will be made automatically when uploading.
Example debit note
Example debit note
- the
typeis set todebit-note, - the
seriesis set to a dedicated debit note series, separate from the invoice series; notes don’t need a numbering resolution, - the
precedingarray references the original invoice by itsseries,code, andissue_date, along with areasonfor the adjustment, - the preceding entry carries the
dian-cudestamp of the original invoice, taken from its cleared envelope; the DIAN requires it for every debit note, - the adjustment concept is set with the
co-dian-debit-codeextension on the preceding entry, - the lines describe only the additional amount being charged, and,
- there are no calculations in some fields; these will be made automatically when uploading.
FAQ
My GOBL document for a Colombian invoice fails to build because of the postal code
My GOBL document for a Colombian invoice fails to build because of the postal code
co-dian-municipality extension of the supplier and of customers identified by a Colombian NIT. For example, use 11001 for Bogotá.How does Invopop issue invoices in Colombia?
How does Invopop issue invoices in Colombia?
What does a GOBL invoice need to be accepted by the DIAN?
What does a GOBL invoice need to be accepted by the DIAN?
$schema to https://gobl.org/draft-0/bill/invoice, the supplier’s tax_id.country to CO, and include the supplier’s DIAN municipality code via the co-dian-municipality extension in its ext. Customers identified by a Colombian NIT need the extension too; foreign customers and simplified B2C invoices don’t (see When is the municipality code required?). See the GOBL Colombia tax regime for the full field reference and examples.Do foreign or consumer customers need a municipality code?
Do foreign or consumer customers need a municipality code?
co-dian-municipality extension is only required on customers identified by a Colombian NIT, that is, with tax_id.country set to CO and a tax_id.code. Foreign customers, simplified B2C invoices without a customer, and consumers identified only by a cédula build without it. Invopop can’t derive the code from the NIT, so collect it for each Colombian business customer.Which taxes can appear on a Colombian invoice?
Which taxes can appear on a Colombian invoice?
Which document types can I issue in Colombia?
Which document types can I issue in Colombia?
preceding array; debit notes require every preceding entry to carry the dian-cude stamp of the original invoice.What are the sandbox limitations for Colombia?
What are the sandbox limitations for Colombia?
9005590882) can be the supplier. Invoices use series SETP with codes 990000000–995000000 (shared across users, so avoid common codes) and today’s date in Colombia.Why was my invoice rejected for its series or number?
Why was my invoice rejected for its series or number?
🇨🇴 Invopop resources for Colombia
🇨🇴 Invopop resources for Colombia