StampMitraDevelopers
LiveVerification API

GSTIN verification API: registration status, legal name and what valid really means

Verify a GSTIN in real time.

POST/v1/verify/gstinScope verification.gstin.read₹5 per call
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/gstin" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "gstin": "29AAICP2912R1ZR",
    "businessName": "UJJIVAN SMALL FINANCE BANK LIMITED"
  }'
Example responseJSON
{
  "referenceId": "SMV-20260927-9K21P4",
  "verificationId": "VRF-4M8Q2T7XB9KD",
  "gstin": "29AAICP2912R1ZR",
  "GSTIN": "29AAICP2912R1ZR",
  "valid": true,
  "legalNameOfBusiness": "UJJIVAN SMALL FINANCE BANK LIMITED",
  "tradeNameOfBusiness": "UJJIVAN SMALL FINANCE BANK",
  "centerJurisdiction": "I-A RANGE",
  "stateJurisdiction": "GUWAHATI - A - 1",
  "dateOfRegistration": "2017-09-30",
  "constitutionOfBusiness": "Public Limited Company",
  "taxpayerType": "Regular",
  "gstinStatus": "Active",
  "lastUpdateDate": "2022-03-01",
  "natureOfBusinessActivities": [
    "Retail Business",
    "Supplier of Services",
    "Recipient of Goods or Services",
    "Office / Sale Office",
    "Others"
  ],
  "principalPlaceAddress": "First Floor 3512-DISPUR Prithivi Mansion opp. KFC building G.S. Road, Lachit Nagar Assam 781007",
  "principalPlaceSplitAddress": {
    "buildingName": "Prithivi Mansion",
    "street": "G.S. Road",
    "location": "Lachit Nagar",
    "buildingNumber": "3512-DISPUR",
    "district": "Guwahati",
    "state": "Assam",
    "city": "Dispur",
    "flatNumber": "First Floor",
    "latitude": "26.1445",
    "longitude": "91.7362",
    "pincode": "781007"
  },
  "additionalAddresses": [
    {
      "address": "Mirza Santipur NH-37 Dist-Kamrup Rural PS-Palashbari, PO  Mirza Kamrup Assam 781125",
      "splitAddress": {
        "buildingName": "",
        "street": "NH-37",
        "location": "Santipur, Mirza",
        "buildingNumber": "",
        "district": "Kamrup Rural",
        "state": "Assam",
        "city": "Palashbari",
        "flatNumber": "",
        "latitude": "26.0926",
        "longitude": "91.5069",
        "pincode": "781125"
      }
    },
    {
      "address": "N.A.C.C.I. Foundation 3559-Tezpur CHAMBER BHAWAN Binjraj Road, P. o. and P.S. - Tezpur, Dist. Binjraj Road, P. o. and P.S. - Tezpur, Dist. Sonitpur Assam 784154",
      "splitAddress": {
        "buildingName": "CHAMBER BHAWAN",
        "street": "Binjraj Road",
        "location": "Tezpur",
        "buildingNumber": "3559-Tezpur",
        "district": "Sonitpur",
        "state": "Assam",
        "city": "Tezpur",
        "flatNumber": "",
        "latitude": "26.6338",
        "longitude": "92.8006",
        "pincode": "784154"
      }
    }
  ],
  "message": "GSTIN Exists",
  "legalName": "UJJIVAN SMALL FINANCE BANK LIMITED",
  "tradeName": "UJJIVAN SMALL FINANCE BANK",
  "registrationStatus": "Active",
  "principalPlaceOfBusiness": "First Floor 3512-DISPUR Prithivi Mansion opp. KFC building G.S. Road, Lachit Nagar Assam 781007"
}

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.

PositionMeaning
1 to 2State or union territory code of the registration
3 to 12The PAN of the taxpayer, ten characters
13Entity number: how many registrations this PAN holds in that state (1 to 9, then letters)
14The letter Z, a fixed value
15A 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.

