StampMitraDevelopers
LiveVerification API

PAN verification API for India: status, name match and holder type

Verify a PAN in real time.

POST/v1/verify/panScope verification.pan.read₹5 per call
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/pan" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pan": "ABCDE1234F",
    "name": "Rahul Kumar"
  }'
Example responseJSON
{
  "referenceId": "SMV-20260927-8F42K7",
  "pan": "ABCDE1234F",
  "type": "Individual",
  "valid": true,
  "registeredName": "RAHUL KUMAR",
  "fatherName": "SURESH KUMAR",
  "panStatus": "VALID",
  "panStatusCode": "E",
  "panStatusDescription": "Existing and valid PAN",
  "nameMatchResult": "MATCH",
  "nameMatchScore": "100",
  "aadhaarSeedingStatus": "y",
  "aadhaarSeedingStatusDescription": "Aadhaar linked",
  "lastUpdatedAt": "2023-04-01",
  "message": "PAN is Valid"
}

If you need to know whether a PAN your user typed is real, what the Income Tax Department's record says about it, and whether the name on that record is the name your user gave you, you make one authenticated call: POST /v1/verify/pan. You send the ten-character number and, if you have it, the name. You get back a JSON object with a valid flag, the status of the PAN, the registered name when the record exists, and a name-match verdict and score when you supplied a name.

This page is the long version of that sentence. It explains what is inside a PAN and why the fourth letter matters to your routing logic, what the lookup actually returns and what it leaves out, how to read the name-match fields without inventing a threshold, what "valid" does and does not mean, how errors, retries, billing and rate limits behave, and what changes between the sandbox and production. It ends with worked examples, a list of mistakes we see in integrations, and answers to the questions developers and compliance teams ask most. If you only want the endpoint contract, the API reference is shorter.

What a PAN lookup tells you, and what it cannot

A Permanent Account Number is a record in the Income Tax Department's database. A lookup asks that database three things: does this number exist, in what state is the record, and what name is held against it. That is all. The lookup does not ask who is sitting at your keyboard.

This distinction decides where PAN verification belongs in your flow. A match between the number and a name proves the pair is consistent. It does not prove that the person submitting them is the holder, because anyone who has seen a PAN card can type the details. Teams that treat a PAN match as proof of identity end up with accounts opened by someone holding a borrowed card. Teams that treat it as one consistency check, followed by something that proves possession (a selfie match, a bank account in the same name, a signed document), get the benefit of the cheap check without the false confidence.

Three other things a PAN check does not do. It does not tell you whether a business is trading, registered for GST or solvent; those are separate registries, covered by the GSTIN, CIN and Udyam APIs. It does not return an address, a date of birth or a phone number, and you should not go looking for them in the response. And it is not a legal clearance: whether a result satisfies a rule that applies to you is a decision for your compliance owner, not something an API can settle.

Reading a PAN: the ten characters and the fourth letter

Every PAN follows the pattern AAAAA9999A: five letters, four digits, one letter. The characters are not random, and knowing what they encode lets you do useful work before you spend a single API call.

PositionWhat it carries
1 to 3An alphabetic series issued by the department. Treat as opaque.
4The holder category: who or what this PAN was issued to.
5First letter of the holder's surname (individuals) or of the entity's name (everyone else).
6 to 9A running number from 0001 to 9999.
10An alphabetic check character. The calculation is not published for general use, so do not try to validate it yourself.

The fourth letter is the one worth building on. It tells you what kind of holder the number belongs to:

4th letterHolder category
PIndividual (a person)
CCompany
HHindu Undivided Family
FFirm, including a limited liability partnership
AAssociation of persons
BBody of individuals
TTrust
LLocal authority
JArtificial juridical person
GGovernment

Two practical uses follow. First, you can check the category locally. If your onboarding form says the customer is a private limited company and the PAN has P in the fourth position, something is wrong before any network call happens, and a free client-side check saves a paid server call. Second, the category tells you which follow-up APIs make sense: a C PAN opens the door to a CIN lookup and a PAN to GSTIN search, while a P PAN belonging to a sole proprietor is the natural input for PAN to Udyam.

