Correcting or cancelling an issued invoice
An issued invoice is never edited in place. Four paths are available, each with a different fiscal trail.
| You want to… | Action | Result |
|---|---|---|
| Void the entire invoice | Cancel | The original becomes canceled and a cancellation record is submitted. |
| Correct the content of a delivered invoice | Rectify | A new R1–R5 corrective invoice linked to the original. |
| Replace one or more simplified F2 invoices | Replace | A new F3 replaces the F2 invoices. |
| Resubmit a record rejected because of submission data | Fix | Same number, submitted again with Subsanacion=S. |
Rectification is not correction of a rejected record
If the AEAT rejected the record because incorrect data was submitted, see Correcting rejected records. If the record is valid but the delivered invoice has a wrong amount or concept, issue a corrective invoice.
Cancellation
Cancellation is only for an invoice issued by mistake that should never have existed. It does not replace a corrective invoice.
curl -X POST https://api.test.bilteo.com/api/v1/invoices/{id}/actions/cancel \
-H "Authorization: Bearer bk_live_xxx"Requires invoices:cancel and an accepted latest Veri*Factu record. It creates a chained cancellation record and moves the invoice to canceled.
Corrective invoices R1-R5
POST /invoices/{id}/actions/rectify creates a draft corrective invoice linked to the issued invoice. You then review and issue it.
curl -X POST https://api.test.bilteo.com/api/v1/invoices/{id}/actions/rectify \
-H "Authorization: Bearer bk_live_xxx" -H "Content-Type: application/json" \
-d '{ "rectificative_type": "S", "rectification_cause": "law_error" }'rectificative_type controls how the correction is expressed:
S(replacement): corrected total amounts; replaces the original.I(differences): only the delta, negative when appropriate.
rectification_cause determines the R type:
| Origin | Cause | Result |
|---|---|---|
| F1 | law_error or art80_126 | R1 |
| F1 | art80_3 | R2 |
| F1 | art80_4 | R3 |
| F1 | other | R4 |
| F2 | simplified | R5 |
An F2 only accepts simplified; an F3 cannot be corrected directly; and a corrective invoice cannot itself be corrected. serie_id is optional when the original series is compatible; otherwise provide a rectified series.
Replacement invoices F2 to F3
When a customer requests a full invoice for a sale documented as F2:
curl -X POST https://api.test.bilteo.com/api/v1/invoices/{f2_id}/actions/replace \
-H "Authorization: Bearer bk_live_xxx" -H "Content-Type: application/json" \
-d '{ "partner_id": "…" }'Bilteo creates a draft F3, links it to the F2, and groups bases by tax combination. It inherits currency and economic activity; serie_id is optional. Requires invoices:replace_simplified.
With ?issue=true, the F3 is issued in the same request and invoices:issue is also required. The operation is atomic.
Replacing several F2 invoices
| Endpoint | Effect |
|---|---|
GET /invoices/{f3}/replaces | Lists the replaced F2 invoices. |
POST /invoices/{f3}/replaces | Adds an F2 and recalculates lines. |
DELETE /invoices/{f3}/replaces/{relation_id} | Removes an F2 and recalculates. |
Each replaced F2 moves to replaced.