CodeState or territoryCodeState or territory
01Jammu and Kashmir21Odisha
02Himachal Pradesh22Chhattisgarh
03Punjab23Madhya Pradesh
04Chandigarh24Gujarat
05Uttarakhand25Daman and Diu (older registrations)
06Haryana26Dadra and Nagar Haveli and Daman and Diu
07Delhi27Maharashtra
08Rajasthan28Andhra Pradesh (older registrations, before the 2014 split)
09Uttar Pradesh29Karnataka
10Bihar30Goa
11Sikkim31Lakshadweep
12Arunachal Pradesh32Kerala
13Nagaland33Tamil Nadu
14Manipur34Puducherry
15Mizoram35Andaman and Nicobar Islands
16Tripura36Telangana
17Meghalaya37Andhra Pradesh
18Assam38Ladakh
19West Bengal97Other territory
20Jharkhand99Centre 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.

JavaScript
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

Request parameters
FieldTypeDescription
AuthorizationrequiredheaderBearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted.
gstinrequiredstring15-character GSTIN, format 07AAAAA1111A1Z1.
businessNamestringBusiness (legal or trade) name to cross-check against the registration.

Response fields

Response fields
FieldTypeDescription
referenceIdstringStampMitra's own transaction id for this call (SMV-YYYYMMDD-XXXXXXX). Always present, including on a negative result.
verificationIdstringStampMitra'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.
gstinstringThe GSTIN that was verified. Always present; on an unknown GSTIN it is the number you sent.
GSTINstringSame value as gstin. Kept so existing integrations keep working.
validbooleanWhether the GSTIN exists and is registered. Always present.
legalNameOfBusinessstringLegal name of the business registered against this GSTIN.
tradeNameOfBusinessstringTrade name of the business, when it has one.
centerJurisdictionstringCentral tax jurisdiction (range) of the registration.
stateJurisdictionstringState tax jurisdiction of the registration.
dateOfRegistrationstringDate of GST registration, ISO yyyy-mm-dd.
constitutionOfBusinessstringConstitution of the business (legal form), for example Public Limited Company.
taxpayerTypestringTaxpayer type, for example Regular or Composition.
gstinStatusstringGST registration status, for example Active.
lastUpdateDatestringDate the registration record was last updated, ISO yyyy-mm-dd.
natureOfBusinessActivitiesarrayNature of business activities declared on the registration.
principalPlaceAddressstringPrincipal place of business as one address string.
principalPlaceSplitAddressobjectPrincipal place of business split into parts.
principalPlaceSplitAddress.buildingNamestringBuilding or premises name.
principalPlaceSplitAddress.streetstringStreet / road.
principalPlaceSplitAddress.locationstringLocality.
principalPlaceSplitAddress.buildingNumberstringBuilding or door number.
principalPlaceSplitAddress.districtstringDistrict.
principalPlaceSplitAddress.statestringState.
principalPlaceSplitAddress.citystringCity.
principalPlaceSplitAddress.flatNumberstringFlat / floor.
principalPlaceSplitAddress.latitudestringLatitude, as a string exactly as the registry returns it.
principalPlaceSplitAddress.longitudestringLongitude, as a string exactly as the registry returns it.
principalPlaceSplitAddress.pincodestringSix-digit PIN code.
additionalAddressesarrayAdditional places of business on the registration.
additionalAddresses[].addressstringThe additional place of business as one address string.
additionalAddresses[].splitAddressobjectThe same address split into parts.
additionalAddresses[].splitAddress.buildingNamestringBuilding or premises name.
additionalAddresses[].splitAddress.streetstringStreet / road.
additionalAddresses[].splitAddress.locationstringLocality.
additionalAddresses[].splitAddress.buildingNumberstringBuilding or door number.
additionalAddresses[].splitAddress.districtstringDistrict.
additionalAddresses[].splitAddress.statestringState.
additionalAddresses[].splitAddress.citystringCity.
additionalAddresses[].splitAddress.flatNumberstringFlat / floor.
additionalAddresses[].splitAddress.latitudestringLatitude, as a string exactly as the registry returns it.
additionalAddresses[].splitAddress.longitudestringLongitude, as a string exactly as the registry returns it.
additionalAddresses[].splitAddress.pincodestringSix-digit PIN code.
messagestringHuman-readable outcome, for example GSTIN Exists or GSTIN Doesn't Exist.
legalNamestringSame value as legalNameOfBusiness. Kept so existing integrations keep working.
tradeNamestringSame value as tradeNameOfBusiness. Kept so existing integrations keep working.
registrationStatusstringSame value as gstinStatus. Kept so existing integrations keep working.
principalPlaceOfBusinessstringSame 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 seeWhat it generally meansWhat most onboarding teams do
ActiveRegistered and in forceProceed; run the name comparison
SuspendedRegistration is temporarily not in forcePause onboarding or payment; ask the vendor to explain
CancelledRegistration endedDo not onboard as a registered supplier; ask for the current GSTIN
Anything elseUnknown labelManual review; log the full response
Not found (valid: false in production)No such number on recordAsk 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.

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.

