Send the IRN and a reason code. The e-invoice is cancelled and you get the cancellation time back. It has to be done within 24 hours of generating the IRN, and not while a valid e-way bill exists for it.
Cost: 3 credits per successful call. A rejection or an upstream failure is never charged.
Every call accepts "test_mode": true and returns a sample in the live shape, free. Set up your API credentials before the first real call.
An IRN can be cancelled within 24 hours of its generation. It cannot be cancelled while a valid, active e-way bill exists for the same invoice, so cancel that e-way bill first.
cancel_reason is one digit: 1 Duplicate, 2 Data entry mistake, 3 Order Cancelled, 4 Others. cancel_remark is free text.
These are not the e-way bill cancellation numbers, where 2 means Order Cancelled and 3 means Data Entry mistake. Keep the two tables separate in your code.
If the e-invoice is already cancelled, the government network says the invoice is not active. This API treats that as a success for a cancel request, so repeating the call is safe.
| Field | Type | Required | Meaning |
|---|---|---|---|
| gstin | string | Yes | The GSTIN that issued the e-invoice. |
| einv_username | string | Yes | The e-invoice API username. gstin_username is still accepted. |
| password | string | Yes | The matching API password. Never stored. |
| irn | string | Yes | The IRN to cancel. |
| cancel_reason | string | No | 1 Duplicate, 2 Data entry mistake, 3 Order Cancelled, 4 Others. |
| cancel_remark | string | No | Free text. |
| test_mode | boolean | No | true returns a sample in the live shape: free, nothing is filed. |
Send your API key in the x-api-key header. Government API credentials are used for the one call and never stored.
The request below runs in test mode, so it is free and files nothing. Remove test_mode for a real call.
curl -X POST "https://www.gstinapi.in/v1/einvoice/cancel" \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{ "gstin": "24AAAAA0000A1Z5", "einv_username": "YOUR_EINV_API_USER", "password": "YOUR_EINV_API_PASSWORD", "irn": "35a1b2c3...", "cancel_reason": "2", "cancel_remark": "Wrong entry", "test_mode": true }'Response
{
"success": true,
"irn": "35a1b2c3...",
"cancel_date": "23/10/2026",
"billed_to": "paid",
"credits_remaining": 197
}Not affiliated with the Government of India. Rules are the government network's own and can change; if a page here looks out of date, tell us.