e-Invoice APIEnvironment:
API Reference
Overview
Authentication
Get GSTN Details
Get Sync GSTIN From CP
Generate IRN
Generate IRNPOST
Get EInvoice Details
Get IRN details by Doc Details
Cancel IRN
Get Rejected IRNs
Generate Ewaybill
Get Ewaybill Details by IRN
Get B2C QR Code Details

e-Invoice IRN Generation API

POSThttps://apisandbox.whitebooks.in/einvoice/type/GENERATE/version/V1_03

Generate Invoice Reference Number

Parameters

query parameters
emailstringrequired
User Email
header parameters
ip_addressstringrequired
IP Address
client_idstringrequired
Client ID
client_secretstringrequired
Client Secret
usernamestringrequired
User name
auth-tokenstringrequired
Token
gstinstringrequired
GSTIN number

Request Body

application/jsonrequired
Versionstringoptional
Version Type
Example: "1.1"
TranDtlsobjectoptional
TaxSchstringoptional
Tax type
Example: "GST"
SupTypstringoptional
Supply Type
Example: "B2B"
RegRevstringoptional
Reg Rev
Example: "N"
EcmGstinstringoptionalnullable
Ecom GSTIN
Example: null
IgstOnIntrastringoptional
IGST On Intra
Example: "N"
DocDtlsobjectoptional
Typstringoptional
Type
Example: "INV"
Nostringoptional
Invoice Number
Example: "MAHI/10"
Dtstringoptional
Invoice Date
Example: "08/08/2020"
SellerDtlsobjectoptional
Gstinstringoptional
GST Number
Example: "29AAGCB1286Q000"
LglNmstringoptional
Legal Name
Example: "ABC company pvt ltd"
TrdNmstringoptional
Trade Name
Example: "NIC Industries"
Addr1stringoptional
Address1
Example: "5th block, kuvempu layout"
Addr2stringoptional
Address2
Example: "kuvempu layout"
Locstringoptional
Location Name
Example: "GANDHINAGAR"
Pinnumberoptional
Pincode Number
Example: 560001
Stcdstringoptional
State Code
Example: "29"
Phstringoptional
Phone Number
Example: "9000000000"
Emstringoptional
Email Id
Example: "abc@gmail.com"
BuyerDtlsobjectoptional
Gstinstringoptional
GST Number
Example: "29AWGPV7107B1Z1"
LglNmstringoptional
Legal Name
Example: "XYZ company pvt ltd"
TrdNmstringoptional
Trade Name
Example: "XYZ Industries"
Posstringoptional
Place of Supply
Example: "37"
Addr1stringoptional
Address1
Example: "7th block, kuvempu layout"
Addr2stringoptional
Address2
Example: "kuvempu layout"
Locstringoptional
Location Name
Example: "GANDHINAGAR"
Pinnumberoptional
Pincode Number
Example: 560004
Stcdstringoptional
State Code
Example: "29"
Phstringoptional
Phone Number
Example: "9000000000"
Emstringoptional
Email Id
Example: "abc@gmail.com"
DispDtlsobjectoptional
Nmstringoptional
Name
Example: "ABC company pvt ltd"
Addr1stringoptional
Address1
Example: "7th block, kuvempu layout"
Addr2stringoptional
Address2
Example: "kuvempu layout"
Locstringoptional
Location Name
Example: "Banagalore"
Pinnumberoptional
Pincode Number
Example: 518360
Stcdstringoptional
State Name
Example: "37"
ShipDtlsobjectoptional
Gstinstringoptional
GST Number
Example: "29AWGPV7107B1Z1"
LglNmstringoptional
Legal Name
Example: "CBE company pvt ltd"
TrdNmstringoptional
Trade Name
Example: "kuvempu layout"
Addr1stringoptional
Address1
Example: "7th block, kuvempu layout"
Addr2stringoptional
Address2
Example: "kuvempu layout"
Locstringoptional
Location Name
Example: "Banagalore"
Pinnumberoptional
Pincode Number
Example: 518360
Stcdstringoptional
State Name
Example: "37"
ItemListarray<einvoicetypeGENERATEversionV1_1_ItemList>optional
Array items:
SlNostringoptional
Serial Number
Example: "1"
IsServcstringoptional
Service
Example: "N"
PrdDescstringoptional
Product Description
Example: "Rice"
HsnCdstringoptional
HSN Code
Example: "1001"
Barcdestringoptional
Bar Code
Example: "123456"
BchDtlsobjectoptional
Nmstringoptional
Tax type
Example: "123456"
Expdtstringoptional
Tax type
Example: "01/08/2020"
wrDtstringoptional
Tax type
Example: "01/09/2020"
Qtynumberoptional
Quntity
Example: 100.345
FreeQtynumberoptional
Free Quntity
Example: 10
Unitstringoptional
Units Of Measurment
Example: "NOS"
UnitPricenumberoptional
Unit Price
Example: 99.545
TotAmtnumberoptional
Total Amount
Example: 9988.84
Discountnumberoptional
Discount
Example: 10
PreTaxValnumberoptional
Discount
Example: 1
AssAmtnumberoptional
Assesment Amount
Example: 9978.84
GstRtnumberoptionalnullable
gst Rate
Example: 12
SgstAmtnumberoptional
Sgst Rate
Example: 0
IgstAmtnumberoptional
Igst Rate
Example: 1197.46
CgstAmtnumberoptional
Cgst Rate
Example: 0
CesRtnumberoptional
Cess Rate
Example: 5
CesAmtnumberoptional
Cess Amount
Example: 498.94
CesNonAdvlAmtnumberoptional
CesNonAd value
Example: 10
StateCesRtnumberoptional
State Cess Rate
Example: 12
StateCesAmtnumberoptional
State Cess Amount
Example: 1197.46
StateCesNonAdvlAmtnumberoptional
State Cess none advance Amount
Example: 5
OthChrgnumberoptional
Other Charges
Example: 10
TotItemValnumberoptional
Total Item Value
Example: 12897.7
OrdLineRefstringoptional
Total Item Value
Example: "3256"
OrgCntrystringoptional
Total Item Value
Example: "AG"
PrdSlNostringoptional
Total Item Value
Example: "12345"
AttribDtlsarray<einvoicetypeGENERATEversionV1_1_AttribDtls>optional
Array items:
Nmstringoptional
Tax type
Example: "Rice"
Valstringoptional
Tax type
Example: "10000"
ValDtlsobjectoptional
AssValnumberoptional
Assestment Val
Example: 9978.84
CgstValnumberoptional
Cgst Value
Example: 0
SgstValnumberoptional
Sgst Value
Example: 0
IgstValnumberoptional
Igst Value
Example: 1197.46
CesValnumberoptional
Cess Value
Example: 508.94
StCesValnumberoptional
StCess Value
Example: 1202.46
Discountnumberoptional
StCess Value
Example: 10
OthChrgnumberoptional
StCess Value
Example: 20
RndOffAmtnumberoptional
Round off
Example: 0.3
TotInvValnumberoptional
Total Invoice Value
Example: 12908
TotInvValFcnumberoptional
StCess Value
Example: 12897.7
PayDtlsobjectoptional
Nmstringoptional
State Name
Example: "ABCDE"
Accdetstringoptional
State Name
Example: "5697389713210"
Modestringoptional
State Name
Example: "Cash"
Fininsbrstringoptional
State Name
Example: "SBIN11000"
Paytermstringoptional
State Name
Example: "100"
Payinstrstringoptional
State Name
Example: "Gift"
Crtrnstringoptional
State Name
Example: "test"
Dirdrstringoptional
State Name
Example: "test"
Crdaynumberoptional
State Name
Example: 100
Paidamtnumberoptional
State Name
Example: 10000
Paymtduenumberoptional
State Name
Example: 5000
RefDtlsobjectoptional
InvRmstringoptional
GST Number
Example: "TEST"
DocPerdDtlsobjectoptional
InvStDtstringoptional
State Name
Example: "01/08/2020"
InvEndDtstringoptional
State Name
Example: "01/09/2020"
PrecDocDtlsarray<einvoicetypeGENERATEversionV1_1_PrecDocDtls>optional
Array items:
InvNostringoptional
State Name
Example: "DOC/002"
InvDtstringoptional
State Name
Example: "01/08/2020"
OthRefNostringoptional
State Name
Example: "123456"
ContrDtlsarray<einvoicetypeGENERATEversionV1_1_ContrDtls>optional
Array items:
RecAdvRefrstringoptional
State Name
Example: "DOC/002"
RecAdvDtstringoptional
State Name
Example: "01/08/2020"
Tendrefrstringoptional
State Name
Example: "Abc001"
Contrrefrstringoptional
State Name
Example: "Co123"
Extrefrstringoptional
State Name
Example: "Yo456"
Projrefrstringoptional
State Name
Example: "Doc-456"
Porefrstringoptional
State Name
Example: "Doc-789"
PoRefDtstringoptional
State Name
Example: "01/08/2020"
AddlDocDtlsarray<einvoicetypeGENERATEversionV1_1_AddlDocDtls>optional
Array items:
Urlstringoptional
State Name
Example: "https://einv-apisandbox.nic.in"
Docsstringoptional
State Name
Example: "Test Doc"
Infostringoptional
State Name
Example: "Document Test"
ExpDtlsobjectoptional
ShipBNostringoptional
State Name
Example: "A-248"
ShipBDtstringoptional
State Name
Example: "01/08/2020"
Portstringoptional
State Name
Example: "INABG1"
RefClmstringoptional
State Name
Example: "N"
ForCurstringoptional
State Name
Example: "AED"
CntCodestringoptional
State Name
Example: "AE"
EwbDtlsobjectoptional
Transidstringoptional
State Name
Example: "12AWGPV7107B1Z1"
Transnamestringoptional
State Name
Example: "XYZ EXPORTS"
Distancenumberoptional
State Name
Example: 100
Transdocnostringoptional
State Name
Example: "DOC01"
TransdocDtstringoptional
State Name
Example: "01/08/2020"
Vehnostringoptional
State Name
Example: "ka123456"
Vehtypestringoptional
State Name
Example: "R"
TransModestringoptional
State Name
Example: "1"

