POST https://api.invunion.com/api/v1/invoices/:code/cancel invoices:write Markdown
Cancel an invoice that has not been settled.
Sets status to cancelled. Refused when live matches, credit-note allocations, or a non-zero settled_amount exist. Already cancelled invoices return 200 without changing the row. Identify the invoice with its `invoice_number`.
Path parameters
Name
Type
Required
code
Invoice number (`invoice_number`). Invoices without a number cannot be addressed by path.
Example: INV-2026-0042
string
Max 100
Required
Errors
This operation can return the following errors in addition to generic HTTP failures.
Error
HTTP code
Description
Missing Bearer token
401
The Authorization header is missing or is not a Bearer token.
Invalid or revoked API key
401
The API key is unknown, malformed, expired, or has been revoked.
API key is missing scope invoices:write
403
The key does not include invoices:write. A write scope does not imply the matching read scope.
Too many requests, please try again later
429
Wait and retry. The Retry-After header is the number of seconds to wait.
Tenant ID required
400
The authenticated credential is not bound to a tenant.
Invoice not found
404
No invoice with this number exists in the authenticated tenant.
This invoice has received payments or credit-note allocations. Unlink them or issue a credit note instead of cancelling.
409
Live matches, allocations, or settled_amount prevent cancel.
Internal server error
500
Unexpected server error. The JSON body includes correlationId. Retry with backoff.