Document lifecycle
Statuses of AdapterDian documents, DIAN warnings, downloads in PDF, XML and ZIP, email resends and discarding unvalidated documents.
Issuing is asynchronous. The POST answers 202 Accepted with a transaction_id and "status": "pending", and the document continues on its own. The same lifecycle applies to every document type: sales invoices, credit and debit notes, support documents, adjustment notes and payroll.
Statuses
GET /invoices/v1/sales-invoices/{id} (and its equivalent for each type) returns status, document_number, cufe, correlation_id, created_at and warnings.
status |
Meaning |
|---|---|
pending |
Accepted and queued. |
sent |
Sent to the technology provider. |
validated |
The DIAN validated it. It has a number and a CUFE. |
rejected |
The DIAN didn’t validate it. |
failed |
It couldn’t be processed. |
cancelled |
Declared in the contract. |
A validated document can still carry warnings
warnings are notifications from the tax authority. They don’t mean rejection, but they point at master data (customer, products) worth reviewing. They’re kept even when the document was validated.
Listing
GET /invoices/v1/sales-invoices lists what your tenant has issued, most recent first. Filters: status, number (exact DIAN number), issued_from, issued_to, page and per_page (default 25, max 100). The response includes total, the number of documents that match the filter.
Documents issued outside AdapterDian don’t appear: the list is served from the adapter’s own database so that no tenant sees another’s documents.
Downloading
Available once the document has a DIAN number. Before that, it answers 409 naming the current status.
curl -OJ https://adapterdian.piensait.com/functions/v1/invoices/v1/sales-invoices/$TRANSACTION_ID/pdf \
-H "Authorization: Bearer $ADAPTERDIAN_API_KEY"format |
Content |
|---|---|
pdf, xml |
The document. |
attached-xml |
Includes the tax authority’s response. |
zip |
The package that would go by email. Also returns X-Email-Subject, percent-encoded. |
Resending by email
POST /invoices/v1/sales-invoices/{id}/email with { "email": "…" } sends the document with its graphic representation. The recipient is required and is not taken from the document’s customer. It requires invoices:write.
Discarding
DELETE /invoices/v1/sales-invoices/{id} only works on documents the DIAN has not validated: it’s the way out of a pending document you need to recreate with corrections. A validated document answers 409 and isn’t touched. A tax document accepted by the authority exists forever: what corrects it is a note, not a deletion.
RADIAN events on your invoices
GET /invoices/v1/sales-invoices/{id}/events shows how your customer responded to an invoice you issued: acknowledgement, claim, or letting the three-business-day deadline pass. It only exists for sales invoices.