IRN Cancellation API

Cancel a previously-generated IRN within the 24-hour cancellation window. Returns the cancelled invoice acknowledgment from NIC.

Get sandbox keys → View OpenAPI docs Talk to sales

What is the IRN Cancellation API?

The IRN Cancellation API submits a cancellation request for a previously-generated IRN to NIC. NIC permits cancellation within 24 hours of IRN generation. After 24 hours, the only path is a credit note via a fresh IRN.

The API requires the original IRN, cancellation reason (one of NIC's standard codes: 1=duplicate, 2=data entry mistake, 3=order cancellation, 4=other), and an optional remarks field. WhiteBooks tracks cancellation eligibility per IRN and surfaces a clear error if the window has elapsed.

Quick spec

Code examples

curl Node.jsPythonJava
curl -X POST 'https://apisandbox.whitebooks.in/einvoice/api/v1/irn/cancel' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{ /* payload */ }'
Node.js
const res = await fetch('https://apisandbox.whitebooks.in/einvoice/api/v1/irn/cancel', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + accessToken,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(payload),
});
const data = await res.json();
Python
import requests

resp = requests.post(
    'https://apisandbox.whitebooks.in/einvoice/api/v1/irn/cancel',
    headers={'Authorization': f'Bearer {access_token}'},
    json=payload,
)
data = resp.json()
Java
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://apisandbox.whitebooks.in/einvoice/api/v1/irn/cancel"))
    .header("Authorization", "Bearer " + accessToken)
    .header("Content-Type", "application/json")
    .post(BodyPublishers.ofString(payload))
    .build();
HttpResponse<String> resp = HttpClient.newHttpClient()
    .send(req, BodyHandlers.ofString());

Integrate in 3 steps

  1. Sign up at accounts.whitebooks.in — sandbox credentials issued instantly, no sales gate.
  2. Make your first call against the sandbox base URL using the code example above. Validate against your local model.
  3. Move to production once your tests pass — switch host to https://api.whitebooks.in/einvoice. Same payload, same response shape.

Frequently asked questions

What's the cancellation window?

24 hours from IRN generation timestamp. Outside the window, NIC rejects with a clear error code.

What are valid cancellation reasons?

Code 1: Duplicate · Code 2: Data entry mistake · Code 3: Order cancellation · Code 4: Other. Free-text remarks supported in addition.

Can a cancelled IRN be regenerated?

No. The original invoice cannot have a new IRN. Use a credit note + fresh invoice flow instead.

How do I check cancellation eligibility?

Call GET /api/v1/irn/{irn}/status — returns is_cancellable=true|false with remaining_window_seconds.

Explore the full e-Invoice API

This is one endpoint inside the WhiteBooks e-Invoice API suite. See the full documentation — every endpoint, every parameter, every error code.

Open the e-Invoice API page →

Related e-Invoice API endpoints

IRN Generation API → Bulk IRN Generation API (1,000/call) → Signed QR Code Retrieval API → Signed JSON Invoice API →