Skip to content

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 ​

StateMeaningEditable
draftDraft. Not yet a fiscal document.✅
issuedIssued: numbered, frozen and linked to a Veri*Factu record.❌
canceledCancelled (its cancellation record was generated).❌
replacedSimplified invoice (F2) replaced by a complete invoice (F3).❌
rectified_substCorrected by substitution (terminal).❌
rectified_diffCorrected by differences (remains active).❌
scheduledTemplate for an active recurrence (frozen draft).❌
needs_fixIssued 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:issue scope. 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:cancel scope. Requires a final AEAT response to the latest record (accepted, accepted_error or rejected). 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_simplified scope.
  • 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 to needs_fix only if no registration was ever accepted; otherwise it queues the correction directly and the invoice stays issued.

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.

Bilteo · Documentation