Cancel sales invoice

Cancels a submitted sales invoice and reverses its ledger entries.

POST https://cotlet.dev/api/v1/erpnext/sales-invoice/cancel

write Confirm

Moves a submitted Sales Invoice to cancelled (docstatus 2) and reverses its ledger effects. ERPNext's guide says to handle linked payments, returns and stock transactions first; the call returns ERPNext's error if something still links to the invoice. A cancelled invoice cannot be edited, so create a new draft to replace it. By default you confirm each call; you can switch that off for this tool.

Parameters

Parameters: cancel_sales_invoice
NameTypeDescription
invoice string required string Sales Invoice ID from list_sales_invoices or create_sales_invoice.

Request

cURL
curl -X POST https://cotlet.dev/api/v1/erpnext/sales-invoice/cancel \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"invoice":"invoice"}'
Python
result = client.call("erpnext", "cancel_sales_invoice", {"invoice":"invoice"})
Node.js
const result = await cotlet.call('erpnext', 'cancel_sales_invoice', {"invoice":"invoice"});
CLI
cotlet call erpnext cancel_sales_invoice --data '{"invoice":"invoice"}'

Example response

JSON

{
  "invoice": "ACC-SINV-2026-00042",
  "status": "Cancelled",
  "docstatus": 2
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.