beel_create_corrective_invoice
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.
rectification_type:TOTALleaves the originalVOIDEDand copies its lines negated whenlinesis omitted.PARTIALleaves the originalRECTIFIEDand requires the adjustmentlines.What can be rectified: an ordinary or simplified invoice in
ISSUED,SENT,PAID,OVERDUEorRECTIFIED. Rectifying a corrective fails with422 CORRECTIVE_NOT_RECTIFIABLE— to fix an erroneous corrective, issue another one against the original invoice.Repeat rectifications: several
PARTIALcorrectives are allowed, but aVOIDEDinvoice is no longer rectifiable, so a secondTOTALagainst the same invoice fails with422 INVOICE_NOT_CORRECTIBLE_IN_CURRENT_STATUS.series_id: when omitted, the document is numbered in the company's default corrective series, never in the series of the original. That default is never created for you: if the company has none the request fails with422 SERIES_DEFAULT_NOT_FOUND, andGET /v1/configuration/series/defaults-statusreports 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 | Unique identifier (UUID) of the company the operation acts on — its identifier, not its NIF. 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 company you do not reach answers `403`, and so does a company that does not exist, so the existence of a company 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. |