Harun Raaj & AssociatesHarun Raaj & Associates
e-invoice

IRN Generation: ICP API, JSON Schema and Common Errors on the E-Invoice Portal

An Invoice Reference Number (IRN) is a 64-character SHA-256 hash of GSTIN + financial year + document type + document number, returned by an Invoice Registration Portal after your invoice JSON is validated. Generation takes four steps: build JSON, upload via ICP API or portal, IRP validates, and the signed e-invoice with QR code returns.

HR

HRA Research Desk

Chartered Accountant · Harun Raaj & Associates

An Invoice Reference Number (IRN) is a 64-character SHA-256 hash generated from your GSTIN, financial year, document type and document number — returned by an Invoice Registration Portal (IRP) after it validates your invoice JSON. Generation takes four steps: prepare the JSON in the notified INV-01 schema, upload it through the IRP integration (ICP API) or portal, let the IRP validate and digitally sign it, then receive the e-invoice carrying the IRN and QR code. An invoice without an IRN is not an invoice for GST purposes.

What the law actually requires

Rule 48(4) of the CGST Rules 2017 requires covered taxpayers to report invoice data to an IRP before issuing the invoice. Rule 48(5) is the provision that gives IRN generation its urgency: an invoice required to be reported under Rule 48(4) that is not so reported shall not be treated as an invoice at all. The IRN is the proof that the document legally exists in the GST system. Once generated, the IRN and the digitally signed QR code must be printed on the physical invoice issued to the buyer — Rule 46(r) of the CGST Rules separately obliges you to print the QR code.

The IRN hash: what goes in

The IRP computes the IRN as a SHA-256 hash of four concatenated inputs:

InputExample
Supplier GSTIN29ABCDE1234F1Z5
Financial year2026-27
Document typeINV (invoice), CRN (credit note), DBN (debit note)
Document numberINV-2026-001

The hash is output as a 64-character hexadecimal string (32 bytes). Because the same four inputs always produce the same hash, the IRN is deterministic: generating the same invoice twice would produce the same IRN, which is exactly how the system detects duplicates. The document number must therefore be unique within the financial year — re-use a number and the IRP rejects the duplicate.

How IRN generation actually works — four steps

  • Prepare the invoice JSON in the notified INV-01 schema — supplier and recipient GSTINs, invoice number, date, document type, line items with HSN/SAC, tax values, place of supply, and other mandatory fields. The schema is strict: a missing field fails validation.
  • Upload to an IRP — through the IRP's integration API (the ICP channel), a GST Suvidha Provider, the bulk-generation offline utility, or the portal's manual entry screen. API integration is the only realistic route for any company issuing more than a few hundred invoices a month.
  • IRP validates and signs — the IRP checks the schema, verifies the supplier and recipient GSTINs against the GSTN master, computes the IRN, generates the QR code, and digitally signs the payload.
  • Receive the signed e-invoice — the IRP returns the full e-invoice with the IRN, the signed QR code, the IRP's GSTIN, and a timestamp. This returned JSON is what you store and print.

The practical rule for the accounts team: the e-invoice is not a document you produce — it is a document the IRP returns. Your billing system must capture the returned IRN and QR code and attach them to the invoice record before the invoice is issued to the customer.

Worked example: Rohan Fabricators Pvt Ltd generates one IRN

Rohan Fabricators Pvt Ltd, GSTIN 29ABCRF1234F1Z5, issues a B2B invoice in FY 2026-27.

FieldValue
Document typeINV
Invoice numberRF/2026-27/0418
Financial year2026-27
Supplier GSTIN29ABCRF1234F1Z5
Recipient GSTIN27ABCDE5678G1K2
Invoice value₹4,50,000
CGST + SGST (18%)₹40,500 + ₹40,500

