Facturación

Register of Colombian electronic documents and import of DIAN documents by CUFE.

Raw Markdown for agents: facturacion.md. MCP: read_docs("facturacion").

Facturación keeps a register of the Colombian electronic documents (invoices, credit notes, debit notes and support documents) issued through the Facturación integration, with DIAN status, legal status and CUFE/CUDE. It also imports the XML of documents a company issued or received, by CUFE, through Soluciones Alegra S.A.S as technology provider.

Operations:

  • facturacion.documents.list: the documents of a Space, newest first; filter by kind, status, legal_status, prefix, counterparty_identification, dian_uuid or creation date, and page with cursor.
  • facturacion.documents.get: one document with the complete provider and government response, the files archived in the Space and the CUFE/CUDE.
  • DIAN document lists and their XMLs: DIAN sources sync them on a schedule (dian.sources.*, dian.sync.run); the single steps are dian.token.request, dian.excel.export and dian.xml.import. Read read_docs("dian").

Importing documents without habilitation:

  • Needs a Facturación connection whose owner confirmed in the app (connection, DIAN tab) that Soluciones Alegra S.A.S is the company's technology provider, or a finished habilitation, plus a grant of the Space that allows integrations.facturacion.dian.query. Only the connection owner starts it.
  • XMLs land in DIAN/Emitidos and DIAN/Recibidos under folder_id or the Space root. CUFEs already imported into the Space are skipped, so a new run over the same range only fetches what is missing. Events (acuses, application responses) and rows of other NITs are skipped.
  • The import runs in the background at up to 60 documents per minute; poll dian.runs.get. result counts imported, no_xml, failed and pending. NO_XML means the DIAN returned no XML for that CUFE, usually because Soluciones Alegra S.A.S is not the technology provider of that NIT.
  • Every fetch is billed (3 credits), also when the result is NO_XML.

Rules:

  • facturacion.documents.* only read. Documents are issued through the integration operations integrations.facturacion.*.create (read the read_docs("integrations")); each successful call is registered here automatically. Issuing needs the finished habilitation.
  • A credit or debit note references its invoice by CUFE; read it with facturacion.documents.get first.