Invoice lifecycle
An invoice moves through a well-defined state machine. Only drafts are editable; once issued, an invoice is frozen and enters the Veri*Factu chain.
States
| State | Meaning | Editable |
|---|---|---|
draft | Draft. Not yet a fiscal document. | ✅ |
issued | Issued: numbered, frozen and linked to a Veri*Factu record. | ❌ |
canceled | Cancelled (its cancellation record was generated). | ❌ |
replaced | Simplified invoice (F2) replaced by a complete invoice (F3). | ❌ |
rectified_subst | Corrected by substitution (terminal). | ❌ |
rectified_diff | Corrected by differences (remains active). | ❌ |
scheduled | Template for an active recurrence (frozen draft). | ❌ |
needs_fix | Issued invoice reopened to fix a rejected record that was never accepted. | ✅ |
needs_fix is a real document
It keeps its number and Veri*Factu records (it can be printed and is protected from deletion), but is temporarily reopened to correct the error rejected by the AEAT.
Actions
draft ──issue──▶ issued ──cancel──▶ canceled
│
├─ rectify ─▶ (new R1–R5 corrective invoice; the original becomes
│ rectified_subst | rectified_diff)
├─ replace ─▶ (new F3; the original F2 becomes replaced)
└─ request-fix ─▶ needs_fix ──issue──▶ issued (correction)
└──abandon-fix──▶ issued (not submitted)- Issue —
POST /invoices/{id}/actions/issue·invoices:issuescope. Assigns a number, freezes amounts (using the exchange rate on the issue date) and submits the record to the AEAT. - Cancel —
POST /invoices/{id}/actions/cancel·invoices:cancelscope. Requires a final AEAT response to the latest record (accepted,accepted_errororrejected). This is an uncommon operation, only for invoices issued by mistake; correct a valid invoice with a corrective invoice instead. - Rectify —
POST /invoices/{id}/actions/rectify. Creates an R1–R5 corrective invoice by differences (I) or substitution (S). Use it to correct the fiscal content of an issued invoice. - Replace (F2 → F3) —
POST /invoices/{id}/actions/replace·invoices:replace_simplifiedscope. - Correct a record —
request-fix/abandon-fix. An exceptional, uncommon operation used only to correct a Veri*Factu record with a final response after a submission error, not to change fiscal content. Reopens toneeds_fixonly if no registration was ever accepted; otherwise it queues the correction directly and the invoice staysissued.
Rectifying is not fixing a rejected record
If the AEAT rejects an invoice because of incorrect fiscal data that you have already given to the customer, issue a corrective invoice. The rejected record flow is only for technical or integration submission errors.