beel_create_corrective_invoice
Issue a corrective invoice to amend an existing Spanish invoice, with TOTAL or PARTIAL rectification, ensuring AEAT VeriFactu compliance.
Instructions
Issues a corrective invoice that amends the invoice in the path. It is a new fiscal
document with its own number, not an edit of the original. A TOTAL rectification leaves
the original VOIDED; a PARTIAL one leaves it RECTIFIED and requires the adjustment
lines, while TOTAL copies the original lines negated when they are omitted.
Only an ordinary or a simplified invoice in ISSUED, SENT, PAID, OVERDUE or
RECTIFIED can be rectified. Rectifying a corrective fails with
422 CORRECTIVE_NOT_RECTIFIABLE — to fix an erroneous corrective, issue another one
against the original invoice. A VOIDED invoice is no longer rectifiable, so a second
TOTAL against the same invoice fails with
422 INVOICE_NOT_CORRECTIBLE_IN_CURRENT_STATUS; several PARTIAL correctives are allowed.
Omitting series_id numbers the document in the company's default corrective series, never
in the series of the original, which is an ordinary or simplified one. That default is
never created for you: if the company has none, the request fails with
422 SERIES_DEFAULT_NOT_FOUND; GET /v1/configuration/series/defaults-status reports
which default is missing.
Endpoint: POST /v1/companies/{company_id}/invoices/{invoice_id}/corrective
⚠️ Fiscal guardrails — read before calling:
Choosing wrong here misreports to AEAT. The 30-second decision. (resource: beel://guardrails/cancel-vs-rectify)
How BeeL derives the AEAT invoice type, and the rules each type imposes. (resource: beel://guardrails/invoice-types)
How a line states its price, and which field combinations are rejected. (resource: beel://guardrails/invoice-lines)
When an invoice can still be changed, and what to do once it cannot. (resource: beel://guardrails/invoice-state-machine)
How invoice numbers are formed, and why numbering can never be rewritten. (resource: beel://guardrails/series-and-numbering)
For the exhaustive rules and worked examples, call beel_docs_search.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | ||
| company_id | Yes | NIF (company) the operation acts on. It is the only source of context: the account that owns it is derived from it, and the `BeeL-Active-Company` header plays no part. A NIF you do not reach answers `403`, and so does a NIF that does not exist, so the existence of a NIF in another account is never disclosed. | |
| invoice_id | Yes | Invoice ID | |
| idempotency_key | No | Optional idempotency key for this operation. Omit it and one is derived from the request itself, which makes a blind retry safe but also collapses a SECOND, deliberately identical operation into the first for 24 hours. Set it — to an order id, or anything unique per intended operation — whenever you mean to create something that may look identical to what you just created. |