StampMitraDevelopers
LiveVerification API

PAN to GSTIN API: find every GST registration linked to a PAN

Verify a PAN to GSTIN in real time.

POST/v1/verify/pan-to-gstinScope verification.pan_to_gstin.read₹5 per call
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/pan-to-gstin" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pan": "ABCDE1234F"
  }'
Example responseJSON
{
  "referenceId": "SMV-20260927-1L67Z5",
  "found": true,
  "gstins": [
    {
      "gstin": "07AAAAA1111A1Z1",
      "state": "Delhi",
      "status": "Active"
    }
  ]
}

Sometimes you have a PAN and no GSTIN. A marketplace asks a new seller for their PAN first. A lender is given a company's PAN in a loan file. A finance team inherits a vendor sheet where the tax column holds PANs because that was the only number anyone could find. In each case the next question is the same: which GST registrations does this PAN hold? POST /v1/verify/pan-to-gstin answers it. You send a PAN and get back a list of GSTINs, each with the state it is registered in and its status.

This is a lookup and not a verification, and the difference shapes everything about how to use it. You are asking the registry to enumerate, not to confirm a value you already hold. That makes the response a list that can be empty, can hold one entry or many, and can mix active and inactive registrations; it makes the endpoint more sensitive from a privacy point of view; and it makes the follow-up logic (which registration do I choose?) the hard part. This page covers all of that: how a PAN relates to GSTINs, how to read and present the list, how to chain the result into a GSTIN verification without multiplying cost needlessly, what the sandbox can and cannot show you, and where the responsible-use lines are.

A lookup, not a verification

With POST /v1/verify/gstin you hold a GSTIN and ask whether it is real and active. With this endpoint you hold a PAN and ask what is registered against it. The inputs and outputs reflect that: one field in, pan, and a list out.

Three consequences are worth stating at the start. First, an empty result is a normal outcome, not an error. A PAN may belong to someone who is not registered for GST at all, which is common for individuals, salaried people and small businesses below the registration threshold. Second, the lookup does not validate the PAN in the sense the PAN API does. If you want to know whether the PAN exists and whose it is, call that first. Third, the list is a snapshot of what the registry holds at the time of the call. A registration created yesterday may not be there, and one cancelled last week may still be, with an inactive status.

How one PAN becomes several GSTINs

Characters 3 to 12 of every GSTIN are the holder's PAN, so the relationship runs in one direction by construction: each GSTIN has exactly one PAN, and each PAN can have many GSTINs. The ways in which a PAN ends up with more than one registration are worth knowing, because they explain what the list will look like.

SituationWhat the list looks like
A business operating from one state onlyOne entry
A business with offices or warehouses in several statesOne entry per state, since GST registration is state-wise
A business with more than one registration inside a stateSeveral entries with the same state code and different thirteenth characters
A proprietor who runs two unrelated businesses under one PANEntries for both, which look like one business to the API
Someone with no GST registrationNo entries

The last two rows deserve a second look. The API links by PAN, not by business. A sole proprietor who runs a bakery and a software consultancy can hold both registrations under one personal PAN, and the lookup returns both without saying which is which. If you need to know which registration belongs to which line of business, the GSTIN API gives you the trade name and address for each entry, and the vendor can tell you the rest.

The request and the response

The request has a single field, pan, in the standard ABCDE1234F pattern. The response guarantees referenceId and found, and carries gstins, an array of objects with gstin, state and status. The tables are rendered from the same API data as the reference page.

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.
panrequiredstringPAN to resolve to associated GSTIN(s).

Response fields

Response fields
FieldType
referenceIdstring
foundboolean
gstinsarray

found is true when one or more GSTINs were located, and gstins is then non-empty; when it is false, the array is empty. Read the array, not only the flag, because that is the habit that keeps your code correct if the shape ever changes. referenceId has the form SMV-YYYYMMDD-XXXXXXX and is present on every answer, found or not; store it and quote it to support. It is not an idempotency key.

