Skip to main content
Send an Idempotency-Key header on every create and send.
  • Keys belong to the tenant and the stage of the API key. A sandbox key and a test key of the same tenant never see each other’s keys.
  • The same key with the same request (method, path and body) replays the stored answer with Idempotent-Replayed: true, and nothing is done again. The same key with a different request answers 422 idempotency_key_reused; while the first request is still running, 409 idempotency_in_progress.
  • Only a 2xx or a 422 that breaks an invoice rule is stored. A 5xx, or a 403, 404 or 409 you can fix by configuring the tenant, releases the key: retry with the same key.
  • A key is kept 24 hours from its first use. After that it is forgotten and the same key starts a new request.
After the 24 hours, do not resend a create: a create with a forgotten key is new, and would take another number. Give every document a reference and ask Cufea whether it exists:
An empty items is definitive: the document was never created and the create can be sent again. A create that reuses a reference answers 409 reference_conflict. POST /v1/invoices/{document_id}/send (and the note send route) is safe to repeat at any time, with or without a key: at most one send is queued per document, and the answer says queued, pending (a send already queued or running) or sent (the DIAN already has it).