# SDI lifecycle (https://docs.getbeel.com/en/api/sdi-lifecycle)

The statuses of an issued invoice, what each SDI outcome means and what to do.

An issued invoice moves through a few statuses, always forward. The status tells you whether the invoice **is issued**: something to know before you send it again, because an issued invoice is never resent.

## Statuses [#statuses]

| `status`        | Meaning                                                                              | Issued?       |
| --------------- | ------------------------------------------------------------------------------------ | ------------- |
| `draft`         | Draft, editable                                                                      | No            |
| `sending`       | The XML is being prepared and the send is queued (live keys only)                    | No, not yet   |
| `sent`          | Transmitted to SDI, waiting for the outcome (minutes, up to 5 days)                  | Pending       |
| `delivered`     | Ricevuta di consegna (RC)                                                            | **Yes**       |
| `not_delivered` | Ricevuta di impossibilità di recapito (MC): it is in the customer's cassetto fiscale | **Yes**       |
| `rejected`      | Ricevuta di scarto (NS)                                                              | **No**, never |

```text
draft → sending → sent → not_delivered → delivered → rejected
```

Transitions only move forward, in this order. A receipt that arrives late or twice never moves an invoice back: a `sent` that arrives after a `delivered` is ignored. `not_delivered` can still become `delivered`, and a delivered invoice can still become `rejected` when a public administration refuses it. SDI dates without a time zone are read as Italian time (Europe/Rome).

With a test key, `POST /invoices/{id}/send` answers at once with `sent` and the outcome follows a few seconds later from the [sandbox](/en/api/sandbox). With a live key it answers `202` with `sending`.

## Each outcome [#each-outcome]

### Delivered (RC) → `delivered` [#delivered-rc--delivered]

SDI delivered the invoice to the customer's indirizzo telematico. The invoice is issued and the VAT becomes chargeable on the invoice date.

### Not delivered (MC) → `not_delivered` [#not-delivered-mc--not_delivered]

SDI ran its checks but could not deliver the file: the customer's channel was not active, or the codice destinatario was `0000000` with no registered address. It put the invoice in the customer's reserved area in "Fatture e Corrispettivi" (the cassetto fiscale), from the date in `sdi.available_since`.

![A not delivered invoice (MC): it counts as issued, is in the cassetto fiscale from the date shown and must not be sent again.](/screenshots/invoice-not-delivered.en.webp)

- **The invoice is issued.** Do not send it again: SDI would reject the copy as a duplicate (`00404`).
- Tell the customer another way (email, phone) that it is in their reserved area; for them the VAT is deductible from when they view it. An email courtesy copy ([`POST /invoices/{id}/email`](/en/api/invoice-collection)) helps.
- For the next invoices, ask for their codice destinatario or PEC.
- For an autofattura (TD16–TD19) the recipient is your own company: you find it in your cassetto fiscale. To receive them directly, register an indirizzo telematico in "Fatture e Corrispettivi" (see [codice destinatario](/en/guide/codice-destinatario)).

### Rejected (NS) → `rejected` [#rejected-ns--rejected]

One or more SDI checks failed. **The invoice counts as never issued.**

![An invoice rejected by SDI: the error code, its description, the resend rule and the Correct and resend button.](/screenshots/invoice-rejected.en.webp)