Response

Not Found. If requested entity is not found or if requested API is not found.

Frequently Asked Questions

Requests require the standard WhiteBooks OAuth Bearer token (Authorization: Bearer <access_token>) and x-api-key in the headers, along with business routing parameters (gstin, ip_address, and username). Your private client_secret is used only during initial token acquisition at /authentication/authtoken and should never be sent on endpoint calls.
The payload body requires Version (e.g. 1.03), TranDtls (tax supply details), DocDtls (document type, number, date), SellerDtls, and BuyerDtls. Optional sections like DispDtls, ShipDtls, ItemList, ValDtls, and EwbDtls should be provided when applicable to the transaction.
The IRP computes the 64-character hash using Supplier GSTIN, Document Number (DocDtls.No), Document Type (DocDtls.Typ), and Financial Year. If an IRN has already been generated for this combination, the portal rejects it. You cannot regenerate an IRN for the same invoice number in the same financial year.
Yes. By populating the EwbDtls object (containing TransMode, Distance, TransId, and vehicle/transport document details) within the IRN generation payload, the IRP generates both the IRN and the Part-A/Part-B e-Way Bill in a single synchronous call.
Under NIC guidelines, an IRN can be cancelled via the cancellation endpoint within 24 hours of generation. After 24 hours, the IRN cannot be cancelled on the IRP; credit notes must be issued instead to reverse the tax liability.
POST/einvoice/type/GENERATE/version/V1_03
1const response = await fetch('https://apisandbox.whitebooks.in/einvoice/type/GENERATE/version/V1_03?email=value', {
2 method: 'POST',
3 headers: {
4 ip_address: "value",
5 client_id: "value",
6 client_secret: "value",
7 username: "value",
8 auth-token: "value",
9 gstin: "value",
10 Content-Type: "application/json"
11},
12 body: JSON.stringify({
13 "Version": "1.1",
14 "TranDtls": {
15 "TaxSch": "GST",
16 "SupTyp": "B2B",
17 "RegRev": "N",
18 "EcmGstin": null,
19 "IgstOnIntra": "N"
20 },
21 "DocDtls": {
22 "Typ": "INV",
23 "No": "MAHI/10",
24 "Dt": "08/08/2020"
25 },
26 "SellerDtls": {
27 "Gstin": "29AAGCB1286Q000",
28 "LglNm": "ABC company pvt ltd",
29 "TrdNm": "NIC Industries",
30 "Addr1": "5th block, kuvempu layout",
31 "Addr2": "kuvempu layout",
32 "Loc": "GANDHINAGAR",
33 "Pin": 560001,
34 "Stcd": "29",
35 "Ph": "9000000000",
36 "Em": "abc@gmail.com"
37 },
38 "BuyerDtls": {
39 "Gstin": "29AWGPV7107B1Z1",
40 "LglNm": "XYZ company pvt ltd",
41 "TrdNm": "XYZ Industries",
42 "Pos": "37",
43 "Addr1": "7th block, kuvempu layout",
44 "Addr2": "kuvempu layout",
45 "Loc": "GANDHINAGAR",
46 "Pin": 560004,
47 "Stcd": "29",
48 "Ph": "9000000000",
49 "Em": "abc@gmail.com"
50 },
51 "DispDtls": {
52 "Nm": "ABC company pvt ltd",
53 "Addr1": "7th block, kuvempu layout",
54 "Addr2": "kuvempu layout",
55 "Loc": "Banagalore",
56 "Pin": 518360,
57 "Stcd": "37"
58 },
59 "ShipDtls": {
60 "Gstin": "29AWGPV7107B1Z1",
61 "LglNm": "CBE company pvt ltd",
62 "TrdNm": "kuvempu layout",
63 "Addr1": "7th block, kuvempu layout",
64 "Addr2": "kuvempu layout",
65 "Loc": "Banagalore",
66 "Pin": 518360,
67 "Stcd": "37"
68 },
69 "ItemList": [
70 {
71 "SlNo": "1",
72 "IsServc": "N",
73 "PrdDesc": "Rice",
74 "HsnCd": "1001",
75 "Barcde": "123456",
76 "BchDtls": {
77 "Nm": "123456",
78 "Expdt": "01/08/2020",
79 "wrDt": "01/09/2020"
80 },
81 "Qty": 100.345,
82 "FreeQty": 10,
83 "Unit": "NOS",
84 "UnitPrice": 99.545,
85 "TotAmt": 9988.84,
86 "Discount": 10,
87 "PreTaxVal": 1,
88 "AssAmt": 9978.84,
89 "GstRt": 12,
90 "SgstAmt": 0,
91 "IgstAmt": 1197.46,
92 "CgstAmt": 0,
93 "CesRt": 5,
94 "CesAmt": 498.94,
95 "CesNonAdvlAmt": 10,
96 "StateCesRt": 12,
97 "StateCesAmt": 1197.46,
98 "StateCesNonAdvlAmt": 5,
99 "OthChrg": 10,
100 "TotItemVal": 12897.7,
101 "OrdLineRef": "3256",
102 "OrgCntry": "AG",
103 "PrdSlNo": "12345",
104 "AttribDtls": [
105 {
106 "Nm": "Rice",
107 "Val": "10000"
108 }
109 ]
110 }
111 ],
112 "ValDtls": {
113 "AssVal": 9978.84,
114 "CgstVal": 0,
115 "SgstVal": 0,
116 "IgstVal": 1197.46,
117 "CesVal": 508.94,
118 "StCesVal": 1202.46,
119 "Discount": 10,
120 "OthChrg": 20,
121 "RndOffAmt": 0.3,
122 "TotInvVal": 12908,
123 "TotInvValFc": 12897.7
124 },
125 "PayDtls": {
126 "Nm": "ABCDE",
127 "Accdet": "5697389713210",
128 "Mode": "Cash",
129 "Fininsbr": "SBIN11000",
130 "Payterm": "100",
131 "Payinstr": "Gift",
132 "Crtrn": "test",
133 "Dirdr": "test",
134 "Crday": 100,
135 "Paidamt": 10000,
136 "Paymtdue": 5000
137 },
138 "RefDtls": {
139 "InvRm": "TEST",
140 "DocPerdDtls": {
141 "InvStDt": "01/08/2020",
142 "InvEndDt": "01/09/2020"
143 },
144 "PrecDocDtls": [
145 {
146 "InvNo": "DOC/002",
147 "InvDt": "01/08/2020",
148 "OthRefNo": "123456"
149 }
150 ],
151 "ContrDtls": [
152 {
153 "RecAdvRefr": "DOC/002",
154 "RecAdvDt": "01/08/2020",
155 "Tendrefr": "Abc001",
156 "Contrrefr": "Co123",
157 "Extrefr": "Yo456",
158 "Projrefr": "Doc-456",
159 "Porefr": "Doc-789",
160 "PoRefDt": "01/08/2020"
161 }
162 ]
163 },
164 "AddlDocDtls": [
165 {
166 "Url": "https://einv-apisandbox.nic.in",
167 "Docs": "Test Doc",
168 "Info": "Document Test"
169 }
170 ],
171 "ExpDtls": {
172 "ShipBNo": "A-248",
173 "ShipBDt": "01/08/2020",
174 "Port": "INABG1",
175 "RefClm": "N",
176 "ForCur": "AED",
177 "CntCode": "AE"
178 },
179 "EwbDtls": {
180 "Transid": "12AWGPV7107B1Z1",
181 "Transname": "XYZ EXPORTS",
182 "Distance": 100,
183 "Transdocno": "DOC01",
184 "TransdocDt": "01/08/2020",
185 "Vehno": "ka123456",
186 "Vehtype": "R",
187 "TransMode": "1"
188 }
189}),
190});
191
192const data = await response.json();
193console.log(data);
No example available.