Cancel an invoice
Scope: sales:invoices.write https://api.alladdin.com/api/v2/invoices/{invoiceId}/cancel
Cancels a sales invoice, preventing further edits or payments. Returns 200 on success and 422 when the invoice state does not allow cancellation (e.g. already paid or voided). Use when the user asks to cancel or void an invoice, or says "quiero anular esta factura" or "cancelar factura".
Parameters
Path parameters
invoiceId string required
Invoice ID (24-char hex ObjectId)
Request
import requests
url = "https://api.alladdin.com/api/v2/invoices/{invoiceId}/cancel"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
response = requests.post(url, headers=headers)
print(response.json())Responses
Success responses
200 Invoice cancelled
Error responses
400 Bad request application/json 401 Invalid or missing API key application/json 403 Insufficient permissions application/json 422 Unable to cancel invoice application/json 429 Rate limit exceeded application/json
