Skip to main content

Invoice lifecycle

Every invoice carries a status that describes where it is in the issuing and reporting flow, driven by a state machine.

Status list

statusMeaning
draftsaved as a draft, not yet sent
queuedaccepted for sending, waiting to be transmitted
sendingbeing transmitted to AEAT
acceptedAEAT accepted the billing record
accepted_with_errorsAEAT registered the record but flagged issues to correct (subsanación)
rejectedAEAT rejected the record; it was not registered
failedAEAT returned a negative processing outcome (incidencia)
errorno usable response from AEAT (transport error, timeout, envelope fault)

When the status is not a clean accepted, errorReason carries a machine-readable detail (see the table below).

State machine

An invoice created directly with POST /invoices briefly enters at queued; one created as a draft enters at draft and moves to queued when you call POST /invoices/draft/{uuid}/send. Today, the sandbox resolves queuedsending → a terminal status synchronously within the same request — the 202 Accepted response already carries the final status (see Send invoice). Treat the intermediate states as part of the model rather than something you need to poll for today; still read status from the response rather than assuming accepted, since it can come back as any of the terminal values.

errorReason values

errorReasonEnds in statusWhat it means
INVALID_RECIPIENT_FISCAL_IDrejectedthe recipient NIF is not valid / not in the AEAT census
DUPLICATE_INVOICE_NUMBERrejecteda record with the same series+number already exists
SCHEMA_VALIDATION_FAILEDrejectedthe record failed AEAT schema validation
UNAUTHORIZED_RECIPIENTrejectedthe issuer is not allowed to invoice this recipient
PROCESSING_INCIDENTfailedAEAT reported a processing incidencia
FINGERPRINT_MISMATCHaccepted_with_errorsregistered, but the huella calculation was flagged
GATEWAY_TIMEOUTerrorno response received from AEAT
SUBMISSION_REJECTEDerrorthe submission envelope was rejected before processing

In the sandbox, each of these can be triggered on demand with a reserved recipient tax id.