E-Invoice/E-WayBill APIs

API – Generate IRN

This API is used to register the invoice, credit note and debit note and get the Invoice Registration Number (IRN).

URL

POST https://app.octagst.com/api/einvoice/generateirn

Query Parameters

NameDescriptionTypeValueDefault
qrcodeInclude QR Code image in responseOptionalyes, nono
qrcodeformatQR code image formatOptionalPNG, JPEG, GIFPNG
qrcodequalityQR code image qualityOptionalstandard, highhigh
pdfInclude e-invoive pdf and e-waybill pdf in responseOptionalyes, nono

Request

Structure

ParameterData TypeTypeDescription
VersionString(6)MandatorySchema version
1.1
TranDtlsObjectMandatoryThis object contains transaction details
TaxSchString(10)MandatoryTax Scheme
GST
SupTypString(10)MandatorySupply Type
B2B:B2B Supply
SEZWP: SEZ supply with payment of IGST
SEZWOP: SEZ supply without payment of IGST
EXPWP: Export with payment of IGST
EXPWOP: Export without payment of IGST
DEXP: Deemed Export
B2C: B2C Supply
RegRevStringOptionalReverse Charge
Y: Yes
N: No
EcmGstinString(15)OptionalGSTIN of E-Commerce operator
IgstOnIntraString(1)OptionalIGST on Intrastate Supply
Y: Yes
N: No
DocDtlsObjectMandatoryThis object contains document details
TypStringMandatoryDocument Type
INV: Invoice
CRN: Credit Note
DBN-Debit Note
NoString(16)MandatoryDocument No
A-Z, 0-9, /, -
DtString(10)MandatoryDocument Date
DD/MM/YYYY
SellerDtlsObjectMandatoryThis object contains the Seller details like GSTIN, Tradename, Address etc
GstinString(15)MandatoryGSTIN
LglNmString(100)MandatoryLegal Name as appearing in PAN
TrdNmString(100)OptionalTrade name, if available. (Business Name, other than legal name)
Addr1String(100)MandatoryAddress-1
Addr2String(100)OptionalAddress-2
LocString(100)MandatoryLocation (City/Town/Village)
PinNumber(6)MandatoryPin code
StcdString(2)MandatoryState Code
PhString(12)OptionalPhone No
EmString(100)OptionalEmail
BuyerDtlsObjectMandatoryThis object contains the Buyer details like GSTIN, Tradename, Address etc
GstinString(15)OptionalBuyer GSTIN, required for B2B invoices
LglNmString(100)MandatoryLegal Name as appearing in PAN
TrdNmString(100)OptionalTrade name, if available. (Business Name, other than legal name)
Addr1String(100)MandatoryAddress-1
Addr2String(100)OptionalAddress-2
LocString(100)MandatoryLocation (City/Town/Village)
PinNumber(6)OptionalPin code
StcdString(2)OptionalState Code
PhString(12)OptionalPhone No
EmString(100)OptionalEmail
DispDtlsObjectOptionalThis object contains the Dispatch details like business name, Address etc
NmString(100)MandatoryBusiness entity name
Addr1String(100)MandatoryAddress-1
Addr2String(100)OptionalAddress-2
LocString(100)MandatoryLocation (City/Town/Village)
PinNumber(6)MandatoryPin code
StcdString(2)MandatoryState Code
ShipDtlsObjectOptionalThis object contains the Ship To details like GSTIN, Tradename, Address etc
GstinString(15)OptionalGSTIN
LglNmString(100)MandatoryLegal Name as appearing in PAN
TrdNmString(100)OptionalTrade name, if available. (Business Name, other than legal name)
Addr1String(100)MandatoryAddress-1
Addr2String(100)OptionalAddress-2
LocString(100)MandatoryLocation (City/Town/Village)
PinNumber(6)MandatoryPin code
StcdString(2)MandatoryState Code
ItemListItem[]MandatoryThis object contains list of line items.
ItemObjectMandatoryThis object contains details of line item
SlNoString(6)OptionalSerial no of line item. Only digits are allowed.
PrdDescString(300)OptionalProduct/Item
IsServcString(1)OptionalWhether line item is good or service
Y: Yes
N: No
HsnCdString(8)MandatoryHSN Code
QtyNumber(10,3)OptionalQuantity
FreeQtyNumber(10,3)OptionalFree quantity
UnitString(3)MandatoryUQC
UnitPriceNumber(12,2)MandatoryUnit price
TotAmtNumber(12,2)OptionalItem gross amount (Qty * UnitPrice)
DiscountNumber(12,2)OptionalDiscount
PreTaxValNumber(12,2)OptionalPre Taxable Value
AssAmtNumber(12,2)OptionalItem Taxable Value (Total Amount - Discount)
GstRtNumber(3,3)MandatoryGST Rate
IgstAmtNumber(12,2)OptionalIGST Amount
CgstAmtNumber(12,2)OptionalCGST Amount
SgstAmtNumber(12,2)OptionalSGST Amount
CesRtNumber(3,3)OptionalCess Rate
CessAmtNumber(12,2)OptionalCess Amount
CesNonAdvlAmtNumber(12,2)OptionalCess Nonadvol Amount
StateCesRtNumber(3,3)OptionalState Cess Rate
StateCesAmtNumber(12,2)OptionalState Cess Amount
StateCesNonAdvlAmtNumber(12,2)OptionalState Cess Nonadvol Amount
OthChrgNumber(12,2)OptionalOther charges
TotAmtNumber(12,2)OptionalTotal Item Value (TaxableValue + Igst Amount + Cgst Amount + Sgst Amount + Cess Amount + Cess Nonadvol + State cess amount + State Cess Non advol + Other charges)
OrdLineRefString(50)OptionalOrder line Referencee
OrgCntryString(2)OptionalOrigin Country
OthSerialNumberString(20)OptionalProduct Serial Number
BarcdeNumber(12,2)OptionalBar code
Item.BchDtlObjectOptionalThis object contains details of batch
NmString (20)MandatoryBatch Name/Number
ExpDtString(10)OptionalBatch Expiry Date
DD/MM/YYYY
WrDtString(10)OptionalBatch Warranty Date
DD/MM/YYYY
Item.AttribDtls[]Attribute[]OptionalThis object contains details of item attributes
AttributeObjectOptionalThis object contains details of line item
NmString (100)MandatoryAttribute Name
ValString(100)MandatoryAttribute value
ValDtlObjectOptionalThis object contains details of document totals
AssValNumber(14,2)OptionalTotal taxable value.
IgstValNumber(14,2)OptionalTotal IGST Amount
CgstValNumber(14,2)OptionalTotal CGST Amount
SgstValNumber(14,2)OptionalTotal SGST Amount
CesValNumber(14, 2)OptionalTotal Cess Amount
StCesValNumber(14,2)OptionalTotal State Cess Amount
DiscountNumber(14,2)OptionalInvoice Discount
OthChrgNumber(14,2)OptionalInvoice Other charges
RndOffAmtNumber(2,2)OptionalRound off Amount
TotInvValNumber(14,2)OptionalTotal document value
TotInvValFcNumber(14,2)OptionalTotal document value in foreign currency
PayDtlObjectOptionalThis object contains payment details
NmString(100)OptionalPayee Name
ModeString(18)OptionalMode of Payment
FinInsBrString(11)OptionalBranch or IFSC Code
PayTermString(100)OptionalPayment Term
PayInstrString(100)OptionalPayment Instruction
CrTrnString(100)OptionalCredit Transfer
DirDrString(100)OptionalDirect Debit
CrDayNumber(4)OptionalCredit Days
PaidAmtNumber(14,2)OptionalPaid Amount
PaymtDueNumber(14,2)OptionalPayment Due
AccDetString(18)OptionalBank Account Details
RefDtlObjectOptionalThis object contains reference details
InvRmString(100)OptionalDocument Remarks
InvStDtString(10)MandatoryInvoice Period Start Date
DD/MM/YYYY
InvEndDtString(10)MandatoryInvoice Period End Date
DD/MM/YYYY
PrecDocDtls[]PrecedindDoc[]OptionalThis object contains details of preceding issued documents
PrecedindDocObjectOptionalThis object contains preceding document details
InvNoString(16)MandatoryPreceding Invoice Number
InvDtString(10)MandatoryPreceding Invoice Date
DD/MM/YYYY
OthRefNoString(20)OptionalOther Reference
ContrDtls[]ContractRef[]OptionalThis object contains details of contract reference documents
ContractRefObjectOptionalThis object contains contract references
RecAdvRefrString(20)OptionalReceipt Advice No
RecAdvDtString(10)OptionalReceipt Advice Date
DD/MM/YYYY
TendRefrString(20)OptionalLot/Batch Reference No
ContrRefrString(20)OptionalContract Reference Number
ExtRefrString(20)OptionalAny Other Reference
ProjRefrString(20)OptionalProject Reference
PORefrString(20)OptionalPO Reference Number
PORefDtString(10)OptionalPO Reference Date
DD/MM/YYYY
AddlDtls[]AddlDoc[]OptionalThis object contains details of additional documents
AddlDocObjectOptionalThis object contains additional document details
UrlString(100)OptionalAdditional supporting documents URL
DocsString(1000)OptionalAdditional supporting documents in base64
InfoString(1000)OptionalAdditional information
ExpDtlObjectOptionalThis object contains details of export invoice
ShipBNoString(20)OptionalShipping Bill No
ShipBDtString(10)OptionalShipping Bill Date
DD/MM/YYYY
PortString(10)OptionalPort Code
RefClmString(1)OptionalRefund Claim
Y: Yes
N: No
ForCurString(16)OptionalForeign Currency
CntCodeString(2)OptionalCountry Code
ExpDutyNumber(12,2)OptionalExport Duty
EwbDtlsObjectOptionalThis object contains EWaybill details
TransIdString(15)OptionalTransporter Id
TransNameString(100)OptionalTransport Name
TransModeString(1)OptionalTransport Mode
1: Road
2: Rail
3: Air
4: Ship
DistanceNumber(4)MandatoryDistance
TransDocNoString(15)OptionalTransporter Doc No
TransDocDtString(10)OptionalTransporter Doc Date
DD/MM/YYYY
VehNoString(20)OptionalVehicle No
VehTypeString(1)OptionalVehicle Type
R: Regular
O: Over-Dimensional Cargo (ODC)