The IRP takes the four hash inputs (29ABCRF1234F1Z5 + 2026-27 + INV + RF/2026-27/0418), runs SHA-256, and returns a 64-character hex IRN and a signed QR code. Rohan stores the returned JSON, prints the QR code on the PDF, and hands the invoice to the customer. If a staff member re-uses invoice number RF/2026-27/0418 later that year, the IRP returns a duplicate error — the number is permanently burned.

Common IRP errors and what they mean

Error on the portal / APIWhat it actually means
Supplier GSTIN not foundThe GSTIN is not active, is cancelled, or does not match the IRP registration. Check GSTIN status on the GSTN portal.
Recipient GSTIN not found / not activeThe buyer's GSTIN is cancelled or wrongly keyed. A typo in one character fails validation.
Duplicate IRN / invoice already registeredThe same document number for the same FY was already reported. Do not re-generate — retrieve the existing IRN.
Invalid HSN / SACThe code has the wrong number of digits or is not a valid code for the supply.
Supply type mismatchThe transaction category (B2B, B2C, SEZ, export) conflicts with the GSTINs or other fields in the payload.
Schema validation errorA mandatory field is missing or has an invalid format (date, amount, GSTIN structure).

A rejected payload is not a fine — it is a workflow failure. The invoice cannot be issued until the payload passes, and if you are above ₹10 crore aggregate turnover, the 30-day reporting window (from 1 April 2025) means a rejected invoice that sits unfixed past the window can never be registered at all. Build error handling into the billing flow, not into the month-end close.

What a director should actually watch

  • Choose the API path, not the manual portal, above a few hundred invoices a month. Manual entry is where GSTIN typos and document-number collisions live.
  • Make document numbers unique per financial year and never re-use them. Duplicate-IRN errors are the most common self-inflicted failure.
  • Store the returned IRP JSON, not just the IRN string. You need the signed payload and QR code for audit trail and for the physical invoice.
  • Reconcile the IRN register to your billing software daily. Any invoice in your books without a returned IRN is a Rule 48(5) problem in the making.
Changed FY 2025-26: Since 1 April 2025, taxpayers with aggregate turnover of ₹10 crore or more cannot report an invoice to an IRP more than 30 days after the document date — the IRP rejects it outright with no condonation. This converts any billing backlog into permanently unregisterable documents.

FAQ

What exactly is an IRN?
An Invoice Reference Number — a 64-character SHA-256 hash of your GSTIN + financial year + document type + document number. It is the unique fingerprint that tells the GST system an invoice exists.

Do I generate the IRN or does the government?
You report the invoice JSON; the IRP computes the IRN, signs the document and returns it. You never see or construct the IRN yourself.

Can two invoices ever share an IRN?
No. Same GSTIN + FY + document type + document number produces the same hash — which is how the system detects a duplicate. Change any input and the hash changes.

Which IRP should we use?
There are multiple IRPs. You integrate with one (directly, or through a GSP) and its returned IRN is accepted network-wide. There is no requirement to use more than one.

What happens if the IRP rejects our invoice JSON?
The document is not registered and you cannot issue it as a valid e-invoice. Fix the schema error and resubmit. If the 30-day window (for ₹10 crore-plus taxpayers) has passed, the document cannot be registered at all.

Is the QR code optional on the printed invoice?
No. Rule 46(r) requires the QR code on the invoice issued to the buyer. Generating the IRN but printing a PDF without the QR code is still a defective invoice.

Test whether your turnover history requires e-invoicing at all: /tools/e-invoice-applicability-checker. For a GST compliance audit of your company, visit pvtltd.co.

Sources

  • Rule 48(4), Rule 48(5), Rule 46(r) CGST Rules 2017
  • INV-01 e-invoice schema (IRP/GSTN published schema)
  • IRP API / integration channel documentation (GSTN IRP, NIC IRP, IRIS IRP)
  • 30-day reporting window — effective 1 April 2025 for aggregate turnover ≥ ₹10 crore
-: current IRP endpoints and schema version in force at publication

---

See Also

Topics:e-invoiceirngst-api

Need help with this?

Our team handles the paperwork. You focus on your business.