DEV Community

taxgarden
taxgarden

Posted on

GST e-invoicing API integration for developers: IRN generation, IRP endpoints, common errors

If you build ERP integrations for Indian SMBs, e-invoicing via the GST IRP API is something you will eventually touch.

Authentication: POST to sandbox.einvoice1.gst.gov.in/eicore/v1.03/Auth. Generate a 32-byte random session key. Encrypt with NIC public key (provided in sandbox docs). Base64 encode becomes app_key. Response gives auth_token encrypted with your session key. Decrypt to get bearer token. 6-hour expiry.

Generate IRN: POST /eicore/v1.03/Invoice with Version, TranDtls (supply type), DocDtls (invoice number, type, date), SellerDtls + BuyerDtls (GSTIN and address), ItemList (HSN, quantity, rate, GST amounts), ValDtls (total). Response: IRN (64-char hash), SignedQRCode, AckNo.

Common errors: 2150: GSTIN not found in sandbox. Use provided test GSTINs only. 2283: Duplicate IRN. Invoice number already submitted. 2271: HSN code invalid for the supply type.

Cancellation: only within 24 hours. PUT /eicore/v1.03/Invoice/Cancel with IRN and reason.

Mandatory for Rs 5 crore plus turnover since August 2023. Build it before clients hit the threshold.

Business compliance context: GST e-invoicing compliance guide

Top comments (0)