> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cufea.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delivery to the buyer

> How Cufea emails the accepted document to the buyer, and how to turn it off.

A document is expedida only once it is validated by the DIAN **and** delivered to the buyer
(ET art. 616-1). Cufea delivers it by email, like Factus does.

* **When.** After the DIAN accepts an invoice or a note, a worker emails the buyer's `email`
  (the customer's e-mail of the document) once. Production only: the sandbox and the DIAN test
  stage never email anyone, and the delivery is recorded `skipped`
  (`stage_not_production`).
* **What.** One ZIP holding the signed AttachedDocument (`ad...xml`) and the PDF
  representación gráfica (`ad...pdf`), at most 2 MB; the subject is
  `NIT; company name; number; document type; trade name`, as Anexo 1.9 §9.1 prescribes.
* **From whom.** From `no-reply@cufea.com` with your company's name as the sender name;
  replies go to your company's e-mail. The body says your company is the facturador
  electrónico and Cufea the software it used.
* **Turn it off** with `"send_email": false` on `POST /v1/invoices` or `POST /v1/notes`, and
  deliver it yourself: `GET .../email-content` returns the subject and the ZIP (base64),
  `GET .../pdf` the PDF alone, in every stage.
* **Send it again, or to another address,** with `POST .../send-email`
  `{"email": "...", "pdf_base64": "..."}` (your own PDF is optional and replaces Cufea's in
  the ZIP; it must carry the QR code of Anexo 1.9 §11.7). It sends at once and answers the
  new `delivery`; `502 email_unavailable` means nothing was sent. Production only:
  `409 email_unavailable_in_stage` elsewhere.
* **Follow it** in the document's `delivery`: `status` is `pending`, `sent`, `failed` or
  `skipped`, with a `reason` (`awaiting_acceptance`, `no_recipient`,
  `send_email_disabled`, `email_rejected`...). A provider outage is retried after 1, 5 and 15
  min, 1 h and 4 h (`pending`, `email_unavailable`) before it is `failed`. The webhooks
  `invoice.delivered`, `invoice.delivery_failed`, `note.delivered` and
  `note.delivery_failed` report `sent` and `failed`.

The paths are `/v1/invoices/{document_id}/pdf|email-content|send-email` and
`/v1/notes/{credit|debit}/{document_id}/pdf|email-content|send-email`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.