Reading the list

Each entry has three fields, and each needs a defensive reading.

gstin is the 15-character number. Treat it as a candidate and not as a verified registration; the list tells you what is associated with the PAN, and the status field tells you what the registry thinks of it, but only the GSTIN lookup gives you the names and the address you would check before transacting.

state is the name of the state the registration is in. The documented example writes it in title case, while registry captures show upper case, so compare case-insensitively. A more reliable source of the state is the GSTIN itself: the first two digits are the state code, and you can map them with the table in the GSTIN guide. If the state name in the entry disagrees with the code in the number, trust the code and log the disagreement.

status is the registration's status as the registry reports it. The values seen are of the ACTIVE and INACTIVE kind, again with variation in letter case between the documentation and captures. Do not hard-code the vocabulary. Treat an entry as active when its status equals active ignoring case, and treat everything else as inactive-or-unknown.

Two housekeeping rules help. De-duplicate on the GSTIN before you do anything with the list, because a list that mentions the same number twice should not make you pay twice for a follow-up. And never rely on the order of entries; sort them yourself by whatever your product needs, such as active first and then state name.

JavaScript
export function normaliseGstinList(response) {
  const seen = new Set();
  const entries = [];
  for (const g of response.gstins ?? []) {
    const gstin = String(g.gstin ?? "").toUpperCase();
    if (!gstin || seen.has(gstin)) continue;
    seen.add(gstin);
    entries.push({
      gstin,
      stateCode: gstin.slice(0, 2),
      stateName: g.state ?? null,
      active: String(g.status ?? "").trim().toLowerCase() === "active",
      rawStatus: g.status ?? null,
    });
  }
  // active registrations first, then by state code, so the UI order is stable
  return entries.sort((a, b) => Number(b.active) - Number(a.active) || a.stateCode.localeCompare(b.stateCode));
}

Choosing the right registration

A list of registrations raises a question that a single GSTIN never does: which one do I use? The answer depends on what you are doing.

You are...PickWhy
Onboarding a vendor who will invoice youThe registration they will invoice from, ask themThe supplier's invoice carries the GSTIN of the registration the supply is made from
Raising an invoice to a business customerThe registration in the state the customer is buying forThe state decides the place of supply and the tax treatment
Checking that a customer-supplied GSTIN is genuineWhether it appears in the listAbsence is a reason to ask questions
Building a seller profile on a marketplaceAll active entries, with one marked as primary by the sellerSellers often operate from several states
Satisfying a rule that wants "the" GSTINAsk your tax teamThe right answer is a tax question

The first row is the commonest source of friction in accounts payable. A vendor registers once with head-office details, and invoices later arrive carrying the GSTIN of a warehouse in another state. If you verified only the head-office registration, the invoices will not match your records. Ask which registration the vendor will use, verify that one, and consider storing every active registration against the vendor, with the one in use marked.

The place-of-supply and tax treatment rules are a subject for your tax advisers, and this page does not try to state them; it only points out that the state in the GSTIN is an input to them.

From the list to a screen: none, one or many

If a person types a PAN into a form and you run this lookup, there are three cases, and each needs a deliberate design.

With no entries, say so plainly and move on. "We could not find a GST registration for this PAN" is neutral and true; it does not accuse anyone of anything. Offer the user a way to continue as unregistered, or to enter a GSTIN by hand if they think the lookup missed one, and record that the lookup found nothing.

With one entry, resist the urge to auto-select silently. Show the number, the state and the status, and ask the user to confirm. A confirmation costs a click and protects against the case where the PAN belongs to someone else's business.

With many, present a picker. Group by state, show the status, put active entries first, and let the user choose the registration they want to use for this purpose. Do not default to the first item. If the user needs several (a seller operating in three states), let them tick several, and keep one marked as primary.

Whatever the user picks, treat it as a claim until the GSTIN API has verified it, and show the legal name returned there so the user can confirm that it is their business.

