Under India's GST e-invoicing rules, businesses above the turnover threshold report each B2B invoice to the Invoice Registration Portal (IRP) as JSON. The IRP validates it and returns an IRN and a signed QR code that must appear on the invoice.
This guide walks through the JSON field by field. The full sample is in the GST e-Invoice template.
The schema is versioned by GSTN/NIC. This guide follows version 1.1. Always check the current schema and validation rules on the official e-invoice portal before going live.
The overall structure
{
"Version": "1.1",
"TranDtls": { },
"DocDtls": { },
"SellerDtls": { },
"BuyerDtls": { },
"ItemList": [ ],
"ValDtls": { },
"EwbDtls": { }
}
Optional sections not shown: DispDtls (dispatch from), ShipDtls (ship to), PayDtls, RefDtls, AddlDocDtls and ExpDtls (exports).
TranDtls: transaction details
"TranDtls": { "TaxSch": "GST", "SupTyp": "B2B", "RegRev": "N", "IgstOnIntra": "N" }
| Field | Meaning |
|---|---|
TaxSch | Always "GST" |
SupTyp | B2B, SEZWP / SEZWOP (SEZ with / without payment), EXPWP / EXPWOP (export), DEXP (deemed export) |
RegRev | "Y" if reverse charge applies |
IgstOnIntra | "Y" if IGST applies even though seller and buyer are in the same state |
DocDtls: document details
"DocDtls": { "Typ": "INV", "No": "ACME/2026/0142", "Dt": "21/11/2026" }
Typ:INV(invoice),CRN(credit note) orDBN(debit note).No: up to 16 characters; letters, digits,/and-; cannot start with0,/or-. Must be unique for the seller in the financial year.Dt: dd/mm/yyyy as a string.
SellerDtls and BuyerDtls
"SellerDtls": {
"Gstin": "29AABCA1234A1Z5", "LglNm": "Acme Technologies Private Limited",
"Addr1": "12 MG Road", "Loc": "Bengaluru", "Pin": 560001, "Stcd": "29"
},
"BuyerDtls": {
"Gstin": "27AABCB5678B1Z3", "LglNm": "Bluebird Retail LLP", "Pos": "27",
"Addr1": "4th Floor, Nariman Point", "Loc": "Mumbai", "Pin": 400021, "Stcd": "27"
}
Pinis a number;StcdandPosare two-digit strings (state codes: 27 Maharashtra, 29 Karnataka, 07 Delhi, 33 Tamil Nadu, and so on).Posis the place of supply. It decides IGST vs CGST+SGST.- For exports, the buyer
Gstinis"URP"(unregistered person) andPosis"96"(other country).
ItemList: line items
{
"SlNo": "1", "PrdDesc": "Laptop 14-inch", "IsServc": "N", "HsnCd": "847130",
"Qty": 10, "Unit": "NOS", "UnitPrice": 1000,
"TotAmt": 10000, "Discount": 0, "AssAmt": 10000,
"GstRt": 18, "IgstAmt": 1800, "CgstAmt": 0, "SgstAmt": 0,
"CesRt": 0, "CesAmt": 0, "TotItemVal": 11800
}
The math the IRP checks:
TotAmt = Qty × UnitPrice
AssAmt = TotAmt − Discount
IgstAmt = AssAmt × GstRt / 100 (inter-state)
CgstAmt = SgstAmt = AssAmt × GstRt / 200 (intra-state)
TotItemVal = AssAmt + IgstAmt + CgstAmt + SgstAmt + CesAmt + ... + OthChrg
IsServc:"Y"for services, which use a SAC code starting with99inHsnCd.Unit: a UQC code such asNOS,KGS,MTR,BOXorOTH.GstRtmust be a valid GST slab.
ValDtls: invoice totals
"ValDtls": {
"AssVal": 15000, "CgstVal": 0, "SgstVal": 0, "IgstVal": 2700,
"CesVal": 0, "StCesVal": 0, "Discount": 0, "OthChrg": 0,
"RndOffAmt": 0, "TotInvVal": 17700
}
Each total must equal the sum of the matching item fields (the IRP allows a small rounding tolerance). TotInvVal = AssVal + taxes + cess + OthChrg − Discount + RndOffAmt.
EwbDtls: e-way bill with the IRN
To get an e-way bill at the same time as the IRN, add:
"EwbDtls": {
"TransId": "29AABCT9999T1Z2", "TransName": "Speedy Logistics",
"TransMode": "1", "Distance": 980,
"TransDocNo": "LR-55812", "TransDocDt": "21/11/2026",
"VehNo": "KA01AB1234", "VehType": "R"
}
TransMode:"1"road,"2"rail,"3"air,"4"ship.VehType:"R"regular,"O"over-dimensional cargo.Distancein km. For road you need either the vehicle number or the transporter id.
Bulk e-way bills that are not tied to an e-invoice use a different JSON layout, produced by the e-way bill portal's bulk generation tool. Generate that file with the official tool rather than by hand.
Common rejection reasons and fixes
| Error | Fix |
|---|---|
| Invalid GSTIN / checksum | Use a real, active GSTIN (or the sandbox test GSTINs). Placeholders fail. |
| Date format | Use "dd/mm/yyyy", not ISO dates. |
| Duplicate IRN | The same seller GSTIN + document type + number + financial year was already registered. Use a new number or fetch the existing IRN. |
| Tax type mismatch | Seller Stcd ≠ buyer Pos needs IGST; equal needs CGST + SGST (unless IgstOnIntra is "Y"). |
| Totals do not match | Recompute ValDtls from ItemList; round consistently to 2 decimals. |
| Invalid HSN | Use a valid HSN/SAC with enough digits for your turnover. |
| Pin code / state mismatch | The pin must belong to the state in Stcd. |
| Wrong types | Pin and amounts are numbers; Stcd, Pos, SlNo are strings. |
Other GST JSON files
- GSTR-1: the return JSON is generated by the GST offline tool or your software and uploaded on the GST portal. Its layout is different from the e-invoice schema.
- ITR: income-tax return JSON is produced by the income-tax department's utilities. Use the official utility; do not edit the exported JSON by hand, since the portal validates it strictly.
Security
- Keep IRP API credentials, client secrets and session tokens on the server. Never call the IRP from browser code.
- Do not commit real GSTINs, customer data or credentials to test fixtures.
Check and edit it with AI
Open the GST e-Invoice template in the studio and ask "convert this to an intra-state invoice", "add a third item at 12% GST" or "check that the totals match the items". Each change appears as a diff for you to review.