Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/farojas85/fast-rest-api/llms.txt

Use this file to discover all available pages before exploring further.

DIAN REST API is a production-ready FastAPI service that bridges your POS or billing system with the Colombian tax authority (DIAN) web services. It handles the full lifecycle of electronic document emission — from receiving structured order data over REST, to signing and submitting XML invoices via SOAP, to logging every transaction in PostgreSQL.

Quickstart

Get the API running locally and send your first invoice in minutes.

Configuration

Set up environment variables, PFX certificates, and WSDL URLs.

API Reference

Explore every endpoint, request schema, and response format.

Architecture

Understand the Hexagonal architecture and how components connect.

What You Can Do

Invoice Local Orders

Submit dine-in restaurant orders for DIAN-compliant electronic invoice generation.

Issue Credit Notes

Generate credit notes that reference the original CUFE to void or correct invoices.

Invoice Deliveries

Bill delivery orders from Rappi, Didi, or your own platform with separate delivery fee taxation.

How It Works

1

Configure your environment

Copy .env.example to .env, fill in your DIAN credentials, and point DIAN_CERT_PATH at your .pfx certificate. The app validates the certificate on startup and fails fast if anything is wrong.
2

Start the server

Run uvicorn src.main:app --reload. The API boots with FastAPI’s automatic OpenAPI docs at /docs.
3

POST your first order

Send a POST /api/v1/pedidos/consumo-local/ request with your order payload. The API validates totals, maps your data to domain entities, and submits the invoice to DIAN.
4

Receive your track ID and CUFE

The response returns the DIAN track_id and cufe — the official electronic document identifiers you need for compliance records.

Key Features

Async SOAP Client

Uses zeep with AsyncTransport over httpx so DIAN calls never block FastAPI’s event loop.

Fast-Fail Certificate Validation

PFX certificate is loaded and validated at startup — the service won’t start with a bad cert or missing credentials.

Hexagonal Architecture

Domain logic is fully decoupled from DIAN SOAP and PostgreSQL via port interfaces, making the core testable without any external services.

PostgreSQL Audit Log

Every DIAN transaction attempt — including request payloads, responses, and error traces — is persisted for traceability and support diagnostics.

Build docs developers (and LLMs) love