> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invopop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DIAN Guide

> Issue invoices and credit notes in Colombia through the DIAN.

## Introduction

The [DIAN](https://www.dian.gov.co/) 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.

Businesses in Colombia must be registered with the DIAN and have an active RUT (*Registro Único Tributario*) to issue electronic invoices.

Invopop has partnered with [Plemsi](https://plemsi.com) to issue invoices in Colombia (DIAN). You have the option of either using Invopop's Plemsi billing account or create your own and provide your own credentials.

This guide will walk you through the steps necessary to set up the workflows that will allow you to issue [GOBL](https://docs.gobl.org) documents in Colombia using Plemsi as a provider.

| -            | Sandbox                                                           | Live                        |
| ------------ | ----------------------------------------------------------------- | --------------------------- |
| **Supplier** | Only one allowed (`9015852843`)                                   | Full supplier configuration |
| **Series**   | Only `SETT` (invoice) and `NCTT` (credit note) with shared ranges | Full configuration          |

Please refer to the docs of the [GOBL's Colombia Tax Regime](https://github.com/invopop/gobl/blob/main/regimes/co/README.md) to learn about the specifics of Colombian GOBL documents and to obtain examples.

## Prerequisites

In order to complete this guide in a live Invopop environment, you will need:

* Supplier details, including company name, RUT, address, and municipality code issued by the DIAN.
* Customer details for B2B transactions, including name, RUT or international ID, address, and municipality code national transactions.
* 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.
* Have authorized "Plemsi", the provider used by Invopop, to issue invoices on the supplier's behalf in the DIAN, and followed the specific onboarding process for each supplier (details below).

## Sandbox Setup

Plemsi provides a sandbox environment that you can use to test the issuance of invoices and credit notes end-to-end without fiscal or legal consequences. If you wish to use this environment, please contact us via Slack or [support@invopop.com](mailto:support@invopop.com) so that we enable your Invopop workspace to use it.

Once enabled, you'll need to setup a workflow like the one described [in the section below](#step-5-create-a-workflow).

There are a few limitations of this environment to bear in mind:

* There's only one supplier enabled. Its tax code is `9015852843`.
* There's only one series enabled for invoices (`SETT`) and another one for credit notes (`NCTT`). Moreover, those series are shared and, to avoid collisions, we'll provide you with a specific range for you to use (e.g. `SETT-123xxxx`)

Your test invoices will need to use the supplier's tax ID code and series above.

## Production Setup

You can invoice using the Plemsi provider on behalf of multiple suppliers. For each supplier, these are the steps you'll need to follow:

<Steps>
  <Step title="Authorise Plemsi to issue invoices on your behalf">
    First, the supplier's legal representative must authorize the Plemsi technology provider to issue invoices on your behalf in the DIAN.

    The following guide explains how to do it, but note that **you'll have to skip the last few steps in the Plemsi user interface**. We'll take care of them for you later in this guide:

    📘 [Habilitar documentos electrónicos DIAN](https://ayuda.plemsi.com/docs/tutoriales/configuracion/habilitar-documentos-electronicos-dian/)
  </Step>

  <Step title="Get a billing numbering range authorisation">
    Next, the supplier's legal representative must get a DIAN authorization for the billing numbering range you wish to use in your invoices. This guide explains how to do it:

    📘 [Solicitud de Autorización de Numeración de Facturación](https://www.dian.gov.co/impuestos/factura-electronica/Documents/Numeracion2022-AutorizacionF.pdf)

    Please note that these authorizations have a limit and an expiration date. If you need to renew an existing one, this other guide explains how to do it:

    📘 [Solicitud de Habilitación de Numeración de Facturación](https://www.dian.gov.co/impuestos/factura-electronica/Documents/Numeracion2022-Habilitacion-F.pdf)

    The DIAN will provide you with an 1876 form at the end of the process. Keep it at hand; you'll need it in the following steps.
  </Step>

  <Step title="Authorise Plemsi to use the numbering range">
    Now, the supplier representative must give the Plemsi technology provider permission to use the numbering range when issuing their invoices.

    The following guide explains how to do it, but again, note that **you'll have to skip the last few steps in the Plemsi user interface**. We'll take care of them for you later on:

    📘 [Asociar una resolución o numeración DIAN](https://ayuda.plemsi.com/docs/tutoriales/configuracion/registrar-resolucion-dian/)
  </Step>

  <Step title="Create and configure your Plemsi account">
    Now you need a Plemsi account created and configured. We have to do this for you, so please contact us via Slack or [support@invopop.com](mailto:support@invopop.com).

    You'll need to provide us with this information about the supplier company:

    * NIT with verification digit
    * Name
    * Phone number
    * E-mail address
    * Address
    * City
    * Region (*Departamento*)
    * Postal code
    * Country
    * Tax Obligations (whether any of the following apply):
      * *Responsable de IVA*
      * *Gran contribuyente*
      * *Autoretenedor*
      * *Agente de retención en el impuesto sobre las ventas*
      * *Régimen Simple de Tributación - SIMPLE*
    * Business registration number (*Número de Registro Mercantil*)
    * Legal representative data:
      * Full Name
      * Identification number (*Cédula de ciudadanía*)
      * Phone number
      * E-mail address

    Also, from the previous steps, you'll need to provide us with the following:

    * The `TestID` code resulting from Plemsi authorisation in the DIAN
    * The numbering range registration document (*Resolución DIAN*)
  </Step>

  <Step title="Create a workflow">
    <Tabs>
      <Tab title="Template">
        <Card iconType="duotone" title="DIAN-Colombia Invoice Workflow" icon="code-branch" href="https://console.invopop.com/redirect/workflows/new?template=co-dian-invoice" cta="Add to my workspace">
          This workflow will issue an invoice through DIAN.
        </Card>
      </Tab>

      <Tab title="Code">
        Copy and paste into a new [Empty Invoice workflow](https://console.invopop.com/redirect/workflows/new?template=empty-invoice) code view.

        ```json Example DIAN issue invoice workflow theme={"system"}
        {
          "name": "DIAN issue invoice",
          "description": "Issue an invoice through DIAN and generate PDF",
          "schema": "bill/invoice",
          "steps": [
            {
              "id": "ece780f0-322c-11f0-bbb5-9da15d555d80",
              "name": "Set state",
              "provider": "silo.state",
              "summary": "Set state to `processing`{.state .processing}",
              "config": {
                "state": "processing"
              }
            },
            {
              "id": "7d803770-322c-11f0-bbb5-9da15d555d80",
              "name": "Add sequential code",
              "provider": "sequence.enumerate",
              "summary": "Dynamic · DIAN · 1",
              "config": {
                "name": "Colombia",
                "padding": 1,
                "prefix": "",
                "start": 1
              }
            },
            {
              "id": "fc75e4f0-8721-11ef-a962-73e3f2037a52",
              "name": "Sign envelope",
              "provider": "silo.close"
            },
            {
              "id": "bde49770-322c-11f0-bbb5-9da15d555d80",
              "name": "Send invoice to DIAN",
              "provider": "plemsi"
            },
            {
              "id": "cdf59920-322c-11f0-bbb5-9da15d555d80",
              "name": "Generate PDF",
              "provider": "pdf",
              "summary": "Spanish · Letter",
              "config": {
                "date_format": "%Y-%m-%d",
                "layout": "Letter",
                "locale": "es",
                "logo_height": 40
              }
            },
            {
              "id": "9cebc6a0-322d-11f0-bbb5-9da15d555d80",
              "name": "Set state",
              "provider": "silo.state",
              "summary": "Set state to `sent`{.state .sent}",
              "config": {
                "state": "sent"
              }
            }
          ],
          "rescue": [
            {
              "id": "e57671a0-322c-11f0-bbb5-9da15d555d80",
              "name": "Set state",
              "provider": "silo.state",
              "summary": "Set state to `error`{.state .error}",
              "config": {
                "state": "error"
              }
            }
          ]
        }
        ```
      </Tab>

      <Tab title="Build from scratch">
        In [Console](https://console.invopop.com) create a new workflow and select [Empty Invoice workflow](https://console.invopop.com/redirect/workflows/new?template=empty-invoice) in the template selector, then add the following steps:

        1. **Set state** - Select `Processing`. This initial state marks the document as being processed.
        2. **Add sequential code** - Use a `Dynamic` series which will allow you to use the same workflow for both invoices and credit notes. Make sure to configure it according to the parameters of the authorised numbering range. Generally, you'll want to set the padding to 1 (so no zeros are prepended) and put no prefix or suffix.
        3. **Sign envelope** - The envelope must be signed before processing.
        4. **Send invoice to DIAN** - No configuration required.
        5. **Generate PDF** - Select `es-Spanish` as the Locale and layout `Letter`.
        6. **Set state** - Select `Sent`.

        Finally, in the Error Handling area, add the **Set state** action and select `Error`.

        This is the minimal workflow you can use to issue invoices in Colombia. You can now add other optional integrations to, for example, send an email with the invoice, notify another system with a webhook or upload the invoices to a Dropbox account.
      </Tab>
    </Tabs>
  </Step>
</Steps>

### And you're done!

Congrats, the setup is complete! You can now use each of the two workflows you created to issue invoices and credit notes in Colombia.

## Examples

The following examples are of [GOBL](https://docs.gobl.org) documents you can copy and paste directly into the [Invopop Console](https://console.invopop.com) or store via the API as silo entries. Then, you must run the DIAN Colombia workflow created during setup.

[GOBL Invoices](https://docs.gobl.org/draft-0/bill/invoice) sent to DIAN require the following properties to perform the correct normalization and validation steps:

* `$schema` to be set to `https://gobl.org/draft-0/bill/invoice`
* `supplier.tax_id.country` to be set to `CO`
* `supplier.tax_id.zone` to include the municipality code

<AccordionGroup>
  <Accordion title="Example B2B invoice">
    In this example, we're issuing a B2B invoice from a Colombian supplier to another Colombian business customer.

    Notice:

    * the `$schema` is set to [`https://gobl.org/draft-0/bill/invoice`](https://docs.gobl.org/draft-0/bill/invoice),
    * the supplier's `tax_id` country is set to `CO` and includes the municipality code in the `zone` field,
    * the customer details include full address, email, and telephone information,
    * 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.

    <CodeGroup>
      ```json DIAN Colombia B2B Invoice theme={"system"}
      {
        "$schema": "https://gobl.org/draft-0/bill/invoice",
        "type": "standard",
        "series": "SETT",
        "code": "1234",
        "issue_date": "2021-01-01",
        "currency": "COP",
        "supplier": {
          "name": "EXAMPLE SUPPLIER S.A.S.",
          "tax_id": {
            "country": "CO",
            "zone": "11001",
            "type": "tin",
            "code": "9014514812"
          }
        },
        "customer": {
          "name": "EXAMPLE CUSTOMER S.A.S.",
          "tax_id": {
            "country": "CO",
            "zone": "11001",
            "type": "tin",
            "code": "9014514805"
          },
          "addresses": [
            {
              "street": "CRA 8 113 31 OF 703",
              "locality": "Bogotá, D.C.",
              "region": "Bogotá",
              "country": "CO"
            }
          ],
          "emails": [
            {
              "addr": "benito.ortiz@example.com"
            }
          ],
          "telephones": [
            {
              "num": "3114131811"
            }
          ]
        },
        "lines": [
          {
            "quantity": "1",
            "item": {
              "name": "Servicios Mes de Julio 2022",
              "price": "200000.00"
            },
            "taxes": [
              {
                "cat": "VAT",
                "percent": "19%"
              }
            ]
          }
        ],
        "payment": {
          "terms": {
            "due_dates": [
              {
                "date": "2021-01-01",
                "percent": "100%"
              }
            ]
          }
        }
      }
      ```

      ```json Built version theme={"system"}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "CO",
      	"type": "standard",
      	"series": "SETT",
      	"code": "1234",
      	"issue_date": "2021-01-01",
      	"currency": "COP",
      	"supplier": {
      		"name": "EXAMPLE SUPPLIER S.A.S.",
      		"tax_id": {
      			"country": "CO",
      			"code": "9014514812",
      			"type": "tin"
      		},
      		"ext": {
      			"co-dian-municipality": "11001"
      		}
      	},
      	"customer": {
      		"name": "EXAMPLE CUSTOMER S.A.S.",
      		"tax_id": {
      			"country": "CO",
      			"code": "9014514805",
      			"type": "tin"
      		},
      		"addresses": [
      			{
      				"street": "CRA 8 113 31 OF 703",
      				"locality": "Bogotá, D.C.",
      				"region": "Bogotá",
      				"country": "CO"
      			}
      		],
      		"emails": [
      			{
      				"addr": "benito.ortiz@example.com"
      			}
      		],
      		"telephones": [
      			{
      				"num": "3114131811"
      			}
      		],
      		"ext": {
      			"co-dian-municipality": "11001"
      		}
      	},
      	"lines": [
      		{
      			"i": 1,
      			"quantity": "1",
      			"item": {
      				"name": "Servicios Mes de Julio 2022",
      				"price": "200000.00"
      			},
      			"sum": "200000.00",
      			"taxes": [
      				{
      					"cat": "VAT",
      					"key": "standard",
      					"percent": "19%"
      				}
      			],
      			"total": "200000.00"
      		}
      	],
      	"payment": {
      		"terms": {
      			"due_dates": [
      				{
      					"date": "2021-01-01",
      					"amount": "238000.00",
      					"percent": "100%"
      				}
      			]
      		}
      	},
      	"totals": {
      		"sum": "200000.00",
      		"total": "200000.00",
      		"taxes": {
      			"categories": [
      				{
      					"code": "VAT",
      					"rates": [
      						{
      							"key": "standard",
      							"base": "200000.00",
      							"percent": "19%",
      							"amount": "38000.00"
      						}
      					],
      					"amount": "38000.00"
      				}
      			],
      			"sum": "38000.00"
      		},
      		"tax": "38000.00",
      		"total_with_tax": "238000.00",
      		"payable": "238000.00"
      	}
      }
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Example B2C invoice">
    In this example, we're issuing a B2C simplified invoice from a Colombian supplier to a consumer.

    Notice:

    * we've set the `simplified` tag in the `tax.tags` field; this indicates the invoice is for a final consumer,
    * the customer information is omitted, as it's not required for B2C transactions,
    * the invoice includes a prepayment advance of 100%, meaning the invoice has been fully paid,
    * the totals section shows the `advance` and `due` amounts, 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.

    <CodeGroup>
      ```json DIAN Colombia B2C Invoice theme={"system"}
      {
        "$schema": "https://gobl.org/draft-0/bill/invoice",
        "type": "standard",
        "series": "SETT",
        "code": "1234",
        "issue_date": "2021-01-01",
        "currency": "COP",
        "tax": {
          "tags": [
            "simplified"
          ]
        },
        "supplier": {
          "name": "EXAMPLE SUPPLIER S.A.S.",
          "tax_id": {
            "country": "CO",
            "zone": "11001",
            "type": "tin",
            "code": "9014514812"
          }
        },
        "lines": [
          {
            "quantity": "1",
            "item": {
              "name": "Useful service",
              "price": "200000.00"
            },
            "taxes": [
              {
                "cat": "VAT",
                "percent": "19%"
              }
            ]
          }
        ],
        "payment": {
          "advances": [
            {
              "description": "Prepaid",
              "percent": "100%"
            }
          ]
        }
      }
      ```

      ```json Built version theme={"system"}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "CO",
      	"$tags": [
      		"simplified"
      	],
      	"type": "standard",
      	"series": "SETT",
      	"code": "1234",
      	"issue_date": "2021-01-01",
      	"currency": "COP",
      	"tax": {},
      	"supplier": {
      		"name": "EXAMPLE SUPPLIER S.A.S.",
      		"tax_id": {
      			"country": "CO",
      			"code": "9014514812",
      			"type": "tin"
      		},
      		"ext": {
      			"co-dian-municipality": "11001"
      		}
      	},
      	"lines": [
      		{
      			"i": 1,
      			"quantity": "1",
      			"item": {
      				"name": "Useful service",
      				"price": "200000.00"
      			},
      			"sum": "200000.00",
      			"taxes": [
      				{
      					"cat": "VAT",
      					"key": "standard",
      					"percent": "19%"
      				}
      			],
      			"total": "200000.00"
      		}
      	],
      	"payment": {
      		"advances": [
      			{
      				"description": "Prepaid",
      				"percent": "100%",
      				"amount": "238000.00"
      			}
      		]
      	},
      	"totals": {
      		"sum": "200000.00",
      		"total": "200000.00",
      		"taxes": {
      			"categories": [
      				{
      					"code": "VAT",
      					"rates": [
      						{
      							"key": "standard",
      							"base": "200000.00",
      							"percent": "19%",
      							"amount": "38000.00"
      						}
      					],
      					"amount": "38000.00"
      				}
      			],
      			"sum": "38000.00"
      		},
      		"tax": "38000.00",
      		"total_with_tax": "238000.00",
      		"payable": "238000.00",
      		"advance": "238000.00",
      		"due": "0.00"
      	}
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

***

<AccordionGroup>
  <Accordion title="🇨🇴 Invopop resources for Colombia">
    |            |                                                                                                                                                                                                                                                   |
    | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Compliance | <Icon icon="https://assets.invopop.com/flags/co.svg" /> [Invoicing compliance in Colombia](/compliance/colombia)<br /> <Icon icon="timeline" /> [Compliance timeline](/timelines/colombia)                                                        |
    | Apps       | <Icon icon="https://assets.invopop.com/apps/dian-colombia/icon.svg" /> [DIAN Colombia](/apps/dian-colombia)                                                                                                                                       |
    | Guides     | <Icon icon="book" /> [DIAN Guide](/guides/co-dian)                                                                                                                                                                                                |
    | FAQ        | <Icon icon="square-question" /> [Colombia FAQ](/faq/colombia)                                                                                                                                                                                     |
    | GOBL       | <Icon icon="https://assets.invopop.com/icons/gobl.svg" />  [Colombia Tax Regime](https://docs.gobl.org/regimes/co)<br /> <Icon icon="https://assets.invopop.com/icons/gobl.svg" /> [Colombia DIAN Addon](https://docs.gobl.org/addons/co-dian-v2) |
  </Accordion>
</AccordionGroup>

<Card title="Colombia FAQ" icon="square-question" href="/faq/colombia" arrow="true" horizontal>
  Find answers to frequently asked questions about invoicing in Colombia →
</Card>

<Card title="Participate in our community" icon="forumbee" href="https://community.invopop.com" arrow="true" horizontal>
  Ask and answer questions about invoicing in Colombia →
</Card>
