A GSTIN lookup answers a deceptively simple question: can I do business with this registration today? To answer it properly you have to separate three things that developers tend to merge: whether the number exists, whether the registration is active, and whether the details attached to it are the details your counterparty claimed. POST /v1/verify/gstin returns data for all three, and this page is about reading that data correctly.
You send a 15-character GSTIN and, optionally, a business name. You get back the registration record as held in the GST system: the legal name and trade name, the status, the taxpayer type, the constitution of the business, the registration and last-update dates, the tax jurisdictions, the declared business activities, and the principal and additional places of business, each address both as one string and split into parts. The chapters below cover the structure of the number (including the state code table and the check digit), what the response still does not tell you, how to treat suspended and cancelled registrations, why a vendor's GSTIN may legitimately carry a different name from their PAN, how errors, billing and limits behave, and what the sandbox does and does not let you test. It closes with a full accounts-payable scenario, the mistakes we see in real integrations, and the questions that come up most often.
Exists, valid and active are three different questions
When a person says "check if the GSTIN is valid" they usually mean "is this vendor a registered, currently active taxpayer whose invoices I can book?". The API distinguishes the pieces, and so should your code.
The valid flag says the registry recognised the number. The gstinStatus field (the same value is in registrationStatus, which stays for existing integrations) says what state the registration is in, with Active being the one you want. A number can be recognised and still belong to a registration that has been suspended or cancelled. In production a cancelled registration is generally still a record the system knows about, so you should expect valid: true next to a status other than Active; do not assume the flag alone means "usable". The sandbox failure example behaves differently (it returns valid: false and a message, with no status at all), which is one more reason to write your decision rule on the status field rather than on a combination you have only seen in one environment.
The rule we recommend is short. Treat a GSTIN as usable when valid is true and registrationStatus equals Active, compared case-insensitively. Everything else falls into one of two buckets: not found, or found but not active. The two buckets deserve different messages to your user and different internal handling, which the status chapter covers.
Anatomy of a GSTIN: state code, PAN, entity number, check digit
A GSTIN is fifteen characters, and every position has a job.
| Position | Meaning |
|---|---|
| 1 to 2 | State or union territory code of the registration |
| 3 to 12 | The PAN of the taxpayer, ten characters |
| 13 | Entity number: how many registrations this PAN holds in that state (1 to 9, then letters) |
| 14 | The letter Z, a fixed value |
| 15 | A check character computed from the first fourteen |
Three consequences matter for design. First, the PAN is embedded, so you can extract it with gstin.slice(2, 12) and compare it with a PAN you already verified, at zero cost. A mismatch means the customer typed a GSTIN belonging to someone else. Second, a single PAN can hold many GSTINs: one per state, and more than one inside a state when the business has separate registrations there, which is what the entity number counts. Third, the first two digits tell you where the registration sits, which you need for place-of-supply logic on invoices.
State codes are the part people copy from outdated spreadsheets, so here is the list as commonly published. Confirm against the current list on the GST portal before you hard-code it, because territories and codes have been reorganised before.
| Code | State or territory | Code | State or territory |
|---|---|---|---|
| 01 | Jammu and Kashmir | 21 | Odisha |
| 02 | Himachal Pradesh | 22 | Chhattisgarh |
| 03 | Punjab | 23 | Madhya Pradesh |
| 04 | Chandigarh | 24 | Gujarat |
| 05 | Uttarakhand | 25 | Daman and Diu (older registrations) |
| 06 | Haryana | 26 | Dadra and Nagar Haveli and Daman and Diu |
| 07 | Delhi | 27 | Maharashtra |
| 08 | Rajasthan | 28 | Andhra Pradesh (older registrations, before the 2014 split) |
| 09 | Uttar Pradesh | 29 | Karnataka |
| 10 | Bihar | 30 | Goa |
| 11 | Sikkim | 31 | Lakshadweep |
| 12 | Arunachal Pradesh | 32 | Kerala |
| 13 | Nagaland | 33 | Tamil Nadu |
| 14 | Manipur | 34 | Puducherry |
| 15 | Mizoram | 35 | Andaman and Nicobar Islands |
| 16 | Tripura | 36 | Telangana |
| 17 | Meghalaya | 37 | Andhra Pradesh |
| 18 | Assam | 38 | Ladakh |
| 19 | West Bengal | 97 | Other territory |
| 20 | Jharkhand | 99 | Centre jurisdiction |
The API's own format check follows the standard layout: two digits, a ten-character PAN pattern, a non-zero entity character, the letter Z, and one final alphanumeric character. It does not check the state code against the table above and it does not verify the check character. Both checks are cheap to run yourself and both save paid calls. The check character is computed over the first fourteen characters with a base-36 weighting, and this function implements it.
const ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const GSTIN_RE = /^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/;
const STATES = new Set(["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","97","99"]);
export function checkDigit(first14) {
let sum = 0;
for (let i = 0; i < 14; i++) {
const product = ALPHABET.indexOf(first14[i]) * (i % 2 === 0 ? 1 : 2);
sum += Math.floor(product / 36) + (product % 36);
}
return ALPHABET[(36 - (sum % 36)) % 36];
}
export function inspectGstin(raw, { enforceChecksum = true } = {}) {
const gstin = String(raw ?? "").replace(/\s+/g, "").toUpperCase();
if (!GSTIN_RE.test(gstin)) return { ok: false, reason: "format" };
if (!STATES.has(gstin.slice(0, 2))) return { ok: false, reason: "state_code" };
if (enforceChecksum && checkDigit(gstin.slice(0, 14)) !== gstin[14]) return { ok: false, reason: "check_digit" };
return { ok: true, gstin, state: gstin.slice(0, 2), pan: gstin.slice(2, 12) };
}One warning about that checksum. The reserved sandbox GSTINs are synthetic and do not satisfy it (the sample GSTIN in the API documentation does), so pass enforceChecksum: false in tests and sandbox runs, and leave it on in production, where a failed check digit means the number cannot belong to a real registration.
The request and the response, field by field
The tables below are rendered from the API data that also drives the reference page. The request takes gstin (required) and businessName (optional, up to 256 characters). The response guarantees referenceId, verificationId, gstin, GSTIN and valid; everything else is optional and appears when the registry provides it.
Request parameters
| Field | Type | Description |
|---|---|---|
Authorizationrequired | header | Bearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted. |
gstinrequired | string | 15-character GSTIN, format 07AAAAA1111A1Z1. |
businessName | string | Business (legal or trade) name to cross-check against the registration. |
Response fields
| Field | Type | Description |
|---|---|---|
referenceId | string | StampMitra's own transaction id for this call (SMV-YYYYMMDD-XXXXXXX). Always present, including on a negative result. |
verificationId | string | StampMitra's own id for this verification (VRF- followed by 12 base32 characters). Generated for every call, unique to it. Always present. Quote it in support requests. |
gstin | string | The GSTIN that was verified. Always present; on an unknown GSTIN it is the number you sent. |
GSTIN | string | Same value as gstin. Kept so existing integrations keep working. |
valid | boolean | Whether the GSTIN exists and is registered. Always present. |
legalNameOfBusiness | string | Legal name of the business registered against this GSTIN. |
tradeNameOfBusiness | string | Trade name of the business, when it has one. |
centerJurisdiction | string | Central tax jurisdiction (range) of the registration. |
stateJurisdiction | string | State tax jurisdiction of the registration. |
dateOfRegistration | string | Date of GST registration, ISO yyyy-mm-dd. |
constitutionOfBusiness | string | Constitution of the business (legal form), for example Public Limited Company. |
taxpayerType | string | Taxpayer type, for example Regular or Composition. |
gstinStatus | string | GST registration status, for example Active. |
lastUpdateDate | string | Date the registration record was last updated, ISO yyyy-mm-dd. |
natureOfBusinessActivities | array | Nature of business activities declared on the registration. |
principalPlaceAddress | string | Principal place of business as one address string. |
principalPlaceSplitAddress | object | Principal place of business split into parts. |
principalPlaceSplitAddress.buildingName | string | Building or premises name. |
principalPlaceSplitAddress.street | string | Street / road. |
principalPlaceSplitAddress.location | string | Locality. |
principalPlaceSplitAddress.buildingNumber | string | Building or door number. |
principalPlaceSplitAddress.district | string | District. |
principalPlaceSplitAddress.state | string | State. |
principalPlaceSplitAddress.city | string | City. |
principalPlaceSplitAddress.flatNumber | string | Flat / floor. |
principalPlaceSplitAddress.latitude | string | Latitude, as a string exactly as the registry returns it. |
principalPlaceSplitAddress.longitude | string | Longitude, as a string exactly as the registry returns it. |
principalPlaceSplitAddress.pincode | string | Six-digit PIN code. |
additionalAddresses | array | Additional places of business on the registration. |
additionalAddresses[].address | string | The additional place of business as one address string. |
additionalAddresses[].splitAddress | object | The same address split into parts. |
additionalAddresses[].splitAddress.buildingName | string | Building or premises name. |
additionalAddresses[].splitAddress.street | string | Street / road. |
additionalAddresses[].splitAddress.location | string | Locality. |
additionalAddresses[].splitAddress.buildingNumber | string | Building or door number. |
additionalAddresses[].splitAddress.district | string | District. |
additionalAddresses[].splitAddress.state | string | State. |
additionalAddresses[].splitAddress.city | string | City. |
additionalAddresses[].splitAddress.flatNumber | string | Flat / floor. |
additionalAddresses[].splitAddress.latitude | string | Latitude, as a string exactly as the registry returns it. |
additionalAddresses[].splitAddress.longitude | string | Longitude, as a string exactly as the registry returns it. |
additionalAddresses[].splitAddress.pincode | string | Six-digit PIN code. |
message | string | Human-readable outcome, for example GSTIN Exists or GSTIN Doesn't Exist. |
legalName | string | Same value as legalNameOfBusiness. Kept so existing integrations keep working. |
tradeName | string | Same value as tradeNameOfBusiness. Kept so existing integrations keep working. |
registrationStatus | string | Same value as gstinStatus. Kept so existing integrations keep working. |
principalPlaceOfBusiness | string | Same value as principalPlaceAddress. Kept so existing integrations keep working. |
Read the optional fields carefully. legalNameOfBusiness is the name the registration was taken in; for a company it is the registered company name, for a proprietor it is the proprietor's name. tradeNameOfBusiness is the name the business trades under and can be empty or identical to the legal name. principalPlaceAddress is a single free-text address string for the main place of business, and principalPlaceSplitAddress gives the same place in parts (building, street, locality, district, city, state, PIN code, and a latitude and longitude that arrive as strings). Prefer the split fields over trying to parse the string with a regular expression, and keep the string for display. additionalAddresses lists every other place of business, each with its own address and splitAddress. None of these is a delivery address, and any part can be an empty string when the registry has nothing for it. constitutionOfBusiness, taxpayerType, dateOfRegistration, lastUpdateDate, centerJurisdiction, stateJurisdiction and natureOfBusinessActivities describe the registration itself. Dates are ISO yyyy-mm-dd strings. Four names from earlier versions of this page stay in the response with the same value as their full-name twin: legalName, tradeName, registrationStatus and principalPlaceOfBusiness, and the upper-case GSTIN repeats gstin. gstin is the number you sent, normalised by the registry, so you can still key on your own record, and it is present even when the number does not exist.
referenceId is StampMitra's own identifier for the call, in the form SMV-YYYYMMDD-XXXXXXX. It is present even on a negative answer. Store it with the vendor record and quote it to support. It is not an idempotency key.
Reading registrationStatus: active, suspended, cancelled
Registrations move through states, and each state implies something different for you. The label you will see most is Active. Registrations can also be suspended, typically while a cancellation process is pending or on a compliance action, and they can be cancelled, either at the taxpayer's request or by the tax officer. Other labels can appear on some records, so write code that treats anything other than Active as a case to route, not as an error.
| Status you see | What it generally means | What most onboarding teams do |
|---|---|---|
Active | Registered and in force | Proceed; run the name comparison |
Suspended | Registration is temporarily not in force | Pause onboarding or payment; ask the vendor to explain |
Cancelled | Registration ended | Do not onboard as a registered supplier; ask for the current GSTIN |
| Anything else | Unknown label | Manual review; log the full response |
Not found (valid: false in production) | No such number on record | Ask for re-entry once; then escalate |
For a new vendor the decision is usually simple: you want an active registration, and anything else is a conversation. For an existing vendor the stakes are higher and the policy belongs to your finance and tax team, not to your engineers. A supplier whose registration was cancelled, sometimes with effect from an earlier date, can create questions about the input tax credit you claimed on their invoices, and a rule on that point can change. We say this to explain why a status change deserves an alert, not to give tax advice; confirm the current rule with your tax adviser.
A practical pattern is to store the status you last saw and the date you saw it, re-check on a schedule that matches your risk, and raise a ticket whenever an active vendor turns into anything else. The monthly sweep in the worked example below shows the cost and throughput of doing this for a vendor base of a few thousand.
The composition scheme, and what the response still does not tell you
The registry holds more than the API returns. The response carries the registration record described above, and that is what you should plan on. It does not return the return-filing history, the turnover slab or the promoters, so features that need those cannot be built on this endpoint today.
The taxpayer type is the field that matters most to accounts teams, and it is now in the response as taxpayerType. Under the composition scheme a small taxpayer pays tax at a fixed percentage of turnover instead of the normal regime. In broad terms, such a taxpayer does not issue a tax invoice with a GST line, issues a bill of supply instead, and cannot pass on input tax credit to the buyer. The thresholds and rates for the scheme are set by the government and revised from time to time, so check the current position. The important point for your design is that a composition taxpayer's GSTIN has exactly the same shape as any other, so the number alone never tells you; read taxpayerType (for example Regular) and store it with the date you checked. If your accounts payable logic depends on knowing that a vendor is on the scheme, because you would otherwise look for GST on their invoices, treat anything other than Regular as a reason to look at the invoice before booking it, and re-check on your usual schedule, because the type can change.
State-specific logic works the same way. The first two digits give you the state of registration and principalPlaceSplitAddress.state gives the state of the main place of business, but the response does not tell you whether the vendor also has registrations in other states. For that you want the PAN to GSTIN API, covered below.
Legal name, trade name and the name your user typed
The businessName field exists so that you can say which name you expect. At the time of writing the documented response does not carry a match score or verdict for GSTIN the way the PAN API does, so the comparison is yours to make: take the name your user gave you and compare it with legalName and tradeName.
Do the comparison on normalised strings. Uppercase both, replace & with AND, expand PVT and PVT. to PRIVATE, expand LTD and LTD. to LIMITED, drop punctuation, collapse spaces. Then accept an exact match against either name, and route near misses to a person. A short helper keeps this consistent across your code base.
import re
_REPLACEMENTS = [(r"\bPVT\b\.?", "PRIVATE"), (r"\bLTD\b\.?", "LIMITED"), (r"\bCO\b\.?", "COMPANY"), (r"&", " AND ")]
def normalise_business_name(name: str) -> str:
n = (name or "").upper()
for pattern, repl in _REPLACEMENTS:
n = re.sub(pattern, repl, n)
n = re.sub(r"[^A-Z0-9 ]+", " ", n)
return re.sub(r"\s+", " ", n).strip()
def names_agree(typed: str, legal: str | None, trade: str | None) -> bool:
t = normalise_business_name(typed)
return t != "" and t in {normalise_business_name(legal or ""), normalise_business_name(trade or "")}A mismatch is often innocent. A sole proprietor may hold a GSTIN whose legal name is their personal name and whose trade name is their shop, while the invoice header carries the shop name. A company may have changed its name and not updated an older form. A franchisee may use the franchisor's brand. Build a review screen that shows the typed name, the legal name, the trade name and the PAN holder's name side by side, and record the reviewer's reason. That record is what you will need when someone asks, months later, why a vendor was approved.
One PAN, many GSTINs: choosing the right registration
A business that operates in several states has several GSTINs under one PAN, and a supplier invoice normally has to carry the GSTIN of the registration from which the supply is made. This matters in two places.
When you onboard a vendor, ask which registration they will invoice from and verify that one. A vendor who gives you their head-office GSTIN but ships from a warehouse in another state will produce invoices with a different GSTIN than the one you verified, and your three-way match will fail on a technicality. If the vendor does not know or the form is ambiguous, use the PAN to GSTIN lookup to list all registrations and let the vendor choose.
When you issue invoices to a business customer, the same logic applies in reverse: the customer's GSTIN for the state they are buying for decides the place of supply and therefore the tax treatment. Do not store one GSTIN per customer by default; store one per customer location where it matters. Detailed place-of-supply rules are a tax topic, so take advice from your tax team on specifics.
Calling the API from Node.js and Python
Both snippets validate the GSTIN locally (format, state code, and the check digit outside sandbox), send an idempotency key, retry only what can succeed on retry, and return an outcome your business logic can switch on. They apply the rule from the first chapter: usable means valid and active.
// verify-gstin.mjs (Node.js 18+); uses inspectGstin from above
import { randomUUID } from "node:crypto";
import { inspectGstin } from "./gstin-check.mjs";
const BASE = "https://api-b2b.stampmitra.in";
const RETRYABLE = new Set([429, 502, 503, 504]);
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
export async function verifyGstin(raw, businessName) {
const local = inspectGstin(raw, { enforceChecksum: process.env.STAMPMITRA_ENV === "production" });
if (!local.ok) return { outcome: "bad_input", reason: local.reason };
const key = randomUUID();
const body = JSON.stringify({ gstin: local.gstin, ...(businessName?.trim() ? { businessName: businessName.trim() } : {}) });
for (let attempt = 1; attempt <= 4; attempt++) {
let res;
try {
res = await fetch(`${BASE}/v1/verify/gstin`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": key },
body,
signal: AbortSignal.timeout(20_000),
});
} catch {
if (attempt === 4) return { outcome: "unavailable" };
await sleep(2 ** attempt * 500 + Math.random() * 250);
continue;
}
const json = await res.json().catch(() => ({}));
if (res.ok) {
const active = json.valid === true && String(json.registrationStatus ?? "").toLowerCase() === "active";
return {
outcome: active ? "active" : json.valid === true ? "found_not_active" : "not_found",
referenceId: json.referenceId,
status: json.registrationStatus,
legalName: json.legalName,
tradeName: json.tradeName,
stateCode: local.state,
panInGstin: local.pan,
};
}
if (RETRYABLE.has(res.status) && attempt < 4) {
await sleep(2 ** attempt * 500 + Math.random() * 250);
continue;
}
const err = json.error ?? {};
return { outcome: res.status === 402 ? "wallet_empty" : "error", status: res.status, code: err.code, requestId: err.requestId };
}
}# verify_gstin.py (Python 3.9+, pip install requests)
import os, re, time, uuid, random, requests
BASE = "https://api-b2b.stampmitra.in"
GSTIN_RE = re.compile(r"^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$")
RETRYABLE = {429, 502, 503, 504}
def verify_gstin(raw, business_name=None):
gstin = re.sub(r"\s+", "", raw or "").upper()
if not GSTIN_RE.match(gstin):
return {"outcome": "bad_input"}
payload = {"gstin": gstin}
if business_name and business_name.strip():
payload["businessName"] = business_name.strip()
key = str(uuid.uuid4())
for attempt in range(1, 5):
try:
r = requests.post(
f"{BASE}/v1/verify/gstin",
json=payload,
headers={"Authorization": f"Bearer {os.environ['STAMPMITRA_API_KEY']}", "Idempotency-Key": key},
timeout=20,
)
except requests.RequestException:
if attempt == 4:
return {"outcome": "unavailable"}
time.sleep(2 ** attempt * 0.5 + random.random() * 0.25)
continue
body = r.json() if r.content else {}
if r.ok:
status = str(body.get("registrationStatus") or "").lower()
if body.get("valid") is True and status == "active":
outcome = "active"
elif body.get("valid") is True:
outcome = "found_not_active"
else:
outcome = "not_found"
return {"outcome": outcome, "referenceId": body.get("referenceId"), "status": body.get("registrationStatus"),
"legalName": body.get("legalName"), "tradeName": body.get("tradeName"), "pan": gstin[2:12]}
if r.status_code in RETRYABLE and attempt < 4:
time.sleep(2 ** attempt * 0.5 + random.random() * 0.25)
continue
err = body.get("error", {})
return {"outcome": "wallet_empty" if r.status_code == 402 else "error", "status": r.status_code,
"code": err.get("code"), "requestId": err.get("requestId")}The same call from a terminal looks like this.
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/gstin" \
-H "Authorization: Bearer $STAMPMITRA_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"gstin":"07AAAAA1111A1Z1","businessName":"Jane Doe Enterprises"}'The official SDKs on the SDKs page wrap the same call with typed responses and the same retry rules, and the Postman collection is the quickest way to try it by hand. For the wider GSTIN picture, including how it fits a vendor flow, read the guide on GSTIN verification in India.
Errors, retries and idempotency
Every failure has one body shape, { "error": { "code", "message", "requestId" } }. Branch on status and code, log requestId, and never parse message.
400Validation errorBAD_REQUESTgstin must match the format 07AAAAA1111A1Z1
401Missing or invalid API keyUNAUTHORIZEDMissing or invalid API key.
402Insufficient wallet balancePAYMENT_REQUIREDInsufficient fulfilment wallet balance to cover this call.
403Valid key, missing required scopeFORBIDDENAPI key is valid but lacks the required scope for this endpoint.
429Rate limitedTOO_MANY_REQUESTSRate limit exceeded: 60 requests per 60 seconds for this endpoint.
502Upstream verification service unreachableINTERNAL_ERRORUnable to reach the order/customer service right now
A 400 on this endpoint means the GSTIN did not match the format rule, or you sent a property the API does not know. It never means "this GSTIN does not exist"; that is a 200 with valid: false. A 402 means the wallet cannot cover the call and the lookup did not run. A 429 means you exceeded the plan's per-minute limit, and a 502 means the upstream source could not be reached, in which case no verdict about the GSTIN exists yet.
Use an Idempotency-Key on every call. If a response is lost to a timeout, retrying with the same key returns the stored response instead of running a second lookup and a second debit. Use a new key for each new verification and keep the same key across the retries of one. Reusing a key with a different GSTIN is refused with a 422 IDEMPOTENCY_KEY_REUSED, and a second request with the same key that arrives while the first is still running receives a 409 IDEMPOTENCY_IN_PROGRESS with a Retry-After header. Wait, then resend the identical request to get the first answer.
Billing, limits and monitoring
A completed lookup is billed, whether or not the GSTIN exists. A call that fails is not billed, and sandbox calls are never billed. In production the amount is taken from your prepaid wallet at the per-call rate, which on pay-as-you-go is ₹5 before GST and lower on Growth and Scale; see pricing for the current table. When the wallet cannot cover a call you get a 402 before any lookup happens.
Rate limits belong to your plan and are shared by every key and route in an environment, counted per minute: at the time of writing 60 on pay-as-you-go, 300 on Growth, 1,000 on Scale, and 10 for a sandbox key, plus 200 requests a day per organisation. A fixed one-minute window lets a burst straddling a boundary briefly exceed the figure, so pace batch jobs below the limit. Extra keys do not add capacity, and rotating keys to dodge the limit is prohibited by the acceptable use policy.
Every call, successful or not, shows up in the request logs in your dashboard and through the logs endpoint, for as long as your plan retains them (30, 90 or 365 days at the time of writing). Chart three ratios: not-active results as a share of answers, which tells you about the health of your vendor base; 402s, which tell you about your wallet; and 429s and 502s, which tell you about your pacing and your dependency.
Sandbox and production: what you can and cannot test
Sandbox keys begin with sk_test_, production keys with sk_live_, and nothing else about the request changes. Sandbox answers are stored samples, not lookups. The reserved GSTIN 09SNDBX9999F1Z5 returns the not-found answer: valid: false with the message GSTIN Doesn't Exist. Any other well-formed GSTIN returns the full documented example record, with the GSTIN you sent in gstin and GSTIN. The two ids are fresh on every call, and sandbox responses carry sandbox: true and a notice.
Know what this lets you test: your active branch, your not-active branch, and your parsing. It does not let you test a suspended registration, a composition taxpayer, a multi-state PAN or a real registration; every sandbox success is the same documented example record, with your GSTIN in gstin and GSTIN. Build fixtures from your own recorded production responses, with data removed, for those. Remember that the reserved GSTINs fail the check-digit rule, and that their embedded PAN is the same as the reserved test PANs, so a PAN-then-GSTIN test chain hangs together.
Sandbox is small by design. It allows 10 requests a minute and 200 a day per organisation (the day resets at midnight IST), after which the API answers 429, and it keeps call history for 30 days, so it is for proving an integration, not for load tests. The readiness runner in your dashboard runs scripted scenarios without using up those limits. Going live means applying for production access from the dashboard, which is reviewed, funding the wallet, issuing a production key with only the scopes you need, restricting it by IP where your plan allows, and rolling out behind a flag. The guide on sandbox versus production keys goes through the details.
A worked scenario: an accounts-payable vendor master with a monthly sweep
Take an invented distributor, Narmada Foods, with 3,000 active vendors and an accounts payable team that wants to stop paying invoices against registrations that are no longer in force.
At onboarding, a vendor submits a GSTIN, a PAN and a legal name. The code runs the local checks: format, state code, check digit, and gstin.slice(2, 12) === pan. Failing the last one is the most useful free check in the whole flow, because it catches the commonest data-entry error, a GSTIN pasted from a different company. Then it makes the paid call. The result is active, the legal name agrees after normalisation, and the vendor is created. The team stores the GSTIN, referenceId, the status, the check date and nothing from the address.
Each month a job selects every vendor whose last check is older than thirty days and re-verifies the GSTIN. At 3,000 calls the job is trivial in cost terms: 3,000 multiplied by the per-call rate, plus 18% GST. In time terms it matters. On a plan that allows 60 requests a minute the sweep needs at least fifty minutes if it runs alone, and your interactive onboarding traffic shares the same bucket, so the job should be paced at roughly half the limit and run overnight. On a plan with 300 a minute it takes ten. The job uses a stable idempotency key per vendor per month, so a crashed run that restarts does not pay twice for vendors it already completed.
When a vendor turns from Active to anything else, the job writes an event rather than blocking anything automatically. A person in finance sees the vendor, the old and new status and the date, and decides whether to hold payments, ask the vendor for an explanation or take advice. When a lookup returns valid: false for a GSTIN that was previously valid, the job also raises an event, but with lower priority, because that outcome is rare enough to deserve a human look before anyone assumes the number has vanished.
Combining GSTIN with PAN, PAN to GSTIN, CIN and bank checks
GSTIN verification is one node in a graph. The edges are worth knowing.
| Starting point | Next call | What it adds |
|---|---|---|
| A PAN only | PAN to GSTIN | The list of GSTINs and their states |
| A GSTIN | PAN with the PAN from characters 3 to 12 | Holder category and registered name of the PAN holder |
| A company | CIN | Company status and directors |
| A small enterprise | Udyam | MSME registration and classification |
| A payout | Bank account | Whether money will reach the right name |
Order calls from cheapest and most certain to most expensive. Local checks, then PAN if you do not already hold a verified one, then GSTIN, then the rest. A broader view for lenders and fintechs is in the KYC use case, and the guide on business verification with GSTIN, CIN and Udyam shows the multi-registry design.
Moving from another GSTIN provider
If you already call a different GSTIN lookup service, the migration is mostly a mapping exercise, and it is safer to do it in the open than in one release. Write down which of your fields come from the old provider's response: legal name, trade name, status, address, and anything beyond that such as taxpayer type, registration date or jurisdiction. Compare that list with the fields in the table above; most of them have a counterpart here. Wherever the old provider returned something this endpoint does not, decide before cutover whether the feature survives, is sourced from the vendor's certificate, or is dropped.
Status vocabularies differ between providers, and so does the question of whether a cancelled registration comes back as found or not found. Do not port the old branching logic. Port your business rule (active registrations are usable, everything else is routed) and re-implement it on valid plus registrationStatus. Then run both providers side by side on a sample of your own vendor base for a few days, compare outcomes, and look at each disagreement by hand. Most will be explained by timing, because registries change, and by status wording. The few that remain are the ones worth raising with support, with the referenceId of each call.
Finally, move your idempotency behaviour with you. If the old integration deduplicated retries on your side, keep that, and add the Idempotency-Key header so that StampMitra deduplicates as well. Switch your wallet alerts and request-log dashboards before you switch traffic, not after.
A simple cost model
Costs for this endpoint scale linearly, which makes them easy to model and easy to waste. Count four kinds of call: onboarding checks, one per new vendor or customer; scheduled re-checks, one per vendor per cycle; on-demand checks triggered by an event, such as a large payment or a changed bank account; and retries, which cost nothing if your idempotency keys are right. Multiply each by the per-call rate shown on the pricing page, add 18% GST, and compare the total with the plan fee on Growth or Scale, whose lower rates start to pay for the plan at higher volumes.
The cheapest saving is local validation, because every call that fails the format, state code or check digit rule is a billed valid: false you did not need. The second is choosing the re-check interval by risk. A vendor you pay every week and whose invoices carry large tax amounts deserves a monthly check; a dormant vendor does not need one until the day you pay them. The third is checking before payment runs, not on a calendar: a check triggered by an invoice approval catches the change that matters, at the moment it matters.
Edge cases and mistakes
- Lowercase and spaces. Normalise before you validate. The API will refuse a lowercase GSTIN.
- Special registrations. Some registration categories, such as those for tax deductors or certain foreign suppliers, can carry identifiers that do not follow the standard layout. The API's format check follows the standard layout, so test any such number before you depend on this endpoint for it.
- Old state codes. Registrations made before a reorganisation can carry a code that is no longer the current one for that region. Do not reject a number only because its state code looks out of date.
- Branch versus head office. The GSTIN of a branch in another state is a different number. A match on PAN is expected; a match on GSTIN is what proves it is the right registration.
- Empty trade name. Many registrations have none. Compare against the legal name instead.
- Address changes. The principal place of business is a snapshot. Use it for plausibility, never as a delivery address.
- Treating
validas "active". The most common modelling error on this endpoint; use the status field. - Paying for typos. Check format, state and check digit before the call. A mistyped GSTIN returns a billed
valid: false. - Displaying raw errors to users. Map 400 to a prompt to check the number and everything else to a neutral message.
- Storing too much. You do not need the address or the legal name for most workflows. Keep the minimum.
Data handling and consent in general terms
GST registration details are visible to anyone through the public taxpayer search on the GST portal, which is part of why this lookup exists. That does not make them free of obligations. For a proprietor, the legal name on a GSTIN is a person's name, and the principal place of business may be a home address. Collect the GSTIN for a stated purpose, tell the vendor or customer what you will check and why, keep a record of that notice, and use the result only for that purpose. Do not run lookups on numbers you were not given for a business reason, and do not use the API to compile lists; the acceptable use policy prohibits enumeration.
Keep the audit row small: your vendor id, referenceId, the GSTIN (it is a business identifier, but treat it with care for proprietors), the status, the check date, the rule version and the reviewer's note if there was one. Keep names and addresses out of logs. India's Digital Personal Data Protection Act, 2023 is being brought into force in phases and affects personal data in this flow; this page is general information, not legal advice, so confirm your obligations with qualified counsel. The developer privacy policy and the data processing addendum describe how responsibilities are divided with StampMitra.
Sources and what to confirm
- StampMitra GSTIN verification reference, API docs: endpoint, scope, parameters, response and error examples, checked against the product data in 2026.
- StampMitra pricing and authentication pages: per-call rates, plan limits, key model and environments, read in 2026.
- GST portal (gst.gov.in): the state code list, the taxpayer search, and the registration and composition scheme rules. The state table and the check-digit method on this page are widely published conventions; confirm both against the current official sources before you hard-code them, and check the current thresholds and rules for the composition scheme and input tax credit.
- StampMitra acceptable use policy: purpose limits and the ban on enumeration and rate-limit evasion, read in 2026.
Sandbox test values
Send one of these values as gstin with a sandbox key (sk_test_...) to get that outcome. They are fake, valid in format, and never reach a real source or your wallet. Send with it: businessName: Sandbox Traders. Add the header X-Sandbox-Delay-Ms (up to 3000) to hold the reply and test your client timeout.
| Scenario | Input to send | What you get back |
|---|---|---|
| Valid, active GSTIN | 07SNDBX0001F1ZS | 200 |
| GSTIN not found | 07SNDBX0002F1ZR | 200 |
| GSTIN cancelled | 07SNDBX0004F1ZP | 200 |
| Verification source times out | 07SNDBX0005F1ZO | 502INTERNAL_ERROR |
| Verification source unavailable | 07SNDBX0006F1ZN | 502INTERNAL_ERROR |
| Rate limited | 07SNDBX0007F1ZM | 429TOO_MANY_REQUESTS |
| Wallet balance too low | 07SNDBX0008F1ZL | 402PAYMENT_REQUIRED |
| Invalid format | 07SNDBX0000F1Z | 400BAD_REQUEST |
Frequently asked questions
What is the difference between a valid GSTIN and an active GSTIN?
The valid flag says the registry recognised the number. The gstinStatus field (also returned as registrationStatus) says whether the registration is in force. A recognised number can belong to a suspended or cancelled registration, so treat a GSTIN as usable only when valid is true and the status is Active.
How do I handle a cancelled or suspended GSTIN?
Route it instead of treating it as an error. For a new vendor, pause onboarding and ask for the current registration. For an existing vendor, raise an event for finance to decide on payment holds and tax questions, and confirm the current rules with your tax adviser.
Does the API tell me whether a vendor is under the composition scheme?
Yes. The response carries taxpayerType (for example Regular), next to the constitution of the business, the registration and last-update dates and the jurisdictions. A composition taxpayer's GSTIN looks like any other, so read taxpayerType rather than the number, and re-check on your usual schedule because the type can change.
What do the first two digits of a GSTIN mean?
They are the state or union territory code of the registration, for example 07 for Delhi, 27 for Maharashtra and 29 for Karnataka. Characters 3 to 12 are the taxpayer's PAN, the 13th is an entity number, the 14th is the letter Z and the 15th is a check character.
Can I validate the GSTIN check digit myself?
Yes. The check character is computed over the first 14 characters with a base-36 weighting, and the page includes a function for it. Use it in production to avoid paying for typos, but skip it in sandbox, because the reserved test GSTINs do not satisfy it.
Does the businessName field produce a match score?
Not in the documented response today. The field is accepted so you can state the name you expect, but the response has no GSTIN match verdict, so compare your typed name with legalNameOfBusiness and tradeNameOfBusiness yourself after normalising case, punctuation and suffixes like Pvt and Ltd.
Am I billed when the GSTIN does not exist?
Yes. A call that completes with an answer is billed, and valid false is an answer. Calls that fail with a 400, 429 or 502 are not billed, and sandbox calls are never billed. Validate the format, state code and check digit locally first.
What are the rate limits for GSTIN verification?
The limit belongs to your plan and is shared across all keys and routes in an environment, counted per minute. At the time of writing it is 60 per minute on pay-as-you-go, 300 on Growth and 1,000 on Scale, and 10 for a sandbox key, plus 200 requests a day per organisation. Check the pricing page for the current figures.
How do I make a retry safe after a timeout?
Send an Idempotency-Key header and reuse the same key on the retry. The API then returns the stored response without a second lookup or a second debit. Using the same key with a different GSTIN is rejected with a 422 IDEMPOTENCY_KEY_REUSED.
Which GSTINs can I use in the sandbox?
09SNDBX9999F1Z5 returns valid false with the message GSTIN Doesn't Exist. Any other well-formed GSTIN returns the full documented example record, including both address blocks, with your GSTIN in gstin and GSTIN. Sandbox cannot show a cancelled or composition registration.
Why might a vendor's GSTIN name differ from their PAN name?
A sole proprietor can hold a GSTIN with a trade name that differs from the personal name on the PAN, and companies sometimes change names without updating every record. Treat a mismatch as a question for a reviewer, with both names shown side by side, not as an automatic rejection.
How often should I re-verify vendor GSTINs?
Match the interval to risk. A monthly re-check suits vendors you pay often with large tax amounts, while dormant vendors can wait until the day you pay them. A check triggered by invoice approval catches changes at the moment they matter, and keeps cost proportional to activity.