JavaScript
// 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 };
  }
}
Python
# 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
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_REQUEST

    gstin must match the format 07AAAAA1111A1Z1

  • 401Missing or invalid API keyUNAUTHORIZED

    Missing or invalid API key.

  • 402Insufficient wallet balancePAYMENT_REQUIRED

    Insufficient fulfilment wallet balance to cover this call.

  • 403Valid key, missing required scopeFORBIDDEN

    API key is valid but lacks the required scope for this endpoint.

  • 429Rate limitedTOO_MANY_REQUESTS

    Rate limit exceeded: 60 requests per 60 seconds for this endpoint.

  • 502Upstream verification service unreachableINTERNAL_ERROR

    Unable 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 pointNext callWhat it adds
A PAN onlyPAN to GSTINThe list of GSTINs and their states
A GSTINPAN with the PAN from characters 3 to 12Holder category and registered name of the PAN holder
A companyCINCompany status and directors
A small enterpriseUdyamMSME registration and classification
A payoutBank accountWhether 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 valid as "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.

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.

Sandbox test values
ScenarioInput to sendWhat you get back
Valid, active GSTIN
07SNDBX0001F1ZS
200
200 with valid true, registrationStatus Active, legalName and tradeName.
GSTIN not found
07SNDBX0002F1ZR
200
200 with valid false and message "GSTIN Doesn't Exist".
GSTIN cancelled
07SNDBX0004F1ZP
200
200 with valid true but gstinStatus and registrationStatus Cancelled: the number exists and is no longer active.
Verification source times out
07SNDBX0005F1ZO
502INTERNAL_ERROR
Our documented upstream-failure error, answered at once (no waiting). Retry with the same Idempotency-Key. Add the header X-Sandbox-Delay-Ms (up to 3000) to hold the reply and test your client timeout.
Verification source unavailable
07SNDBX0006F1ZN
502INTERNAL_ERROR
Our documented 5xx error for an unreachable source (the same body a live call gives when the source is down). Safe to retry after a short delay.
Rate limited
07SNDBX0007F1ZM
429TOO_MANY_REQUESTS
Too many requests. Back off and retry with exponential delay and jitter.
Wallet balance too low
07SNDBX0008F1ZL
402PAYMENT_REQUIRED
The wallet cannot cover the call (catalogue entry INSUFFICIENT_WALLET_BALANCE, envelope code PAYMENT_REQUIRED). Nothing is debited in the sandbox. Top up and retry with the same Idempotency-Key.
Invalid format
07SNDBX0000F1Z
400BAD_REQUEST
Validation error that names the field. Nothing is looked up and nothing is charged.

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.

Build with AI

Integrate GSTIN with one prompt.

Pick your AI tool and copy a prompt written for this API. It already has the endpoints, fields and errors.

Claude prompt · GSTIN · 9,224 charactersOpen Claude ↗
I'm using Claude to build this.

Integrate the StampMitra API (Indian identity verification and e-Stamp Paper) into my app.