Please visit NIC eInvoice portal to get masters defined for State Codes, UQC, Currency codes, Country codes, Port codes, HSN, PIN codes.

Master Codes on NIC Portal →

Sample

Request payload should contain the JSON encoded invoice data:

{
  "Version": "1.1",
  "TranDtls": {
    "TaxSch": "GST",
    "SupTyp": "B2B",
    "RegRev": "Y",
    "EcmGstin": null,
    "IgstOnIntra": "N"
  },
  "DocDtls": {
    "Typ": "INV",
    "No": "MAHI/10",
    "Dt": "08/08/2020"
  },
  "SellerDtls": {
    "Gstin": "29AABCT1332L000",
    "LglNm": "ABC company pvt ltd",
    "TrdNm": "NIC Industries",
    "Addr1": "5th block, kuvempu layout",
    "Addr2": "kuvempu layout",
    "Loc": "GANDHINAGAR",
    "Pin": 560001,
    "Stcd": "29",
    "Ph": "9000000000",
    "Em": "abc@gmail.com"
  },
  "BuyerDtls": {
    "Gstin": "29AWGPV7107B1Z1",
    "LglNm": "XYZ company pvt ltd",
    "TrdNm": "XYZ Industries",
    "Pos": "37",
    "Addr1": "7th block, kuvempu layout",
    "Addr2": "kuvempu layout",
    "Loc": "GANDHINAGAR",
    "Pin": 560004,
    "Stcd": "29",
    "Ph": "9000000000",
    "Em": "abc@gmail.com"
  },
  "DispDtls": {
    "Nm": "ABC company pvt ltd",
    "Addr1": "7th block, kuvempu layout",
    "Addr2": "kuvempu layout",
    "Loc": "Banagalore",
    "Pin": 518360,
    "Stcd": "37"
  },
  "ShipDtls": {
    "Gstin": "29AWGPV7107B1Z1",
    "LglNm": "CBE company pvt ltd",
    "TrdNm": "kuvempu layout",
    "Addr1": "7th block, kuvempu layout",
    "Addr2": "kuvempu layout",
    "Loc": "Banagalore",
    "Pin": 518360,
    "Stcd": "37"
  },
  "ItemList": [
    {
      "SlNo": "1",
      "IsServc": "N",
      "PrdDesc": "Rice",
      "HsnCd": "1001",
      "Barcde": "123456",
      "BchDtls": {
        "Nm": "123456",
        "Expdt": "01/08/2020",
        "wrDt": "01/09/2020"
      },
      "Qty": 100.345,
      "FreeQty": 10,
      "Unit": "NOS",
      "UnitPrice": 99.545,
      "TotAmt": 9988.84,
      "Discount": 10,
      "PreTaxVal": 1,
      "AssAmt": 9978.84,
      "GstRt": 12,
      "SgstAmt": 0,
      "IgstAmt": 1197.46,
      "CgstAmt": 0,
      "CesRt": 5,
      "CesAmt": 498.94,
      "CesNonAdvlAmt": 10,
      "StateCesRt": 12,
      "StateCesAmt": 1197.46,
      "StateCesNonAdvlAmt": 5,
      "OthChrg": 10,
      "TotItemVal": 12897.7,
      "OrdLineRef": "3256",
      "OrgCntry": "AG",
      "PrdSlNo": "12345",
      "AttribDtls": [
        {
          "Nm": "Rice",
          "Val": "10000"
        }
      ]
    }
  ],
  "ValDtls": {
    "AssVal": 9978.84,
    "CgstVal": 0,
    "SgstVal": 0,
    "IgstVal": 1197.46,
    "CesVal": 508.94,
    "StCesVal": 1202.46,
    "Discount": 10,
    "OthChrg": 20,
    "RndOffAmt": 0.3,
    "TotInvVal": 12908,
    "TotInvValFc": 12897.7
  },
  "PayDtls": {
    "Nm": "ABCDE",
    "Accdet": "5697389713210",
    "Mode": "Cash",
    "Fininsbr": "SBIN11000",
    "Payterm": "100",
    "Payinstr": "Gift",
    "Crtrn": "test",
    "Dirdr": "test",
    "Crday": 100,
    "Paidamt": 10000,
    "Paymtdue": 5000
  },
  "RefDtls": {
    "InvRm": "TEST",
    "DocPerdDtls": {
      "InvStDt": "01/08/2020",
      "InvEndDt": "01/09/2020"
    },
    "PrecDocDtls": [
      {
        "InvNo": "DOC/002",
        "InvDt": "01/08/2020",
        "OthRefNo": "123456"
      }
    ],
    "ContrDtls": [
      {
        "RecAdvRefr": "DOC/002",
        "RecAdvDt": "01/08/2020",
        "Tendrefr": "Abc001",
        "Contrrefr": "Co123",
        "Extrefr": "Yo456",
        "Projrefr": "Doc-456",
        "Porefr": "Doc-789",
        "PoRefDt": "01/08/2020"
      }
    ]
  },
  "AddlDocDtls": [
    {
      "Url": "https://einv-apisandbox.nic.in",
      "Docs": "Test Doc",
      "Info": "Document Test"
    }
  ],
  "ExpDtls": {
    "ShipBNo": "A-248",
    "ShipBDt": "01/08/2020",
    "Port": "INABG1",
    "RefClm": "N",
    "ForCur": "AED",
    "CntCode": "AE"
  },
  "EwbDtls": {
    "Transid": "12AWGPV7107B1Z1",
    "Transname": "XYZ EXPORTS",
    "Distance": 100,
    "Transdocno": "DOC01",
    "TransdocDt": "01/08/2020",
    "Vehno": "ka123456",
    "Vehtype": "R",
    "TransMode": "1"
  }
}