The fifth letter is useful in a narrower way. For an individual it is the first letter of the surname, so a customer called Meera Iyer should have a PAN whose fifth character is I. A mismatch is a signal worth logging, though it is not proof of anything: names get changed on marriage, spellings differ between documents, and people sometimes hold a PAN issued under an older name. Use it as a soft hint to prompt the user to re-check their entry, never as a rejection rule.

One more structural fact: the StampMitra API validates the shape of the number (five uppercase letters, four digits, one uppercase letter) and nothing about the fourth letter. A PAN with an unusual fourth character fits the pattern and goes through to the lookup, which will simply say it is not valid. The helper below, which you can paste into your own code, decodes the category so you can compare it to what the user told you.

JavaScript
const PAN_RE = /^[A-Z]{5}[0-9]{4}[A-Z]$/;
const HOLDER = {
  P: "individual", C: "company", H: "huf", F: "firm_or_llp", A: "aop",
  B: "boi", T: "trust", L: "local_authority", J: "juridical_person", G: "government",
};

export function inspectPan(raw) {
  const pan = String(raw ?? "").replace(/\s+/g, "").toUpperCase();
  if (!PAN_RE.test(pan)) return { ok: false, pan };
  return { ok: true, pan, holder: HOLDER[pan[3]] ?? "unknown", fifth: pan[4] };
}

The request: fields, normalisation and what gets rejected

The endpoint takes a JSON body with two fields. pan is required and must match ^[A-Z]{5}[0-9]{4}[A-Z]$. name is optional, a string of at most 256 characters. The API rejects properties it does not know with a 400, so a typo such as fullName fails loudly instead of being ignored. Authentication is a bearer key with the verification.pan.read scope, sent as Authorization: Bearer <key> (the x-api-key header is also accepted).

Normalise before you send. Trim the string, remove internal spaces (people paste PANs with a space after the fifth character), and uppercase it. The validator is strict about case and will return a 400 for abcde1234f rather than fixing it for you, which is the right behaviour for an API and the wrong one for a form, so do the cleanup yourself. Ambiguous characters deserve a second look: the letter O and the digit 0, and the letter I and the digit 1, are the usual confusions. If the pattern fails and swapping one of those characters would make it pass, offer the correction to the user instead of silently applying it.

Send the name the way it would be printed on the card. That means the legal name, not a nickname, not a trade name, and without honorifics such as "Mr" or "Shri". For an entity PAN, send the registered legal name. A name is the only input that produces name-match fields, so if you have one, send it; if you do not, omit the field rather than sending an empty string.

Here is the smallest useful call.

cURL
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/pan" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Idempotency-Key: 6f1b7f0e-3c59-4d61-9d4e-5a0f2b8f9a11" \
  -H "Content-Type: application/json" \
  -d '{"pan":"ABCDE1234F","name":"Rahul Kumar"}'

The Idempotency-Key header is optional but worth sending on every call. The section on retries explains why.

What comes back, field by field

The request and response tables below are rendered from the same API data as the reference page, so they cannot disagree with it. Read them with one rule in mind: only referenceId and valid are guaranteed on every answer. Everything else is optional and appears only when the record exists and the registry returned it. A negative answer is deliberately sparse.

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, format ABCDE1234F.
namestringName to match against records (max 256 chars).

Response fields

Response fields
FieldType
referenceIdstring
panstring
typestring
validboolean
registeredNamestring
fatherNamestring
panStatusstring
panStatusCodestring
panStatusDescriptionstring
nameMatchResultstring
nameMatchScorestring
aadhaarSeedingStatusstring
aadhaarSeedingStatusDescriptionstring
lastUpdatedAtstring
messagestring

A few fields need more than a table row.

referenceId has the form SMV-YYYYMMDD-XXXXXXX and is StampMitra's own identifier for the call. It is present even when valid is false. Store it next to your internal customer id; it is what support asks for. It is not an idempotency key, and sending it back to the API does nothing.

registeredName is the name held against the PAN. It is personal data. Store it only if you have a documented reason, and keep it out of logs.

panStatus is a label for the record's state, accompanied in the reference example by a short code and a description. The sample shows a valid, existing PAN. The registry can report other states, and the next chapter explains how to treat them without hard-coding a list you will have to maintain.

message is a human-readable sentence. Display it in an internal tool if you like. Do not parse it, because wording can change and your branching logic should not depend on it.