Chaining the lookup into GSTIN verification

The list does not return legal names, trade names or addresses. To get them you call the GSTIN API once per entry you care about. That makes the cost of a full resolution 1 + N calls, where N is the number of registrations you verify, so be deliberate about N.

Verify only what you need. If the user picked one registration, verify one. If you are building a seller profile, verify the active entries and skip the inactive ones, unless your policy requires you to know why a registration is inactive. If you are only checking that a GSTIN the user typed belongs to the PAN, you do not need the lookup at all: compare characters 3 to 12 of the GSTIN with the PAN, which is free, and call the GSTIN API directly. The lookup earns its price when the user does not know the number, or when you want to catch a registration the user did not mention.

When you do chain, pass the work through a queue. A PAN with a dozen registrations produces thirteen calls; ten such PANs in a batch is 130, and your per-minute allowance is shared with everything else your account does.

Calling the API from Node.js, Python and cURL

The clients validate the PAN locally, send an idempotency key, retry only what can succeed on retry, and return a list normalised as above.

JavaScript
// pan-to-gstin.mjs  (Node.js 18+); uses normaliseGstinList from above
import { randomUUID } from "node:crypto";
import { normaliseGstinList } from "./gstin-list.mjs";

const BASE = "https://api-b2b.stampmitra.in";
const PAN_RE = /^[A-Z]{5}[0-9]{4}[A-Z]$/;
const RETRYABLE = new Set([429, 502, 503, 504]);
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