Response

Response payload will contain the success status along with IRN information.

Structure

ParameterData TypeDescription
SuccessBooleantrue in case of success
AckNoStringAcknowledgement number
AckTimeStringAcknowledgement Date & time
DD/MM/YYYY HH:MM:SS
IrnStringInvoice reference number generated
IrnStatusStringIRN Status
ACT: Active
CNL: Cancelled
SignedInvoiceString (Binary data in Base64 URL encoding)Signed invoice data as received from IRP
SignedQRCodeString (Binary data in Base64 URL encoding)Signed QR code as received from IRP
EwbStatusStringEWB Status
ACT: Active
CNL: Cancelled
EwbNoStringe-waybill Number(present only if e-waybill is generated along with e-invoice)
EwbTimeStringe-waybill generation Date & time
DD/MM/YYYY HH:MM:SS
EwbValidTillStringe-waybill validity Date & time
DD/MM/YYYY HH:MM:SS
QRCodeImagePngString (Binary data in Base64 encoding)e-Invoice QR code PNG image
QRCodeImageJpegString (Binary data in Base64 encoding)e-Invoice QR code JPEG image
QRCodeImageGifString (Binary data in Base64 encoding)e-Invoice QR code GIF image
EinvoicePdfString (Binary data in Base64 encoding)e-Invoice PDF file
EwbPdfString (Binary data in Base64 encoding)e-waybill PDF file
ErrorsError[]List of errors, will be present only when Success is false