Treat unknown fields as additive. Ignore properties you do not use, and do not fail a request because a new field appeared.

What "valid" means, and why it is not the same as "operative"

valid: true says the registry found the number. It is a statement about existence. panStatus says what state the record is in. The two answer different questions, and conflating them is the most common modelling mistake with PAN data.

In the reference example the status code is E, described as an existing and valid PAN. That is the state you want to see. The registry can also carry other states for a record that exists: PANs that have been deleted or deactivated, PANs marked as fake, and existing PANs whose holder has undergone an event such as death, merger, partition or liquidation. Provider documentation lists several codes for these (codes starting with E for existing-but-affected records, and letters such as N, X, D and F for deleted, deactivated or flagged records), but the list is not something we guarantee to be exhaustive or stable. Our advice is to branch on three outcomes only: the record is valid and the status is the plain valid one, the record exists but carries any other status, or the record was not found. Send the middle group to a human or ask the user for a different document. Log the whole response so that a reviewer can see the exact status.

There is a related policy question that your compliance owner should answer, not your code. The response reports whether Aadhaar is linked to the PAN. Indian tax rules have required many PAN holders to link the two, and a PAN that was not linked by the deadline can be treated as inoperative until the position is regularised. The rules and dates have changed over time, so check the current position before you encode any consequence. What the API gives you is the link flag on the record. It does not verify anyone's Aadhaar, and StampMitra does not offer Aadhaar-based verification. Decide with your compliance owner whether an unlinked PAN blocks onboarding, triggers a message to the user, or is simply recorded.

A short decision table keeps the logic honest.

What you seeWhat it suggestsTypical action
valid: true, plain valid statusRecord exists and is in good standingContinue; run the name check
valid: true, any other statusRecord exists but something happened to itManual review or ask for another document
valid: falseThe registry has no such valid recordAsk the user to re-enter once; then escalate
HTTP 400Your input failed the format ruleFix input; not a verdict on the PAN
HTTP 502The source could not be reachedRetry with backoff; no verdict exists

Name matching: score, verdict and how to set your own policy

When you pass name and the PAN is valid, the response includes a verdict string and a numeric score from 0 to 100. The verdict values observed from the registry side are MATCH, GOOD_PARTIAL_MATCH, POOR_PARTIAL_MATCH and NO_MATCH. The score may arrive as a number or as a numeric string depending on the response version, so always parse it with Number() before comparing it.

We do not publish the comparison algorithm or a recommended cut-off, and this page will not invent one. Treat the verdict and score as inputs to a policy that you own. A reasonable starting point, which you should adjust against your own data, looks like this: accept automatically on MATCH; send GOOD_PARTIAL_MATCH to a light check, such as asking the user to confirm that the name shown is theirs; send POOR_PARTIAL_MATCH and NO_MATCH to review or re-entry. Keep the thresholds in configuration and version them, so you can explain months later why an application was handled the way it was.

What makes a name differ from the record? Understanding the common causes lets you fix inputs instead of loosening policy.

VariationExampleWhat to do
Initials versus expanded namesR. K. Sharma against Rajesh Kumar SharmaAsk for the name as printed on the card
Name orderKumar Rahul against Rahul KumarCollect given and family names in separate fields, join in card order
Honorifics and suffixesShri, Smt, Mr, DrStrip before sending
Spelling and transliterationMohammed, Mohammad, MuhammadExpect partial matches; do not auto-reject
Married-name changesMaiden name on the PANOffer a path to explain, with a supporting document
Entity namesPvt Ltd against Private LimitedSend the registered legal name
Trade namesBrand name instead of legal nameNever send a brand for a PAN lookup

The row that causes the most avoidable rejections is the entity one. People type "Acme Traders" into a field that should hold "Acme Traders Private Limited" and then wonder why a valid company PAN scores poorly. If your form collects both a brand name and a legal name, label them clearly and send only the legal one.

Do not auto-reject on a partial match alone. A person with one weak signal and otherwise consistent data is more likely to be a typo than a fraudster. Reject on repeated failure, or on a mismatch combined with other risk signals, and give the user one clear chance to correct their input first.

Calling the API from Node.js and Python with real error handling

Both clients below do the same things: normalise and pre-check the PAN, send an idempotency key, retry only the failures that can succeed on a retry, and separate transport problems from verdicts. The key is read from the environment and the full PAN is never logged.

