Fintech technology
Businesses Fintech August 28, 2026 • 7 min read

GST API Failure Cheatsheet: Handle Every Edge Case

For: A backend engineer at a B2B SaaS company (accounting, ERP, or e-commerce) who owns the GST integration and is debugging a production failure where invoices are getting stuck, GSTINs are validating inconsistently, or return filings are silently rejected — and the NIC/GST portal docs tell them nothing useful

If your GST integration is silently dropping invoices or returning inconsistent GSTIN data, the root cause is almost always the same: you are trusting the HTTP status code. The NIC and GSTN APIs return HTTP 200 on semantic failures and encode the real outcome in an error_cd (or ErrorCode) field inside the JSON body. Your retry logic, alerting, and reconciliation must key off that field — not the transport status. Everything below assumes that contract.

This is a working cheatsheet, not a tutorial. Skim to the section that matches your incident.

The core contract: HTTP status vs. inner error_cd

HTTPInner error_cdWhat it actually meansAction
200absent / nullSuccessPersist response, mark txn complete
200presentSemantic failure (validation, duplicate, auth token expired mid-call)Route by error_cd, do NOT blindly retry
401 / 403Session token expired or invalid GSP credentialsRegenerate auth token, retry once
429Rate limit at GSP or NIC layerBackoff with jitter, respect Retry-After if present
500 / 502 / 504Upstream NIC/GSTN outageCircuit-break, queue, do not spin

GSTIN validation API failures

The public /commonapi/v1.1/search endpoint and paid GSP search endpoints do not agree with each other. Cache with care.

E-invoice (IRN) generation errors — the ones docs skip

error_cdWhat's really happeningFix
2150Duplicate IRN — invoice already registeredCall GetIRNByDocDetails, return the existing IRN, do not resubmit
2172For inter-state, CGST/SGST sent instead of IGSTRecompute tax split based on POS vs. supplier state
2176Invalid HSN for the taxpayer's turnover slabEnforce 6-digit HSN for >5Cr turnover at write time, not submit time
2193Assessable value + tax != total value (rounding)Round line-item taxes to 2 decimals BEFORE summing, not after
2211Recipient GSTIN inactive on invoice dateRe-validate GSTIN at invoice-date resolution, not today
3028 / 3029GSTIN not reachable at NIC (propagation delay for newly registered)Queue with exponential backoff up to 24h, then escalate

E-way bill edge cases

Return filing API (GSTR-1, 3B, IFF) — silent rejections

Filing endpoints are the worst offenders for HTTP 200 + embedded failure. Build your state machine around these four states, not two:

  1. Submitted — SAVE call returned success, data staged at GSTN
  2. Validation-pending — GSTN async validation running (poll GET status endpoint)
  3. FiledFILE call succeeded AND acknowledgement (ARN) returned
  4. Rejected — inner error_cd present at any of the above stages

Common filing error codes:

Timeout and rate-limit handling

GSP timeouts do not mean the request failed at NIC. This is the single most expensive mistake in GST integrations.

Reconciliation: the safety net

Every write API (IRN, EWB, filing) needs a paired reconciliation job that runs at T+1h, T+24h, and T+7d. It compares your internal state to the GSTN state via GET endpoints. Drift is common and is the only way you'll catch the failures your real-time layer swallowed.

How CodeNicely can help

We built the accounting and GST filing stack behind GimBooks, a YC-backed SMB accounting platform that files returns for tens of thousands of small businesses across India. The specific problems described in this cheatsheet — silent filing rejections, IRN duplicate handling, GSTR-2B reconciliation drift, GSP failover — are ones we've hit and hardened against in production. If your team owns a GST integration that works in staging but bleeds edge cases in production, that's the exact class of problem we've spent years on. See our offerings or digital transformation practice for how we engage.

Frequently Asked Questions

Why does my GST API call return HTTP 200 but the invoice is not registered?

The GSTN and NIC APIs encode semantic failures inside the JSON body via an error_cd or ErrorCode field while keeping the HTTP status at 200. Your handler must check the inner field before treating the call as successful. Standard HTTP-layer retry libraries will not catch this.

How should I retry a GST API call that timed out?

Do not retry the write directly. Call the corresponding GET endpoint first — GetIRNByDocDetails, e-way bill by IRN, or filing status — to check whether the original request actually landed at GSTN. Retry only if the GET confirms the record is missing. Blind retries cause duplicate IRN errors and inflated filing counts.

Why does GSTIN validation return different results on different days?

Most GSPs cache GSTIN search responses for 24–72 hours, and the underlying NIC data itself updates asynchronously after registration or cancellation events. For tax-critical flows, cap your own cache at 24 hours and always re-validate at the invoice date, not the current date, when computing eligibility.

What is the safest way to handle GSTR-1 filing rejections?

Model filing as a four-state machine: submitted, validation-pending, filed, rejected. Poll the status endpoint after every SAVE and FILE call, key off the inner error code, and version your JSON payload builder so you can diff against GSTN schema drift. Store every rejected payload in full for replay.

Can CodeNicely audit our existing GST integration?

Yes. We do targeted reviews of GST, e-invoice, and e-way bill integrations, including error taxonomy, retry semantics, and GSTR-2B reconciliation. Contact CodeNicely for a personalized assessment based on your stack and taxpayer profile.

Building something in Fintech?

CodeNicely partners with founders and tech teams to ship AI-native products that move metrics. Tell us about the problem you're solving.

Talk to our team