All e-way bill and e-invoice API calls

Cancel an e-invoice (IRN)

POST /v1/einvoice/cancel

Short answer

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.

The rules

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.

Reason codes

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.

Repeating a cancellation

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.

Request fields

FieldTypeRequiredMeaning
gstinstringYesThe GSTIN that issued the e-invoice.
einv_usernamestringYesThe e-invoice API username. gstin_username is still accepted.
passwordstringYesThe matching API password. Never stored.
irnstringYesThe IRN to cancel.
cancel_reasonstringNo1 Duplicate, 2 Data entry mistake, 3 Order Cancelled, 4 Others.
cancel_remarkstringNoFree text.
test_modebooleanNotrue 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.

Example

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
}

Questions

What do I do after the 24 hours?
The IRN can no longer be cancelled. The invoice has to be corrected with a credit note instead; that is an accounting step, not an API call on this page.

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.