JavaScript
// verify-pan.mjs  (Node.js 18+)
import { randomUUID } from "node:crypto";

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 verifyPan(rawPan, name) {
  const pan = String(rawPan ?? "").replace(/\s+/g, "").toUpperCase();
  if (!PAN_RE.test(pan)) return { outcome: "bad_input" };

  const body = JSON.stringify({ pan, ...(name?.trim() ? { name: name.trim() } : {}) });
  const key = randomUUID(); // reuse the SAME key across retries of this one request

  for (let attempt = 1; attempt <= 4; attempt++) {
    let res;
    try {
      res = await fetch(`${BASE}/v1/verify/pan`, {
        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) {
      return {
        outcome: json.valid === true ? "valid" : "not_valid",
        referenceId: json.referenceId,
        panStatus: json.panStatus,
        verdict: json.nameMatchResult,
        score: json.nameMatchScore === undefined ? undefined : Number(json.nameMatchScore),
      };
    }
    const err = json.error ?? {};
    if (RETRYABLE.has(res.status) && attempt < 4) {
      await sleep(2 ** attempt * 500 + Math.random() * 250);
      continue;
    }
    return { outcome: res.status === 402 ? "wallet_empty" : "error", status: res.status, code: err.code, requestId: err.requestId };
  }
}
Python
# verify_pan.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 verify_pan(raw_pan, name=None):
    pan = re.sub(r"\s+", "", raw_pan or "").upper()
    if not PAN_RE.match(pan):
        return {"outcome": "bad_input"}

    payload = {"pan": pan}
    if name and name.strip():
        payload["name"] = name.strip()
    key = str(uuid.uuid4())  # one key per logical request, reused on retry

    for attempt in range(1, 5):
        try:
            r = requests.post(
                f"{BASE}/v1/verify/pan",
                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:
            score = body.get("nameMatchScore")
            return {
                "outcome": "valid" if body.get("valid") is True else "not_valid",
                "referenceId": body.get("referenceId"),
                "panStatus": body.get("panStatus"),
                "verdict": body.get("nameMatchResult"),
                "score": float(score) if score is not None else None,
            }
        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")}

Notice what the return values separate: bad_input means your own pre-check failed and no call was made; not_valid is a completed verdict about the PAN; unavailable means no verdict exists and the application should wait; wallet_empty is an operational alert for your team, not something a customer should see. The official SDKs, listed on the SDKs page, add typed responses and the same retry behaviour. For a longer walk through a typed wrapper see the guide on verifying PAN in Node.js and Python, and for the whole error catalogue see API errors and handling.

Errors, retries and idempotency

Every error body has one shape: { "error": { "code", "message", "requestId" } }. Branch on the HTTP status and code, never on message, and log requestId with every failure.

  • 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

Three groups cover everything. The deterministic group is 400, 401 and 403: a malformed PAN, a missing or wrong key, a key without the scope. Retrying changes nothing, so surface these to a developer. 402 means your wallet cannot cover the call; top up, then retry. The transient group is 429, 502 and its relatives; retry these with exponential backoff and jitter, capped at a few attempts.

The reason to send an Idempotency-Key is the timeout. Suppose your request leaves, the server completes the lookup, debits your wallet, and the response is lost on the way back. Without a key, your retry is a new call and you pay twice. With a key, the retry returns the stored response for the same key and body without running the lookup again or debiting a second time. Generate one key per logical verification, keep it across the retries of that verification, and use a fresh key for the next one. Two details to know: reusing a key with a different body (a different PAN, say) is rejected with a 422 IDEMPOTENCY_KEY_REUSED rather than silently answered, 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 saying the original is still in progress. Wait, then resend the identical request.

Billing, rate limits and what you can monitor

Billing follows the outcome. A call that completes with an answer is billed, and that includes valid: false, because the registry produced a determination. A call that fails (a 400, a 429, a 502) is not billed. In sandbox nothing is billed. Production calls are deducted from your prepaid wallet at the per-call rate, which on pay-as-you-go is ₹5 before GST and lower on the Growth and Scale plans; the pricing page has the current table. If the wallet cannot cover a call, the API refuses it with a 402 before the lookup runs, so you do not get an unbilled answer.

The practical consequence is that every avoidable call costs money. Validate the shape locally. De-duplicate within a batch. Do not re-verify a PAN you verified recently for the same purpose unless a rule or a risk trigger says you must.

Rate limits are per plan, not per endpoint. One bucket per environment and organisation, shared by all of your keys and routes, resets each minute. At the time of writing the allowance is 60 requests per minute on pay-as-you-go, 300 on Growth and 1,000 on Scale, and a sandbox key is capped at 10 a minute and 200 a day per organisation. An over-limit call returns a 429 with a message that names the limit. Because the window is a fixed minute, a burst straddling a boundary can briefly pass more than the nominal figure, so pace jobs below the limit instead of riding it. Adding keys does not add capacity, and rotating keys to get around the limit is prohibited by the acceptable use policy.

For monitoring, every call, successful or not, appears in your request logs in the dashboard and through the logs endpoint. How long they are kept depends on the plan (30, 90 or 365 days at the time of writing). Alert on the share of 402, 429 and 502 responses, not just on the count of failures, and chart valid: false as a proportion of all calls. A sudden jump in that proportion usually means a front-end regression in how the PAN is captured, not a wave of bad customers.

Sandbox and production: what is the same and what is not

Sandbox keys start with sk_test_ and production keys with sk_live_. The base URL and the request are identical; the key alone selects the environment.

Sandbox answers come from a deterministic stand-in, not from the registry. Two inputs are reserved: SNDBX0000A always returns a valid PAN with the status VALID and a synthetic registered name (TEST USER), and with a name in the request it reports a full-score match. SNDBX9999F always returns valid: false with the status INVALID. Any other well-formed PAN gets a stable but arbitrary answer: the same number always gets the same result, and roughly two in three come back valid. Every name in a sandbox reply is synthetic. Note that SNDBX0000A decodes to category B in the fourth position, so if your routing logic branches on holder category, the test PAN will look like a body of individuals; test your category branches with your own fixtures.

Sandbox is also deliberately small. It allows 10 requests a minute and 200 a day per organisation (the day resets at midnight IST), after which the API returns a 429, and it keeps call history for 30 days, so it is for proving an integration, not for load testing or for measuring name-match accuracy. The readiness runner in your dashboard runs scripted scenarios without using up those limits. Sandbox responses are built from a simpler fixture than production ones, so do not assert on optional fields beyond referenceId, valid and the ones in the table above.

The checklist for moving to production is short. Apply for production access from the dashboard; it is reviewed, and passing sandbox tests does not guarantee approval. Fund the wallet with margin and alert on low balance. Create a production key with only the scopes you need, restrict it by IP if your plan supports that, and keep it in a secrets manager. Check that every status in the error table has a user-facing message and an alert path. Then ship behind a flag, starting with staff PANs and a small slice of traffic. The longer treatment of keys and environments is in the guide on sandbox versus production API keys.

A worked example: onboarding a payout vendor

Take an invented marketplace, Kaveri Traders Marketplace, which pays vendors weekly and wants to avoid paying the wrong name. A vendor signs up as a sole proprietor and enters a PAN, the name "Suresh Menon" and a bank account.

Step one is local. The code trims and uppercases the PAN, matches the pattern, and decodes the fourth letter, which is P. The vendor chose "Individual or sole proprietor" on the form, so the category agrees. Step two is the paid lookup, with the name and a fresh idempotency key. The response is valid: true, status plain valid, verdict GOOD_PARTIAL_MATCH, score in the high eighties. The marketplace policy treats that as "confirm with the user": the vendor sees "We found this PAN registered to SURESH MENON. Is that your legal name?" and clicks yes; the click is recorded with a timestamp.

Step three moves to the next check. The registered name, not the typed one, goes to the bank account verification call, because the bank record should match the legal name. If the vendor also supplies a GSTIN, the first two characters give the state, characters three to twelve must equal the PAN, and the GSTIN API confirms the registration. The marketplace stores five things and nothing else: its own vendor id, referenceId, the masked PAN, the outcome with the status, and the id of the consent record. If the PAN had come back with an unusual status, the application would have gone to a reviewer with the full response attached, and the vendor would have seen a neutral message asking for another document.

Cost modelling for this flow is simple. A weekly onboarding run of N new vendors costs N times the per-call rate for PAN, plus the same multiple for each further API in the chain, plus 18% GST. De-duplication matters: if a vendor re-submits after fixing a typo, the first call was already billed, so fix obvious problems client-side before the first call. A vendor master of several thousand records re-verified once a year is a batch job that should run through a queue at a rate comfortably under your plan's per-minute limit.

Using PAN with the other verification APIs

PAN is usually the first link of a chain and rarely the whole chain. Which link comes next depends on the question you are asking.

You need to knowCall nextWhy
Which GST registrations belong to this PANPAN to GSTINResolves the PAN to its GSTINs and their states
Whether a GSTIN the user typed is liveGSTINRegistration status, legal and trade name
Whether the entity is a registered companyCINCompany record and directors
Whether an MSME registration existsPAN to Udyam, then UdyamFinds the registration, then verifies it
Whether money will reach the right personBank accountAccount existence and name at bank

Order the calls by cost and certainty. Do the local checks first, then PAN, then only the dependent calls that the PAN result justifies. If the PAN fails, stop; every call after it would be built on sand. For an end-to-end design for lenders and fintechs, see the KYC use case, and for the broader PAN walkthrough the guide on PAN verification in India. If you drive the API from an AI assistant, the MCP server and the Build with AI page show how.

Edge cases and odd inputs

Real traffic contains inputs no test plan predicted. These are the ones worth handling on purpose.

  • Lowercase, spaces and pasted junk. Normalise before validating; do not rely on the server to repair input.
  • O versus 0, I versus 1. Offer a corrected suggestion when one substitution makes the pattern pass.
  • Minors. A minor can hold a PAN, and it carries category P. The name on the record is the minor's, not the guardian's.
  • Non-resident holders. A PAN does not imply Indian residence. Do not infer residency from it.
  • Entities with a personal-looking name. A proprietorship has no PAN of its own; the proprietor's individual PAN is used. A firm or an LLP has an F. Check the category against what the user declared before you assume anything.
  • A valid PAN with a status other than plain valid. Treat as review, not as a pass and not as an automatic rejection.
  • Name on the record is in capitals and has fewer words than your input. Records often hold a short form; the name-match fields exist to absorb this.
  • No name supplied. You get existence and status only; absence of a match verdict is not a failure.
  • A second request for the same PAN a minute later. Cache a recent successful answer for your stated purpose, or use an idempotency key if it is a retry of the same action.
  • Holder deceased or entity dissolved. The status will usually say so. Decide in advance what your product does.

Mistakes we see, and how to avoid them

The first mistake is treating HTTP 200 as approval. A 200 means the call completed. The verdict is in valid, the status and the name-match fields. The second is forwarding raw errors to end users; map 400 to "please check your PAN", map 429 and 502 to "we could not verify right now, please try again", and send 401, 402 and 403 to your own alerting. The third is comparing nameMatchScore as a string, or as a number in some places and a string in others; parse it once, at the boundary. The fourth is hard-coding the list of statuses; the list can change and an unknown value should mean review. The fifth is calling the API from a browser or mobile app, which exposes your key and bypasses your throttle. The sixth is logging full PANs in application logs or error trackers; log referenceId and requestId instead. The seventh is running tests with a production key, which debits the wallet and processes real personal data.

A subtler mistake is to collect the name after the PAN check, then run the lookup without it. You pay for a call that cannot produce name-match fields and then pay again when you add the name. Collect both first.

Sources and what to confirm

  • StampMitra PAN 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.
  • StampMitra acceptable use policy: purpose limits and the ban on rate-limit evasion and enumeration, read in 2026.
  • Income Tax Department of India guidance on the PAN structure and status codes: the category letters are widely published and stable, but confirm any rule you intend to code against the current official guidance, and treat the status code list as non-exhaustive.
  • Digital Personal Data Protection Act, 2023, published by the Ministry of Electronics and Information Technology: confirm the current commencement position before relying on any summary, including this one.

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. Send with it: name: Rahul Kumar. 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 PAN
SNDBX0001F
200
200 with the full PAN record: valid true, panStatus VALID, registeredName, nameMatchResult MATCH.
PAN not found / invalid number
SNDBX0002F
200
200 with valid false and panStatus INVALID (a completed lookup that found no such PAN).
Name does not match
SNDBX0003F
200
200 with valid true but nameMatchResult NO_MATCH and a low nameMatchScore.
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

Does a PAN match prove that the person submitting it owns the PAN?

No. A match shows that the number and the name are consistent with the Income Tax Department record. Anyone who has seen a PAN card can type the same details, so pair the check with something that proves possession, such as a selfie match, a bank account in the same name or a signed document.

What does the fourth letter of a PAN mean, and does the API validate it?

The fourth letter is the holder category: P for an individual, C for a company, H for a Hindu Undivided Family, F for a firm or LLP, A for an association of persons, B for a body of individuals, T for a trust, L for a local authority, J for an artificial juridical person and G for government. The API only checks the overall pattern, so decode the letter yourself.

What is the difference between valid and the PAN status?

The valid flag says the registry found the number. The status says what state the record is in. A record can exist and still carry a status other than the plain valid one, for example after a deletion, a death or a merger, so branch on both and send unusual statuses to review.

How should I use nameMatchResult and nameMatchScore?

Use them as inputs to a policy you own. The verdict values seen are MATCH, GOOD_PARTIAL_MATCH, POOR_PARTIAL_MATCH and NO_MATCH, and the score runs from 0 to 100. StampMitra does not publish the comparison algorithm or a cut-off, so keep your thresholds in versioned configuration.

Am I charged when the PAN comes back as not valid?

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 locally before calling so you do not pay for typos.

What happens if my request times out after the server has already processed it?

Send an Idempotency-Key header and reuse the same key when you retry. The retry then returns the stored response without running a second lookup or a second debit. Reusing a key with a different body is rejected with a 422 IDEMPOTENCY_KEY_REUSED.

What are the rate limits for PAN verification?

The limit is per plan and shared by all your keys and routes in an environment, counted per minute. At the time of writing it is 60 requests per minute 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.

Which PAN numbers can I use to test in the sandbox?

SNDBX0000A always returns a valid PAN with the status VALID and a synthetic name, and SNDBX9999F always returns not valid. Any other well-formed PAN gets a stable but arbitrary result, with about two in three coming back valid. All names in sandbox replies are synthetic.

Can I verify a PAN without sending a name?

Yes. Without a name you learn whether the record exists and what its status is, but you get no name-match verdict or score. If you do have a name, send it with the first call, because adding it later means paying for a second call.

Does the response include the holder's address, date of birth or phone number?

No. The documented response carries the registered name, the status, the match fields and the Aadhaar link flag, plus the reference id. Do not build features that depend on an address or a date of birth coming back from this endpoint.

Does StampMitra offer Aadhaar-based verification through this API?

No. The PAN response reports whether Aadhaar is linked to the PAN record, which is a flag on the PAN, but StampMitra does not offer Aadhaar-based verification. Ask your compliance owner what an unlinked PAN should mean for your product.

Can I cache a PAN verification result?

You can keep a recent result for the purpose you collected it for, which saves money on double submits and retries. Decide the retention window with your compliance owner, store the minimum fields and mask the PAN. Re-verify when a rule or a risk trigger requires fresh data.

Build with AI

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

ENDPOINT: POST /v1/verify/pan
- Verify PAN
- Required scope: verification.pan.read
- Parameters:
  - pan (string, required): PAN, format ABCDE1234F.
  - name (string, optional): Name to match against records (max 256 chars).
- Example request body: {"pan":"ABCDE1234F","name":"Rahul Kumar"}
- Response fields: referenceId, pan, type, valid, registeredName, fatherName, panStatus, panStatusCode, panStatusDescription, nameMatchResult, nameMatchScore, aadhaarSeedingStatus, aadhaarSeedingStatusDescription, lastUpdatedAt, message
- Example response: {"referenceId":"SMV-20260927-8F42K7","pan":"ABCDE1234F","type":"Individual","valid":true,"registeredName":"RAHUL KUMAR","fatherName":"SURESH KUMAR","panStatus":"VALID","panStatusCode":"E","panStatusDescription":"Existing and valid PAN","nameMatchResult":"MATCH","nameMatchScore":"100","aadhaarSeedingStatus":"y","aadhaarSeedingStatusDescription":"Aadhaar linked","lastUpdatedAt":"2023-04-01","message":"PAN is Valid"}
- 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.