export async function gstinsForPan(rawPan) {
  const pan = String(rawPan ?? "").replace(/\s+/g, "").toUpperCase();
  if (!PAN_RE.test(pan)) return { outcome: "bad_input" };
  const key = randomUUID();

  for (let attempt = 1; attempt <= 4; attempt++) {
    let res;
    try {
      res = await fetch(`${BASE}/v1/verify/pan-to-gstin`, {
        method: "POST",
        headers: { Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": key },
        body: JSON.stringify({ pan }),
        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 entries = normaliseGstinList(json);
      return {
        outcome: entries.length > 0 ? "found" : "none",
        referenceId: json.referenceId,
        entries,
        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
# pan_to_gstin.py  (Python 3.9+, pip install requests)
import os, re, time, uuid, random, requests

BASE = "https://api-b2b.stampmitra.in"
PAN_RE = re.compile(r"^[A-Z]{5}[0-9]{4}[A-Z]$")
RETRYABLE = {429, 502, 503, 504}

def normalise_list(body):
    seen, out = set(), []
    for g in body.get("gstins") or []:
        gstin = str(g.get("gstin") or "").upper()
        if not gstin or gstin in seen:
            continue
        seen.add(gstin)
        out.append({"gstin": gstin, "stateCode": gstin[:2], "stateName": g.get("state"),
                    "active": str(g.get("status") or "").strip().lower() == "active", "rawStatus": g.get("status")})
    return sorted(out, key=lambda e: (not e["active"], e["stateCode"]))

def gstins_for_pan(raw_pan):
    pan = re.sub(r"\s+", "", raw_pan or "").upper()
    if not PAN_RE.match(pan):
        return {"outcome": "bad_input"}
    key = str(uuid.uuid4())

    for attempt in range(1, 5):
        try:
            r = requests.post(
                f"{BASE}/v1/verify/pan-to-gstin",
                json={"pan": pan},
                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:
            entries = normalise_list(body)
            return {"outcome": "found" if entries else "none", "referenceId": body.get("referenceId"), "entries": entries}
        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")}
cURL
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/pan-to-gstin" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"pan":"ABCDE1234F"}'

Use the libraries on the SDKs page if you prefer typed responses, and the Postman collection to try a call by hand.

When a call fails, and what it costs

Failures share one body, { "error": { "code", "message", "requestId" } }, shown below from the API data. Log requestId and branch on the status and code, not on the message.

  • 400Validation errorBAD_REQUEST

    pan must match the format ABCDE1234F

  • 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

The table that follows is specific to this endpoint: what each symptom usually means and what to do.

SymptomLikely causeAction
400PAN failed the pattern, or an unknown property was sentFix the input; never retry unchanged
200 with found: falseNo GST registration known for the PANTreat as a normal result; ask the user
402Wallet cannot cover the callTop up; alert your team; the lookup did not run
429Plan's per-minute allowance exceededBack off and pace the batch
502The source was unreachableRetry with backoff; no answer exists yet
A different list on a retryThe registry changed in betweenExpected; use the latest and keep both referenceId values

Billing follows the same rule as the other lookups: a call that completes is charged, including one that finds nothing, and a call that fails is not. Production calls come from your prepaid wallet at ₹5 per call on pay-as-you-go before GST, less on the Growth and Scale plans, as shown on the pricing page; sandbox is free. An Idempotency-Key keeps a retry after a timeout from being charged twice: reuse the key for the retry and the stored response comes back with no second lookup or debit. A key reused with a different PAN is refused with a 422 IDEMPOTENCY_KEY_REUSED.

Sandbox: one entry, no state, and what to do about it

Sandbox keys start with sk_test_ and production keys with sk_live_. Sandbox answers come from a deterministic stand-in. The reserved PAN SNDBX0000A always returns found: true with a single entry, the GSTIN 09SNDBX0000A1Z5 with an active status. The reserved PAN SNDBX9999F always returns found: false. Any other well-formed PAN gets a stable arbitrary answer, about two in three found, and a found answer always carries that same single GSTIN.

That has three consequences for testing. Sandbox can never return more than one entry, so your multi-registration picker, your de-duplication and your sort order need fixtures that you write yourself. Sandbox entries do not carry a state name, so your code must cope with a missing state, which is also why deriving the state from the first two digits of the GSTIN is the better habit. And the sandbox GSTIN is the same one that appears in the GSTIN sandbox, so a test that chains the two works end to end.

The sandbox is deliberately small: 10 requests a minute and 200 a day per organisation (the day resets at midnight IST), after which the API answers 429, and call history is kept for 30 days. It is a place to prove an integration, not to load-test. The readiness runner in your dashboard exercises scripted scenarios without using up those limits. To go live, apply for production access from the dashboard, fund the wallet, create a production key with the scope you need and release behind a flag; the guide on sandbox versus production keys has more.

Responsible use: why this endpoint needs a purpose

Of all the verification endpoints, this is the one most easily misused, so it is worth being explicit. It takes one identifier that many people know about someone else and returns that person's or business's tax registrations. For a company the information is business information. For an individual PAN it connects a person to businesses they run, and where the principal place of business is a home, indirectly to an address.

Use it where you have a relationship and a lawful purpose that you can describe: onboarding a seller, vendor or customer, resolving a registration the user told you about, maintaining records for a counterparty. Do not use it to look up people or businesses you have no reason to deal with, to build lists of registrations, or to probe a range of PANs; the acceptable use policy prohibits systematic enumeration of information you are not authorised to access, and the lookup is logged against your account. Tell the person whose PAN you are using what you will look up and why, record that notice, and keep what you store small: the referenceId, the chosen GSTIN, the status and the date are enough for most purposes.

India's Digital Personal Data Protection Act, 2023 is being brought into force in phases, and personal data in this flow is within its scope. This page is general information and not legal advice; confirm your obligations with qualified counsel. The developer privacy policy and the data processing addendum describe how responsibilities are divided with StampMitra.

Keeping the picture fresh

A list of registrations goes stale in ways that matter. A business opens a branch in a new state; a registration is cancelled; a status flips from active to inactive. If your product depends on knowing the current set, decide how it will find out, and be honest about the cost of each option.

The cheapest option is event-driven. Run the lookup again when something happens that makes the old picture risky: a vendor sends an invoice with a GSTIN you do not hold, a seller asks to add a state, a large payment is about to be released, a customer's invoice is rejected because of a GSTIN mismatch. The event gives you a reason, and a reason is also what you want in an audit trail. The second option is periodic: re-run the lookup for your high-value counterparties on a schedule, say once or twice a year, and diff the result against what you stored. The diff is the product here, not the list. A new entry is a prompt to ask whether the counterparty has started operating in a new state; a status that moved to inactive is a prompt to look at that registration with the GSTIN API; a missing entry is a prompt to ask what happened. Do not re-run the lookup for everyone every month because it is easy to schedule; each run is billed, and a diff of nothing is the usual result.

Whichever you choose, store the minimum you need to diff: the set of GSTINs and their statuses, the date, the referenceId, and a flag saying which one is in use. A hash of the sorted set is enough to detect a change cheaply, and you can fetch the detail again when the hash moves.

What the registry cannot tell you here

It is worth listing the questions this endpoint does not answer, so that nobody builds a feature on a hope. It does not tell you whether the PAN is genuine or whose it is; use the PAN API. It does not return names or addresses; use the GSTIN API per entry. It does not say whether a registration is under the composition scheme, whether returns are being filed, or when a registration was created. It does not tell you which of the registrations the counterparty will use on a given invoice; only the counterparty can. And it does not cover other tax identifiers: a counterparty can be registered under other regimes that do not appear here.

A related caution concerns the absence of a result. found: false means the registry returned no registration for that PAN at that moment. It does not mean the business is not carrying on taxable activity, and it should never be the sole basis for an accusation. Use it to decide what to ask, not to decide what to conclude.

A test plan for the sandbox

Because the sandbox is small and has fixed behaviour, write your tests as a plan and not as a hunch. Four scenarios are worth covering with real calls: the reserved success PAN, to prove authentication, parsing and your single-entry path; the reserved failure PAN, to prove your empty path; a malformed PAN, to prove that your client-side check stops it and that you handle the 400 body if it ever reaches the server; and a call without a key or with the wrong scope, to prove your 401 and 403 handling.

Everything else belongs in unit tests against fixtures you write. Craft responses with three entries in two states, one of them inactive; with the same GSTIN twice; with a missing state; with upper-case and title-case statuses; with an entry whose state name disagrees with the digits. Feed each through normaliseGstinList and through your picker, and assert on the order, the active flag and the displayed state. Feed the documented error bodies (400, 401, 402, 403, 429, 502) through your error handler and assert on the user-facing message and on whether a retry was scheduled. Keep the live sandbox calls few, because the sandbox allows only 10 requests a minute and 200 a day per organisation; the readiness runner in your dashboard is the place for extra scripted scenarios.

A short pre-production checklist

Before the first live call, check six things. The key carries the verification.pan_to_gstin.read scope and no more than you need, and it is stored in a secrets manager. The wallet has enough for the expected volume with margin, and low-balance alerts reach a person. Batch jobs run through a queue paced below the plan's allowance, with a stable idempotency key per PAN per run. The picker, the empty state and the confirm step exist in your UI, and the copy is neutral about empty results. Your audit row stores the referenceId, the chosen GSTIN, the status and the date, and your logs do not store PANs. And the purpose notice is live before any PAN is looked up: the person knows what you will check and why.

A worked scenario: a marketplace that asks sellers for a PAN first

Take an invented marketplace, Konkan Crafts, whose seller form asks for a PAN and then a GSTIN. Many sellers have a PAN and do not know whether they are registered, and a visible number of them type the wrong GSTIN, often a supplier's.

The team changes the flow. Step one asks for the PAN and verifies it with the PAN API, with the seller's name, so the marketplace knows the PAN exists and what category it is. A P means a proprietor; a C means a company. Step two runs the lookup. A seller with no registrations is offered the "unregistered seller" path with a short explanation. A seller with several sees a picker grouped by state, active entries first.

Step three verifies the chosen GSTIN with the GSTIN API and shows the legal and trade names, asking "Is this your business?". The seller confirms. The marketplace stores the seller id, the PAN referenceId, the lookup referenceId, the chosen GSTIN, the status, the date and the confirmation. Sellers who operate in multiple states can add further registrations, each verified in the same way.

The effect is that wrong-GSTIN entries disappear, because sellers pick from a list tied to their PAN, and that the marketplace's invoices carry the GSTIN of the right registration. The cost per new seller is a PAN check, a lookup and one GSTIN check for the common single-registration case.

Cost and throughput model

For a batch, the arithmetic is simple and worth doing before you run it. Suppose you hold 5,000 vendor PANs and want to find registrations for each. The lookups cost 5,000 times the per-call rate, plus 18% GST. If you then verify every active registration and the average vendor has two, that adds roughly 10,000 GSTIN calls, so the total is 15,000 calls priced at the two rates.

Throughput matters as much as money. On a plan that allows 60 requests per minute, 5,000 lookups alone take about 84 minutes at full speed, and the whole 15,000 calls take about four hours, with no room left for your live traffic. At a half-speed pace the figures double. On a plan with 300 requests per minute the same job takes about fifty minutes. Plan the job as an overnight run on a queue, use a stable idempotency key per PAN per run so that a crash and restart does not pay twice, and stop early if the share of 429 responses rises.

The cheapest saving is not calling. Skip PANs that you already hold registrations for. Skip individuals whose records show no business relationship. Skip vendors that the PAN check marked as not valid. And do not run the lookup to verify a GSTIN the user typed; compare the embedded PAN for free and call the GSTIN API.

Moving from another PAN-to-GST provider

If you use another service for this lookup, compare shapes before you cut over. Check what the old provider returned per entry: some give legal names, addresses or registration dates in the list, which this endpoint does not. Decide, for each extra field you consume, whether you will fetch it with the GSTIN API, ask the user for it, or drop the feature. Map status values to a boolean active instead of porting a vocabulary, and de-duplicate by GSTIN. Run both providers on a sample of your own PANs for a few days and read each difference by hand: most will be timing, because registrations change, and some will be provider coverage. Send what remains to support with the referenceId values.

Edge cases and mistakes

  • Treating found: false as an error. It is a result. Many valid PANs have no GST registration.
  • Auto-selecting the single entry. Ask the user to confirm; the PAN might not be theirs.
  • Trusting the list order. Sort it yourself.
  • Assuming the state name matches the GSTIN's digits. Prefer the digits.
  • Comparing status case-sensitively. Documentation and captures differ in case.
  • Verifying every entry blindly. N entries mean N more paid calls; verify what you need.
  • Using the lookup to verify a typed GSTIN. Compare characters 3 to 12 to the PAN for free.
  • One GSTIN per customer. Businesses with several registrations need one per state where it matters.
  • Treating a proprietor's list as one business. The PAN links registrations, not businesses.
  • Storing the full list forever. Keep the chosen registration and the minimum evidence.
  • Looking up PANs you have no purpose for. The endpoint is logged and governed by the acceptable use policy.

Sources and what to confirm

  • StampMitra PAN to GSTIN 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 structure of the GSTIN, the state codes and the rules on state-wise registration and place of supply. The relationships on this page are widely published conventions; confirm any rule you encode with the current official sources and your tax adviser.
  • 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 pan 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. 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
GSTINs found for the PAN
SNDBX0001F
200
200 with found true and the list of GSTINs.
No GSTIN for the PAN
SNDBX0002F
200
200 with found false and an empty gstins list.
Verification source times out
SNDBX0005F
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
SNDBX0006F
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
SNDBX0007F
429TOO_MANY_REQUESTS
Too many requests. Back off and retry with exponential delay and jitter.
Wallet balance too low
SNDBX0008F
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
SNDBX0000
400BAD_REQUEST
Validation error that names the field. Nothing is looked up and nothing is charged.

Frequently asked questions

What does the PAN to GSTIN API return?

It returns a found flag and an array of GSTINs, each with the state it is registered in and its status. It does not return legal names, trade names or addresses, so call the GSTIN API for each entry you need those for.

Why can one PAN have several GSTINs?

GST registration is state-wise, so a business operating in several states holds one registration per state, and it can hold more than one inside a state. Characters 3 to 12 of each GSTIN are the PAN, which is why the lookup can find them all.

Is found false an error?

No. It means the registry returned no GST registration for that PAN at that moment, which is common for individuals and small businesses. It is a billed, completed answer, and it should lead to a question for the user, not to an accusation.

How do I choose which GSTIN to use when there are several?

Ask. For a vendor, use the registration they will invoice from. For a customer invoice, use the registration for the state they are buying for. Do not default to the first entry, and treat the place-of-supply rules as a question for your tax adviser.

Should I use this lookup to verify a GSTIN the user typed?

Usually not. Compare characters 3 to 12 of the GSTIN with the PAN, which costs nothing, then call the GSTIN API directly. The lookup earns its price when the user does not know the number or you want to find registrations they did not mention.

How many calls does a full resolution take?

One lookup plus one GSTIN call for each entry you verify, so 1 plus N. Verify only what you need, for example the chosen registration or the active entries, and pass chained work through a queue paced below your plan's per-minute allowance.

Why does the sandbox return only one GSTIN with no state?

Sandbox answers come from a fixed stand-in. The reserved PAN SNDBX0000A returns the single GSTIN 09SNDBX0000A1Z5 as active, and found answers for other PANs carry the same one. Build your own fixtures to test multi-entry lists and missing state names.

Am I billed when nothing is found?

Yes. A call that completes with an answer is billed, and found false is an answer. Failed calls with a 400, 429 or 502 are not billed and sandbox calls are never billed. Use an Idempotency-Key so a retry after a timeout is not charged twice.

What are the rate limits for this endpoint?

The limit belongs to your plan and is shared by all keys and routes in an environment, counted per minute. At the time of writing it is 60 on pay-as-you-go, 300 on Growth and 1,000 on Scale, with 10 for a sandbox key, plus 200 requests a day per organisation. Check the pricing page for current figures.

Is it acceptable to look up PANs I have no relationship with?

No. Use the endpoint where you have a relationship and a lawful purpose you can describe, such as onboarding a seller or vendor. The acceptable use policy prohibits systematic enumeration of information you are not authorised to access, and calls are logged against your account.

How often should I re-run the lookup for existing counterparties?

Prefer events over calendars: re-run when an invoice shows an unknown GSTIN, a counterparty adds a state, or a large payment is due. For high-value counterparties a periodic run once or twice a year works, and the useful output is the difference from the stored set.

Does the list say which registration belongs to which business?

No. The lookup links registrations by PAN, not by business, so a proprietor running two businesses under one PAN shows entries for both without labels. Use the GSTIN API for trade names and addresses, and ask the counterparty for the rest.

Build with AI

Integrate PAN to 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 · PAN to GSTIN · 6,028 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 "PAN to GSTIN" API
Verify a PAN to GSTIN in real time.
Production service code: pan.to_gstin

ENDPOINT: POST /v1/verify/pan-to-gstin
- Verify PAN to GSTIN
- Required scope: verification.pan_to_gstin.read
- Parameters:
  - pan (string, required): PAN to resolve to associated GSTIN(s).
- Example request body: {"pan":"ABCDE1234F"}
- Response fields: referenceId, found, gstins
- Example response: {"referenceId":"SMV-20260927-1L67Z5","found":true,"gstins":[{"gstin":"07AAAAA1111A1Z1","state":"Delhi","status":"Active"}]}
- 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.

Rules for this verification
- Validate pan 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.