IRN Generation API

Generate Invoice Reference Numbers (IRNs) via the NIC Invoice Registration Portal. Returns the 64-char IRN, signed QR code, and signed JSON invoice.

Get sandbox keys → View OpenAPI docs Talk to sales

What is the IRN Generation API?

The IRN Generation API submits invoice JSON to the NIC Invoice Registration Portal and returns the IRN — a 64-character SHA-256 hash that uniquely identifies the invoice on the national e-Invoice register. Along with the IRN, NIC returns a signed QR code (containing key invoice fields) and the signed JSON (with NIC's digital signature).

WhiteBooks processes 30+ Crore IRNs annually for India's largest ERPs, SaaS platforms, and fintech invoice flows. p50 IRN response is 87ms; p95 is 312ms. The API validates payload locally before forwarding to catch ~92% of common NIC rejection causes.

Quick spec

Code examples

curl Node.jsPythonJava
curl -X POST 'https://apisandbox.whitebooks.in/einvoice/api/v1/irn/generate' \
  -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/generate', {
  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/generate',
    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/generate"))
    .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 input format?

NIC standard e-Invoice JSON schema v1.1 — invoice header, item lines, party details, tax breakup. We accept the official format and our extended fields for partial-success bulk handling.

How long is an IRN valid?

IRN is permanent (cannot be regenerated for the same invoice). It can be cancelled within 24 hours via the IRN Cancellation API.

What if NIC is down?

WhiteBooks queues the request and replays automatically once NIC is back. Subscribe to the invoice.upstream_resolved webhook for the final outcome.

Is bulk IRN supported?

Yes — up to 1,000 invoices per call via the Bulk IRN API. See /api/einvoice/bulk-irn-api.

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 Cancellation API → Bulk IRN Generation API (1,000/call) → Signed QR Code Retrieval API → Signed JSON Invoice API →