Skip to main content
POST
Create a signed invoice

Authorizations

Authorization
string
header
required

Send your Cufea API key as Authorization: Bearer <key>.

Headers

Idempotency-Key
string | null

Makes the call safe to retry. Same key and same request: the first response is replayed with Idempotent-Replayed: true and nothing is done again. Same key and another request: 422 idempotency_key_reused. Same key while the first request still runs: 409 idempotency_in_progress. Keys belong to your account; they expire 24 hours after first use, after which the same key is usable again for a new request. A 5xx, 403, 404 or 409 answer is not stored, so the same key can be retried after it.

Required string length: 1 - 255

Body

application/json

A sales invoice. The issuer, numbering range and signer come from the tenant.

customer
CustomerIn · object
required

An identified buyer: a natural or legal person with real identification data.

Only the identification and the name are required. Without address the XML leaves out PhysicalLocation and RegistrationAddress, both 0..1 for the buyer (Anexo 1.9 FAK07/FAK28); a sale outside the issuer's premises still needs it (FAK07).

lines
LineIn · object[]
required
Required array length: 1 - 500 elements
issue_datetime
string<date-time> | null

Issue instant with a UTC offset. Default: now, in Colombian time.

notes
string[]

Free-text legends printed on the document, such as the return policy, the warranty or "Gracias por su compra": one cbc:Note each, in order, 1-500 characters each, at most 20. They appear on the PDF and in the JSON record. Default: none.

Maximum array length: 20
Required string length: 1 - 500
Example:
observation
string | null

Factus's name for a single note, 1-500 characters: the same as notes with one item. Send notes or observation, not both.

Required string length: 1 - 500
Example:

"Gracias por su compra"

payment
InvoicePaymentIn · object | null

A single means of payment: the same as payments with one entry. Send payment or payments, not both.

payments
InvoicePaymentIn · object[] | null

Every means of payment used in the sale, in order: one cac:PaymentMeans each (Anexo 1.9 FAN01, 1..N), e.g. cash plus a card. Each credit (form 2) entry needs its due_date. At most 20. Send payment or payments, not both.

Required array length: 1 - 20 elements
Example:
prefix
string | null

Series (the prefix of the numbering range) to issue under. Default: the tenant's default range. The chosen range must exist for the tenant's DIAN environment; every series counts its numbers on its own.

Maximum string length: 4
Pattern: ^[A-Za-z0-9]*$
reference
string | null

Your own reference of the document (1-100 characters of A-Z a-z 0-9 . _ : -), unique per stage and document kind. Find the document by it with GET /v1/documents?reference=...&kind=..., e.g. after a create whose answer was lost. A create reusing a reference answers 409 reference_conflict, even with the same body, unless it is the replay of the same request through its Idempotency-Key; resolve it with that lookup.

Required string length: 1 - 100
Pattern: ^[A-Za-z0-9._:-]{1,100}$
Example:

"ORDER-2026-000123"

send
boolean
default:false

Also queue the invoice for sending to the DIAN right after it is stored, as POST /v1/invoices/{document_id}/send does. If queueing fails the invoice is still created and the response says send: not_queued.

send_email
boolean
default:true

Email the buyer after the DIAN accepts the document (default true, like Factus): a ZIP with the signed AttachedDocument and the PDF goes to the buyer's email, from no-reply@cufea.com under your company's name, answers to your company's email. Only in production: the sandbox and the DIAN test stage never email anyone (delivery.status skipped). Send false to deliver it yourself with GET .../email-content or POST .../send-email.

withholdings
WithholdingIn · object[]
Maximum array length: 3

Response

Successful Response

cufe
string
required

CUFE: 96 hexadecimal characters (SHA-384).

customer
CustomerOut · object
required

The buyer. Read from the signed XML, so it is exactly what the DIAN received. Amounts are decimal strings with 2 decimals.

delivery
Delivery · object
required

The email of the invoice to its buyer.

document_id
string
required

Prefix and number, e.g. SETP990000001.

issue_datetime
string<date-time>
required
lines
LineSummaryOut · object[]
required

The lines in order. Read from the signed XML, so it is exactly what the DIAN received. Amounts are decimal strings with 2 decimals.

number
integer
required
prefix
string
required
qr
QrOut · object
required
state
string
required

prepared until the document is sent; then the latest DIAN outcome (accepted, rejected, not_found...) or, before any answer, the last event (sent, send_failed...).

taxes
TaxAmountOut · object[]
required

Taxes per code and percent, ordered by code and percent, then the IVA-excluded entry when a line has no IVA. Read from the signed XML, so it is exactly what the DIAN received. Amounts are decimal strings with 2 decimals.

totals
DocumentTotals · object
required

Monetary totals. Read from the signed XML, so it is exactly what the DIAN received. Amounts are decimal strings with 2 decimals.

withholdings
TaxAmountOut · object[]
required

Withholdings per code and percent; empty on notes. Read from the signed XML, so it is exactly what the DIAN received. Amounts are decimal strings with 2 decimals.

xml_base64
string
required

The signed UBL XML, base64 encoded.

dian_errors
DianMessage · object[]

Rule messages of the latest DIAN answer.

dian_status_code
string | null

StatusCode of the latest DIAN answer, e.g. 00; none yet.

dian_status_description
string | null

StatusDescription of the latest DIAN answer.

kind
string
default:invoice

Always invoice.

Allowed value: "invoice"
notes
string[]

The document's cbc:Note legends as signed, in order (notes, or the observation, given on create); empty when none.

payments
PaymentOut · object[]

The means of payment as signed (cac:PaymentMeans), in order, with the amounts given on create. A single payment on create is one entry.

reference
string | null

The reference given on create; null when none was given.

send
enum<string> | null

Only when send was requested: queued, or not_queued if the job queue failed (send it with POST /v1/invoices/{document_id}/send).

Available options:
queued,
pending,
sent,
not_queued
sent_at
string<date-time> | null

When the DIAN last received the document; none if never.