API facts (source of truth: https://developer.stampmitra.in/llms.txt)
- Base URL: https://api-b2b.stampmitra.in
- Auth: send "Authorization: Bearer <key>" (or "x-api-key: <key>") on every request
- Requests and responses are JSON. Send Content-Type: application/json on POST.
- Use a SANDBOX key (sk_test_...) while building. Read it from the environment variable STAMPMITRA_API_KEY.
- Never hard-code the key, never expose it to the browser, never log it.
- Call StampMitra only from server-side code. The UI calls my own backend route.

How to build it
- First inspect my project: language, framework, package manager, HTTP client, test runner and folder conventions. Follow them. If the project is empty, ask which stack I want before writing code.
- The official StampMitra SDKs (Node.js, Python, PHP, Java, Go, .NET, Ruby) are pre-release 0.1.0 and not yet published to npm, PyPI, Packagist, Maven Central, the Go module proxy, NuGet or RubyGems, so do not run an install command for them. Call the REST API over HTTPS with the HTTP client my project already uses. Do not install or invent a StampMitra package.
- Put every StampMitra call in ONE small client module. It adds the auth header, applies a 15 second timeout and turns error responses into a typed error with status, code, message and requestId.
- Add STAMPMITRA_API_KEY to .env.example with a placeholder (sk_test_xxx). Fail fast at startup with a clear message if it is missing. Never commit real keys.

Error handling (every error body is { error: { code, message, requestId } })
- 400 BAD_REQUEST: invalid input. Show a field-level message. Do not retry.
- 401 UNAUTHORIZED: key missing or invalid. This is my configuration problem, not the end user's. Show a generic "service unavailable" message, log the requestId, do not retry.
- 402 PAYMENT_REQUIRED: not enough wallet balance (production). Surface it to me as an operational alert, not to the end user.
- 403 FORBIDDEN: the key lacks the required scope or the service is not enabled. Say which scope the endpoint needs.
- 404 NOT_FOUND: wrong id or path. Do not retry.
- 429 TOO_MANY_REQUESTS (or, on a sandbox key, SANDBOX_RATE_LIMIT, SANDBOX_DAILY_LIMIT, SANDBOX_IP_LIMIT): rate limit, or the sandbox limits of 10 requests a minute and 200 a day per organisation. Retry at most 3 times with exponential backoff and jitter (honour Retry-After if present), then show a friendly "try again shortly" message.
- 5xx / 502 / network timeout: retry reads (GET) up to 2 times. For POST calls retry at most once, then show a friendly message.
- Log requestId and referenceId with every failure. Never log the API key, a full PAN, bank account number or whole response bodies.

TASK: Integrate the StampMitra "GSTIN" API
Verify a GSTIN in real time.
Production service code: gstin.verify

ENDPOINT: POST /v1/verify/gstin
- Verify GSTIN
- Required scope: verification.gstin.read
- Parameters:
  - gstin (string, required): 15-character GSTIN, format 07AAAAA1111A1Z1.
  - businessName (string, optional): Business (legal or trade) name to cross-check against the registration.
- Example request body: {"gstin":"29AAICP2912R1ZR","businessName":"UJJIVAN SMALL FINANCE BANK LIMITED"}
- Response fields: referenceId, verificationId, gstin, GSTIN, valid, legalNameOfBusiness, tradeNameOfBusiness, centerJurisdiction, stateJurisdiction, dateOfRegistration, constitutionOfBusiness, taxpayerType, gstinStatus, lastUpdateDate, natureOfBusinessActivities, principalPlaceAddress, principalPlaceSplitAddress, additionalAddresses, message, legalName, tradeName, registrationStatus, principalPlaceOfBusiness
- Example response: {"referenceId":"SMV-20260927-9K21P4","verificationId":"VRF-4M8Q2T7XB9KD","gstin":"29AAICP2912R1ZR","GSTIN":"29AAICP2912R1ZR","valid":true,"legalNameOfBusiness":"UJJIVAN SMALL FINANCE BANK LIMITED","tradeNameOfBusiness":"UJJIVAN SMALL FINANCE BANK","centerJurisdiction":"I-A RANGE","stateJurisdiction":"GUWAHATI - A - 1","dateOfRegistration":"2017-09-30","constitutionOfBusiness":"Public Limited Company","taxpayerType":"Regular","gstinStatus":"Active","lastUpdateDate":"2022-03-01","natureOfBusinessActivities":["Retail Business","Supplier of Services","Recipient of Goods or Services","Office / Sale Office","Others"],"principalPlaceAddress":"First Floor 3512-DISPUR Prithivi Mansion opp. KFC building G.S. Road, Lachit Nagar Assam 781007","principalPlaceSplitAddress":{"buildingName":"Prithivi Mansion","street":"G.S. Road","location":"Lachit Nagar","buildingNumber":"3512-DISPUR","district":"Guwahati","state":"Assam","city":"Dispur","flatNumber":"First Floor","latitude":"26.1445","longitude":"91.7362","pincode":"781007"},"additionalAddresses":[{"address":"Mirza Santipur NH-37 Dist-Kamrup Rural PS-Palashbari, PO  Mirza Kamrup Assam 781125","splitAddress":{"buildingName":"","street":"NH-37","location":"Santipur, Mirza","buildingNumber":"","district":"Kamrup Rural","state":"Assam","city":"Palashbari","flatNumber":"","latitude":"26.0926","longitude":"91.5069","pincode":"781125"}},{"address":"N.A.C.C.I. Foundation 3559-Tezpur CHAMBER BHAWAN Binjraj Road, P. o. and P.S. - Tezpur, Dist. Binjraj Road, P. o. and P.S. - Tezpur, Dist. Sonitpur Assam 784154","splitAddress":{"buildingName":"CHAMBER BHAWAN","street":"Binjraj Road","location":"Tezpur","buildingNumber":"3559-Tezpur","district":"Sonitpur","state":"Assam","city":"Tezpur","flatNumber":"","latitude":"26.6338","longitude":"92.8006","pincode":"784154"}}],"message":"GSTIN Exists","legalName":"UJJIVAN SMALL FINANCE BANK LIMITED","tradeName":"UJJIVAN SMALL FINANCE BANK","registrationStatus":"Active","principalPlaceOfBusiness":"First Floor 3512-DISPUR Prithivi Mansion opp. KFC building G.S. Road, Lachit Nagar Assam 781007"}
- Errors this endpoint can return:
  - 401 UNAUTHORIZED: Missing or invalid API key
  - 403 FORBIDDEN: Valid key, missing required scope
  - 400 BAD_REQUEST: Validation error
  - 402 PAYMENT_REQUIRED: Insufficient wallet balance
  - 429 TOO_MANY_REQUESTS: Rate limited
  - 502 INTERNAL_ERROR: Upstream verification service unreachable
- Notes: Input format is validated up front - a malformed pan/gstin/etc. fails fast with a 400 rather than being submitted for verification. referenceId (format SMV-YYYYMMDD-XXXXXXX) is StampMitra's own transaction id for this call and is always present, including on a negative (valid: false / found: false) result - both positive and negative determinations are completed, billable verifications. This is not an idempotency key. verificationId (format VRF-XXXXXXXXXXXX) is StampMitra's own id for this verification, generated for every call; quote it in support requests. Every field except referenceId, verificationId, gstin, GSTIN and valid is optional and is omitted when the registry does not provide it. Dates are ISO yyyy-mm-dd strings; latitude and longitude are strings. A GSTIN that does not exist returns HTTP 200 with valid false and a message, and none of the registration details. GSTIN and gstin carry the same value, as do legalName and legalNameOfBusiness, tradeName and tradeNameOfBusiness, registrationStatus and gstinStatus, principalPlaceOfBusiness and principalPlaceAddress; the older names are kept for existing integrations.

Rules for this verification
- Validate gstin on client and server before calling. A malformed value returns 400.
- "valid": false (or found: false) is a completed, billable verification. Show a clear "not valid" result, not a crash.
- Mask sensitive identifiers in the UI after submit and never log them in full.
- Store referenceId, the outcome and a timestamp with the record for audit. Do not re-call on every page load: cache per record.
- Build: one backend route that calls StampMitra, one small form, and a result card with loading, success, not-valid and error states.

Test in Sandbox
- A successful call, a validation failure (expect 400), a missing or wrong key (expect 401) and the 429 / 5xx retry path.

How I want you to work:
1. Before writing code, list the files you will create or change and the plan in 5-8 bullets. Then implement without pausing for approval.
2. If the StampMitra MCP server (@stampmitra/mcp-server) is connected, use it to run real sandbox calls and check the response shape before coding against it.
3. Write tests for the API client module and the validation (mock the HTTP layer).
4. At the end, summarise what you changed, how to run it and what I must do manually (add the key, restart the server).

Acceptance checklist:
- Works end to end in Sandbox with the real response fields (no mocked data in the final path)
- No secrets in client code, logs, URLs or git
- Clear loading, empty and error states, including 400, 401, 402, 403, 429 and 5xx
- referenceId (and requestId on failures) is stored or logged for audit
- Inputs are validated on client and server, and sensitive values are masked in the UI
- Tests cover the API client, validation and at least one error path
- A short note on how to run it and how to switch from Sandbox to production later
- If anything is missing (like my key), ask me. Do not guess endpoints, fields or values.

Start with a sandbox key.

Free to try. Make your first test call today.