Error

ParameterData TypeDescription
CodeStringError Code
MessageStringError message

Sample – Success

{
  "Success": true,
  "AckNo": "112010000002315",
  "AckTime": "27/11/2020 17:23:45",
  "IrnStatus": "ACT",
  "Irn": "11f8ef741fe294d4a14aad0b12457e62775d0fdc41a0dcf05b74fbb2ddc47acb",
  "SignedInvoice": "eyJhbGc...gumxIpg",
  "SignedQRCode": "eyJhbGc...oOZvxpw",
  "EwbStatus": "ACT",
  "EwbNo": "191008688443",
  "EwbTime": "27/11/2020 17:23:45",
  "EwbValidTill": "29/11/2020 17:23:45",
  "QRCodeImagePng": "gy72zt...3AAAAAElFTkSuQmCC",
  "QRCodeImageJpeg": null,
  "QRCodeImageGif": null,
  "EinvoicePdf": "i7gahsd...GY899RfTkSueba781Fg",
  "EwbPdf": "utwf19...34566AAAElFTkSuQmCC"
}

Sample – Failure

If the API request fails for some reasons, the response payload will contain the failure status and a list of errors.

{
  "Success": false,
  "Errors": [
    {
      "Code": "ERR_CODE_1",
      "Message": "ERR MESSAGE 1"
    },
    {
      "Code": "ERR_CODE_n",
      "Message": "ERR MESSAGE n"
    }
  ]
}