- `sdi.errors` lists the codes with SDI's description; `sdi.error_codes` only the codes. What each code means and how to fix it: [SDI rejection codes](/en/api/reference-data/sdi-errors).
- Correct it and send it again **with the same number and date**, preferably within 5 days of the rejection. The new submission has a new file name, and SDI does not treat it as a duplicate because the first one was rejected.
- Reopen, correct, resend:
  1. `POST /invoices/{id}/reopen` puts it back to `draft` with the same number and date (in the app: **Correct and resend**; in MCP: `reopen_rejected_invoice`). `sdi.errors` stays on it until it is sent again.
  2. `PATCH /invoices/{id}` fixes what `sdi.errors` says ([Invoicing](/en/api/invoicing#edit-a-draft); MCP `update_invoice_draft`).
  3. `POST /invoices/{id}/send` sends it again, with an `Idempotency-Key` so a retry does not count twice.

  Any other status answers `409 invoice_not_rejected`. Test keys reopen sandbox rejections the same way.

```bash
curl -X POST https://www.getbeel.com/api/v1/invoices/$INVOICE/reopen \
  -H "Authorization: Bearer $GETBEEL_API_KEY"
curl -X PATCH https://www.getbeel.com/api/v1/invoices/$INVOICE \
  -H "Authorization: Bearer $GETBEEL_API_KEY" -H "Content-Type: application/json" \
  -d '{"customer": {"denominazione": "Rossi S.r.l.", "partita_iva": "01234567890", "codice_destinatario": "M5UXCR1", "address": "Via Roma 1", "postal_code": "20121", "city": "Milano", "province": "MI"}}'
curl -X POST https://www.getbeel.com/api/v1/invoices/$INVOICE/send \
  -H "Authorization: Bearer $GETBEEL_API_KEY" -H "Idempotency-Key: $(uuidgen)"
```

- A public administration's refusal after delivery (notifica di esito) also shows as `rejected` today, but it is not an SDI rejection: the invoice had been delivered. Do not apply the resend rule then; ask your accountant how to correct it.
- For live invoices, getbeel may try to fix the XML itself and resend it (at most 3 times): the invoice goes back to `sent` with a new submission, or back to draft for a manual fix.

### Duplicate of an issued invoice (`00404` on a sent invoice) [#duplicate-of-an-issued-invoice-00404-on-a-sent-invoice]

SDI rejects with `00404` ("Fattura duplicata") a file with the same supplier, year and number as a document it already accepted. When this happens to an invoice that was sent, SDI **already accepted an earlier copy: the invoice is issued**.

![An invoice rejected as a duplicate (00404) of an accepted copy: it counts as already issued and stays locked.](/screenshots/invoice-duplicate.en.webp)

- getbeel does not move it to `rejected`: it stays `sent` (or whatever status it had), with `00404` in `sdi.error_codes` and `sdi.errors`. No webhook event.
- **Do not regenerate or resend it**: every new submission would be rejected with `00404` again.
- Support links the accepted submission. In the VAT registers the document counts as issued, flagged for review (`needs_review`).

For autofatture TD16–TD20, TD22, TD23, TD28 and TD29 the uniqueness check is made on the cessionario (your company).

### Pending → `sent` [#pending--sent]

SDI has the file and has not answered yet. Checks and delivery take from a few minutes up to 5 days when SDI is very busy. Do not resend a `sent` invoice: wait for the outcome.

## What the web app, API and MCP show [#what-the-web-app-api-and-mcp-show]

| Outcome                   | Web (badge)                           | API `status` and `sdi`                   | MCP (`get_invoice`, `list_invoices`)        | Webhook                 |
| ------------------------- | ------------------------------------- | ---------------------------------------- | ------------------------------------------- | ----------------------- |
| Being prepared            | Sending to SDI...                     | `sending`                                | The same JSON as the API                    | —                       |
| Pending                   | Sent to SDI                           | `sent`                                   | As the API                                  | `invoice.sent`          |
| RC                        | Delivered                             | `delivered`                              | As the API                                  | `invoice.delivered`     |
| MC                        | Issued · in cassetto fiscale          | `not_delivered`, `sdi.available_since`   | As the API: "issued, never resend"          | `invoice.not_delivered` |
| NS                        | Rejected, with **Correct and resend** | `rejected`, `sdi.errors`                 | As the API: "fix sdi.errors and resend"     | `invoice.rejected`      |
| `00404` on a sent invoice | Already issued · duplicate (locked)   | `sent` with `00404` in `sdi.error_codes` | As the API: "already issued, do not resend" | —                       |

![The issued invoices list with each invoice's SDI status: draft, sent, delivered, issued in cassetto fiscale, rejected, already issued (duplicate).](/screenshots/issued-invoices.en.webp)

- **Web.** The invoice detail explains the outcome with the official sources: for MC the date it was made available and "Do not send it again"; for NS the codes with their description and the resend rule; for `00404` "Already issued: SDI holds an accepted copy".
- **API.** `GET /invoices/{id}` and `GET /invoices?status=…` (see the [reference](/en/api/reference)).
- **MCP.** The `list_invoices` and `get_invoice` tools return the same JSON, and their descriptions explain every status to the assistant, so it never offers to resend an issued invoice. Example: [MCP server](/en/api/mcp#examples).

## Webhooks [#webhooks]

Every status change sends an [event](/en/api/webhooks) with the full invoice in `data.object`:

| Event                   | New status      |
| ----------------------- | --------------- |
| `invoice.sent`          | `sent`          |
| `invoice.delivered`     | `delivered`     |
| `invoice.not_delivered` | `not_delivered` |
| `invoice.rejected`      | `rejected`      |

One event per transition: a duplicate or late receipt does not produce another. A `00404` on an issued invoice changes no status and sends no event. Read the invoice again with `GET /invoices/{id}` when you need its current state.

## Sending twice never creates a duplicate [#sending-twice-never-creates-a-duplicate]

- **`Idempotency-Key`.** Repeating `POST /invoices/{id}/send` with the same key returns the first response without a second send ([Idempotency](/en/api/idempotency)).
- **One send per draft.** A send claims the draft atomically: a second request, even without a key, gets `409 invoice_send_in_progress` or `409 invoice_not_draft` before any call to SDI.
- **Ambiguous outcomes.** When a send ends without a clear answer (timeout, 5xx, network error), getbeel looks the document up at the transmission channel before trying again: if SDI already received it, getbeel records its identifier instead of sending it again.
- Autofatture follow the same rule: a send claims the document atomically, and the channel is looked up only after an ambiguous outcome.

## Sources [#sources]

- Agenzia delle Entrate, [La fattura elettronica e i servizi gratuiti](https://www.agenziaentrate.gov.it/portale/documents/d/guest/guida_fattura_elettronica_dicembre_2025), December 2025: p. 16 (SDI checks, duplicates, up to 5 days), p. 17 (ricevuta di scarto, resend with the same date and number and a new file name; ricevuta di consegna), p. 18 (impossibilità di recapito, date made available, issued for the supplier, a rejection means never issued), pp. 19–20 (registering the indirizzo telematico).
- Agenzia delle Entrate, [circolare 13/E of 2 July 2018](https://www.agenziaentrate.gov.it/portale/documents/20143/297470/Circolare+n+13+del+02+luglio+2018_Circolare_13_02072018.pdf/da0b0db7-64eb-ac7b-c925-4fdbc776279d), § 1.6, pp. 11–12: a rejected invoice should preferably be sent again within five days of the rejection, with the original date and number.
- Agenzia delle Entrate, [Allegato A, Specifiche tecniche version 1.9.1](https://www.agenziaentrate.gov.it/portale/documents/d/guest/allegato-a-specifiche-tecniche-vers-1-9-1) (31 March 2026), Appendix 1, "Verifiche di unicità della fattura", pp. 122–123: codes `00404` and `00409`, check on the cessionario for TD16–TD20, TD22, TD23, TD28, TD29.
- [fatturapa.gov.it, SDI documentation](https://www.fatturapa.gov.it/it/norme-e-regole/DocumentazioneSDI/): technical specifications and list of checks.
