StampMitraDevelopers
LiveVerification API

Passport Verification API for India: Application File Number, Date of Birth and Name

Verify a Passport in real time.

POST/v1/verify/passportScope verification.passport.read₹9 per call
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/passport" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fileNumber": "PA1079341954215",
    "dob": "1998-12-31",
    "name": "John doe"
  }'
Example responseJSON
{
  "referenceId": "SMV-20260927-4W19X6",
  "verificationId": "VRF-6N2R8D4YTH3K",
  "valid": true,
  "status": "VALID",
  "fileNumber": "PA1079341954215",
  "name": "John doe",
  "dob": "1998-12-31",
  "applicationType": "NORMAL",
  "applicationReceivedDate": "2003-12-31"
}

A passport verification API in India does not always do what the name suggests, so start with the identifier. StampMitra's Passport endpoint takes the passport application file number, not the number printed inside the passport booklet, together with the applicant's date of birth and, optionally, a name. You send POST /v1/verify/passport with fileNumber, dob and optionally name, using a key that carries the verification.passport.read scope. The response returns a valid flag, the name and dob on the record, the applicationType (the sample shows NORMAL), the applicationReceivedDate, the fileNumber echoed back, a status, and a referenceId and verificationId.

That is a narrower result than many teams expect, and a lot of integration mistakes come from the gap between the expectation and the contract. This page is about closing that gap. It covers what a file number is and where an applicant finds it, what the response can and cannot support, which workflows it suits (forex and remittance onboarding, travel and visa agencies, overseas education and recruitment), how to handle names that are written differently on different documents, the access controls this premium endpoint needs, what a call costs, and how to run it with a privacy posture that matches how sensitive passport data is.

Everything about the contract is taken from the Passport entry in StampMitra's API reference; where that entry says nothing, so does this page. Treat it as general information, not legal advice.

Key takeaways

  • The call: POST https://api-b2b.stampmitra.in/v1/verify/passport with fileNumber and dob, both required, and an optional name. The key needs verification.passport.read.
  • The input is the passport application file number, not the passport booklet number. The sample is PA1079341954215.
  • The response guarantees referenceId, verificationId and valid. When the passport office provides them it also carries status, fileNumber, name, dob, applicationType and applicationReceivedDate. It has no passport number, issue or expiry date, or validity status.
  • Passport sits in the premium price band, ₹9 per completed call on pay-as-you-go, excluding GST. Sandbox is free and never debits the wallet.
  • Access is restricted to IP-allowlisted keys, as with Driving Licence. Whether your plan offers an allowlist decides if you can launch at all.
  • Passport details are among the most sensitive data you will ever hold. Ask for little, keep it out of logs, and retain the decision and referenceId instead.
  • Bad input is rejected with 400 at no charge. A "not found" answer is billed like any other completed check.
  • Use it where an application-file check answers a real question. Where you need to read a passport's number or expiry, plan a different step.

The identifier question: file number or passport number

An Indian passport carries a passport number in the booklet. A person who applies for a passport, or for a reissue, is given an application file number, which appears on the acknowledgement or receipt generated at the time of the application. They are different identifiers. A passport booklet number is typically a letter followed by seven digits. The file number in StampMitra's sample, PA1079341954215, is two letters followed by thirteen digits, fifteen characters in all.

Why this matters in practice. If your form says "passport number" and the user types the booklet number, the call will fail validation, and you will have trained users to blame your product. Label the field precisely, show a short hint ("the 15-character file number on your passport application receipt") and, if you can, an image of where it appears. The validation message the endpoint returns reads "fileNumber must match the format PA1079341954215", which tells you the shape it expects.

A related consequence: the people who can supply a file number are those who applied for a passport and kept the receipt, which is not the same population as everyone who holds a passport. For some customers, especially those whose passport is years old, the file number may be hard to find. Your flow needs a fallback document.

The leading letters of a file number typically relate to the issuing office, but the reference does not document this, so do not build logic on it. Treat the number as opaque, normalise it and let the API validate.

JavaScript
export function normaliseFileNumber(raw) {
  return String(raw).toUpperCase().replace(/[\s\-.]/g, "");
}

What the lookup returns

The reference documents this request and response.

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.
fileNumberrequiredstringPassport application file number, format PA1079341954215. Not the passport number.
dobrequiredstringDate of birth (YYYY-MM-DD).
namestringName to match against records.

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.
validbooleanWhether the passport application file number is valid. Always present.
statusstringOutcome of the lookup: VALID or INVALID.
fileNumberstringThe passport application file number that was looked up. This is the application file number, not the passport number.
namestringThe applicant's name as held on the application, when valid.
dobstringThe applicant's date of birth, ISO yyyy-mm-dd, when valid.
applicationTypestringThe type of passport application (for example NORMAL), when valid.
applicationReceivedDatestringDate the application was received, ISO yyyy-mm-dd, when valid.

valid says whether the file number and date of birth together resolved to a record. A false result can mean a mistyped number, a wrong date of birth, or no such file; the response does not distinguish them.

name is the applicant's name on the record. In the sample it is a single string (John doe, exactly as the record holds it), so you do not get separate given-name and surname fields, and you should not rely on its letter case.

dob is the date of birth on the record, as an ISO date. Compare it with the value you sent.

applicationType describes the kind of application. The sample shows NORMAL. The reference documents only that example, so do not assume the full list of values, and handle unfamiliar values by reviewing the case.

applicationReceivedDate is the date the application was received, as an ISO date. It is the date of the application, not an issue or expiry date of any passport. fileNumber echoes the application file number the lookup was for, and status is VALID or INVALID and agrees with valid; branch on valid. verificationId (format VRF- plus 12 characters) is StampMitra's own id for this verification, generated for every call; quote it in support requests.

referenceId is StampMitra's transaction identifier, SMV-YYYYMMDD-XXXXXXX, present on every completed call including a negative one, and not an idempotency key.

What it cannot support

A lot of the value of this page is in being specific about limits.

It does not return the passport number. If you need the booklet number for a record, a visa application or a regulatory form, this endpoint will not supply it.

It has no issue date, expiry date or validity status. The documented response says nothing about whether a passport has been issued, when, or until when it is valid. If the thing you need to know is "is this passport valid for six more months", the endpoint cannot answer it.

It does not return a photograph, address or nationality statement. None is documented.

It does not prove the person presenting the details is the applicant. Someone with another person's file number and date of birth can submit them. If you need to bind the details to a person, add a selfie and liveness step or an in-person check.

It does not carry a match score. name is an optional input documented as a name to match, but the documented response has no match result. You compare the returned name yourself.

Because of this, the endpoint is best described accurately as an application-record check. It confirms that a passport application exists with this file number and date of birth, and what name, application type and received date are on it.

Choosing the right check

You need to knowUseNote
A passport application exists for this person with this name and date of birthThis endpointApplication-record check
The booklet number, expiry or validityA step outside this APINot in the documented response
A tax identity and registered namePAN verificationOften required alongside
A licence to driveDriving Licence verificationAlso needs an IP-allowlisted key
A voter recordVoter ID verificationNo photo in the response either
A payable bank accountBank account verificationConfirms the holder name

If your regulator or partner requires passport details that this endpoint does not return, do not describe the check to them as passport verification in the broad sense. Describe what it does.

Names across documents

Passport names are a recurring source of false mismatches. The passport may hold a given name and surname as separate fields, while the record here is one string. People who changed their name after marriage or by gazette notification may carry different names on different documents. Many have a single name, or use initials for one part. Some documents spell the same name differently because of transliteration.

A useful matching approach is to normalise to upper case, strip punctuation and honorifics, split into tokens and compare token sets, allowing an initial to match a full token, and to ignore token order.

JavaScript
const STOP = new Set(["MR", "MRS", "MS", "DR", "SHRI", "SMT", "KUMARI"]);

export function tokens(raw) {
  return String(raw).toUpperCase().replace(/[^A-Z\s]/g, " ").split(/\s+/).filter((t) => t && !STOP.has(t));
}

export function overlap(a, b) {
  const A = tokens(a), B = tokens(b);
  if (!A.length || !B.length) return 0;
  const same = (x, y) => x === y || (x.length === 1 && y.startsWith(x)) || (y.length === 1 && x.startsWith(y));
  return A.filter((x) => B.some((y) => same(x, y))).length / Math.max(A.length, B.length);
}

Three bands work well. A high overlap passes. A middle band goes to a person with both names on screen. A low overlap is rejected with a request to supply a document that shows the name change. Choose the thresholds from real applicants, not from sandbox, whose names are synthetic, and write them down with a date.

Why the date of birth is in the request

Passport is one of two verification calls that ask for a date of birth as well as an identifier. In effect the date is a second half of the lookup key, which makes it harder to probe the service with guessed file numbers. For you, that has a few knock-on effects.

A valid: false answer is ambiguous. The file number might be wrong, or the date, or the application might not exist. Your error copy has to cover all three without pretending to know which one it is. Collect the date with a picker that produces YYYY-MM-DD, since a swapped day and month is a classic cause of false negatives. And remember that a date of birth you collect for this call is personal data from the first keystroke, so it should not land in logs or in a table that outlives the decision.

JavaScript
export function isIsoDate(s) {
  return /^\d{4}-\d{2}-\d{2}$/.test(s) && !Number.isNaN(Date.parse(s));
}

Access controls for a premium endpoint

Of everything on this page, the access rule is the one most likely to move your launch date, so it comes before the code. The StampMitra SDK documentation lists Passport, along with Driving Licence, as a call that works only with an IP-allowlisted key. A key that falls short is not silently downgraded; the server's permission message is handed back to your code.

Work through it in this order.

  1. Find out whether your plan has the feature. An IP allowlist is listed per plan on the pricing page. If yours lacks it, the upgrade conversation belongs at the start of the project rather than the week before release.
  2. Pin down your egress. An allowlist is a list of addresses or CIDR ranges. Whatever server makes the call needs an address that does not change. Teams on autoscaling infrastructure usually send verification traffic through one small proxy or NAT gateway so the list stays short.
  3. Issue a key just for this. Give it verification.passport.read and nothing else, keep it in a secrets manager, and do not share it with the services that call cheaper endpoints. Headers and scopes are covered in the authentication docs.
  4. Keep browsers and phones out of it. A client-side call would put the key in view and arrive from an address you never listed.
  5. Rehearse both outcomes. Call from a listed address and confirm success. Call from anywhere else and confirm a 403. Do this in staging well before launch.

After launch, a 403 on this endpoint is a configuration alarm, not an applicant problem.

Billing and failure behaviour

What does a call cost? Passport is metered as passport.verify and sits in the premium band alongside Vehicle RC: ₹9 per completed call on pay-as-you-go, less on larger plans, before 18% GST. Your plan's figure is on the pricing page. The wallet is debited the moment a production verification finishes.

Is a "not found" answer free? No. If the lookup completes and the file number and date of birth match nothing, you received a determination: it is logged, charged, and carries a referenceId.

What is never charged? Anything that fails before verification starts: a malformed input (400), an unusable key (401), or a missing scope or non-allowlisted key (403).

What about the other failures? A low wallet answers 402, and the remedy is a top-up. Exceeding the limit answers 429; the documented example reads "Rate limit exceeded: 60 requests per 60 seconds for this endpoint." An unreachable upstream answers 502, and since nothing completed, nothing is billed for it. After a timeout you cannot tell whether the charge happened, because the route has no idempotency header and the referenceId is not one.

StatusCodeMeaningYour action
400BAD_REQUESTfileNumber or dob malformedShow the message, ask for correction
401UNAUTHORIZEDMissing or invalid keyFix deployment
402PAYMENT_REQUIREDWallet balance insufficientTop up, alert operations
403FORBIDDENMissing scope or key not IP-allowlistedFix key, scope or allowlist
429TOO_MANY_REQUESTSRate limit or sandbox limit (SANDBOX_RATE_LIMIT, SANDBOX_DAILY_LIMIT or SANDBOX_IP_LIMIT)Back off with jitter
502INTERNAL_ERRORUpstream unreachableRetry with backoff

Every error arrives in one envelope, { "error": { "code", "message", "requestId" } }.

  • 400Validation errorBAD_REQUEST

    fileNumber must match the format PA1079341954215

  • 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

Failure causes and the words to use with applicants

  • valid: false. Most often a mistyped file number, a booklet number entered by mistake, or a wrong date of birth. Say: "We could not find an application with these details. Please check the file number on your application receipt and your date of birth."
  • A valid result with a different name. Show the name on record and let the applicant confirm. Common causes are name changes, initials and transliteration.
  • An unfamiliar applicationType. Treat as a review case, not a failure.
  • 403. Your configuration. Tell the applicant the check is temporarily unavailable.
  • 429 and 502. Transient. Ask the applicant to wait a moment or resume later.

Workflows where an application-record check helps

Forex card and remittance onboarding. A provider that needs to link an applicant to a government identity document may accept the passport file details as one supporting check. The provider still needs the passport booklet details for its own regulatory records, which it collects through its normal document process.

Travel and visa agencies. An agency can confirm that a customer's application exists with the right name and date of birth before it books anything dependent on that, and flag a mismatch early. Passport validity for travel is checked from the document itself.

Overseas education and recruitment. Consultancies collect many applicants' details. A quick consistency check between the name and date of birth the applicant typed and the record reduces data-entry errors before forms go to a university or employer.

Employer deployment. Companies sending staff abroad can validate that the file details the employee provided are consistent, as one input to a larger pre-departure checklist.

In each case the check supports a data-quality and consistency decision, which is a legitimate and useful job. It is not a substitute for reading the passport.

Combining with PAN and bank account checks

For financial onboarding, a three-way consistency check is the pattern that works best. Verify the PAN and take the registered name; run the passport application check and compare the name and date of birth; then verify the payout or settlement bank account using the PAN name. If the names agree across all three, you have independent records that corroborate each other. Order the checks by cost and stop at the first hard failure: the PAN check is a standard-rate call, the bank account check has its own rate and the passport check is premium, so a failed PAN should end the journey before a premium call is spent. See PAN verification and bank account verification.

Integration walkthrough

cURL

cURL
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/passport" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fileNumber":"PA1079341954215","dob":"1990-01-01","name":"Rahul Kumar"}'

Node.js

The Node.js SDK and Python SDK wrap this endpoint. The raw calls show what they do. Run it from the backend whose address is on the allowlist.

JavaScript
// Node 18+ (built-in fetch)
const BASE = "https://api-b2b.stampmitra.in";

export async function verifyPassportFile({ fileNumber, dob, name }, { timeoutMs = 20000 } = {}) {
  if (!isIsoDate(dob)) return { kind: "invalid_input", message: "Date of birth must be YYYY-MM-DD." };
  const res = await fetch(`${BASE}/v1/verify/passport`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ fileNumber: normaliseFileNumber(fileNumber), dob, ...(name ? { name } : {}) }),
    signal: AbortSignal.timeout(timeoutMs),
  });
  const body = await res.json().catch(() => ({}));
  if (res.ok) return { kind: "completed", result: body };
  const { code, message, requestId } = body.error ?? {};
  const retryable = res.status === 429 || res.status === 502;
  return { kind: retryable ? "retry" : "failed", status: res.status, code, message, requestId };
}

Python

Python
import os, re, requests

BASE = "https://api-b2b.stampmitra.in"

def verify_passport_file(file_number: str, dob: str, name: str | None = None, timeout: int = 20) -> dict:
    if not re.fullmatch(r"\d{4}-\d{2}-\d{2}", dob):
        return {"kind": "invalid_input", "message": "Date of birth must be YYYY-MM-DD."}
    payload = {"fileNumber": re.sub(r"[\s\-.]", "", file_number.upper()), "dob": dob}
    if name:
        payload["name"] = name
    resp = requests.post(
        f"{BASE}/v1/verify/passport",
        headers={"Authorization": f"Bearer {os.environ['STAMPMITRA_API_KEY']}"},
        json=payload,
        timeout=timeout,
    )
    body = resp.json() if resp.content else {}
    if resp.ok:
        return {"kind": "completed", "result": body}
    err = body.get("error", {})
    return {
        "kind": "retry" if resp.status_code in (429, 502) else "failed",
        "status": resp.status_code,
        "code": err.get("code"),
        "message": err.get("message"),
        "requestId": err.get("requestId"),
    }

Turning the result into an outcome

JavaScript
const KNOWN_TYPES = new Set(["NORMAL"]); // extend only after your team decides

export function assessPassportFile(result, applicant, { minOverlap = 0.85 } = {}) {
  if (result.valid !== true) return { outcome: "reject", reason: "not_found", referenceId: result.referenceId };
  const reasons = [];
  if (overlap(applicant.name, result.name) < minOverlap) reasons.push("name_unclear");
  if (applicant.dob !== result.dob) reasons.push("dob_differs");
  if (!KNOWN_TYPES.has(result.applicationType)) reasons.push("application_type_unfamiliar");
  return { outcome: reasons.length ? "review" : "approve", reasons, referenceId: result.referenceId };
}

Edge cases and odd inputs

  • Booklet number in the file number field. The commonest user error. Fix it with a clear label and hint.
  • Spaces, hyphens and lower case. Normalise.
  • Day and month swapped. Use a date picker.
  • Name changes. Ask for a supporting document and keep a review path.
  • Single-name applicants. Some people have one name. Expect a short name and avoid rules that demand a surname.
  • Reissues and renewals. An applicant may have several file numbers over the years. The one on the latest receipt is not necessarily the one they remember.
  • Minors. Applications for minors are made by guardians, and the record belongs to the minor. Treat such cases with extra care and your own rules.
  • Lost receipts. Offer a fallback document rather than leaving the applicant stuck.
  • Unfamiliar applicationType. Review rather than reject.
  • Duplicate submissions. De-duplicate on a hash of the normalised file number and date of birth in a short window to avoid paying for a premium call twice.

Audit logging and monitoring

Decide up front what a log line may contain. A line that reads "applicant 8841, outcome review, reason name_unclear, referenceId SMV-..., status 200" is useful to an investigator and harmless if it leaks. A line that contains the file number, the date of birth and the returned name is a liability. Keep the first kind, and when you must tie a line to a file number for debugging, store a keyed hash of it.

StampMitra keeps request logs you can pull through GET /v1/logs or read in the dashboard; how long they are kept depends on the plan, reaching 365 days on Scale. Your own decision records are separate, and how long to keep them is a question for your audit and legal teams.

Four signals are worth a dashboard. Any 403 should page someone. A rising share of valid: false usually means the form is confusing applicants between the file number and the booklet number. The review share tells you whether your name thresholds fit real applicants. And spend per day matters more here than on cheaper endpoints because each call is premium-rate.

Modelling the cost

Because each call is premium-rate, the saving is in not making unnecessary calls.

JavaScript
export function monthlyPassportCost({ applicants, retryShare = 0.2, pricePerCall }) {
  const calls = applicants * (1 + retryShare);
  return { calls: Math.ceil(calls), cost: Math.ceil(calls) * pricePerCall };
}

Suppose a forex provider has 1,200 applicants a month who choose the passport route and 20 percent need a second attempt, mostly through the booklet-versus-file-number confusion. That is 1,440 calls. A clear field label, a hint with an image and a confirm-the-number screen can reasonably be expected to cut retries sharply, and each retry avoided is a premium-rate call you do not pay for. Multiply by your plan's passport rate and add 18% GST on the top-up. Also run the cheaper checks first: if PAN fails on a journey, never spend the premium call.

Sandbox and production

Start with sk_test_ from sign-up. It never touches the wallet, and what it returns is sample data: no magic values are published for Passport, a given input always produces the same answer, about two in three come back valid, and every name is invented. That is enough to build and test the form, the normalisation, the error paths and each screen, ideally with a handful of saved responses so unit tests stay offline. It tells you nothing about how your name thresholds will behave on real applicants, and its limits are not production limits.

Production needs an sk_live_ key, which exists only after your organisation's KYC and a Passport production application are approved. The server reads the environment from the key, so the request you tested is the request you ship; the quickstart walks through a first call. Treat the allowlist rehearsal described above as part of go-live, because a passing sandbox says nothing about production access.

Writing the applicant-facing copy

Most failures on this endpoint are made in the form, not in the API, so the words on the screen are part of the integration. A few patterns hold up well.

Name the field exactly. "Passport application file number" with the helper "15 characters, on the receipt from your passport application. This is not the number inside the passport." removes the largest single source of failed calls.

Show where to find it. A small image of an application receipt with the file number highlighted does more than a paragraph. If you cannot show a real receipt, a simple mock-up is fine, as long as it is clearly an illustration.

Confirm before you submit. After the applicant types the number and picks the date, repeat both back in a large, clear typeface and ask them to confirm. Each retry you avoid is a premium-rate call you do not pay for.

Make the failure message actionable and neutral. "We could not find an application with these details. Please check the file number and your date of birth, or choose another document." It does not accuse, and it does not claim to know which input is wrong.

Offer an exit. An applicant who cannot find the receipt should not be stuck. Offer another document, or a way to continue later. A verification step that dead-ends loses applicants for reasons that have nothing to do with risk.

Explain why you ask. One sentence, shown before the field: that you check the details against the passport application record, and what you keep. It reduces drop-off and it supports your consent record.

Caching and re-verification

A passport application record does not change frequently, but your decisions are tied to time. Store the outcome, the referenceId and the timestamp against the applicant, and reuse a recent completed result for the same applicant within a window you choose, for example the length of one onboarding journey, instead of calling again when they return to the form. Do not reuse a result across different applicants, and do not treat an old result as fresh for a later, different purpose. If an applicant changes the file number, date of birth or name after a successful check, start again, because the earlier result no longer describes what they now claim.

Because the call is premium-rate, put the cache key on a hash of the normalised file number and date of birth, store it only as long as the journey needs, and clear it when the journey ends. That gives you most of the saving without keeping personal data longer than necessary.

Production checklist

  1. The key has only verification.passport.read, is stored in a secrets manager and is IP-allowlisted.
  2. Your plan includes an IP allowlist, and the allowlist has been tested end to end.
  3. The form labels the field as the application file number and explains the difference.
  4. Date of birth uses a date picker producing YYYY-MM-DD.
  5. Cheaper checks run before this premium call.
  6. Names are compared with token matching and thresholds taken from real data.
  7. Unfamiliar applicationType values go to review.
  8. Retries happen only on 429 and 502.
  9. Any 403 raises an alarm.
  10. Logs hold reference IDs and outcomes, not personal fields.
  11. The fallback for applicants without a file number is defined.
  12. Notice and retention cover the data.

Common mistakes

  • Calling it "passport verification" to partners. It is an application-record check.
  • Asking for the "passport number". Users type the booklet number and the call fails.
  • Expecting expiry or validity. Not in the response.
  • Expecting a match score. Compare names yourself.
  • Telling the applicant which field is wrong. You do not know.
  • Running this before PAN. Spend the premium call last.
  • Calling from the browser. The key is exposed and the call is off the allowlist.
  • Logging the response. It puts names and dates of birth in logs.
  • Launching without testing the allowlist. A 403 on launch day is avoidable.
  • Collecting passport scans you do not need. Minimise.

Sources

  • Passport API reference, StampMitra product data: request fields, response example, scope and validation message, checked October 2026.
  • Pricing, StampMitra: premium per-call rate, plan features including the IP allowlist, and log retention, checked October 2026. Rates exclude 18% GST.
  • Ministry of External Affairs and the Passport Seva portal, for how passport applications and file numbers work. Check the current guidance on the official site.
  • Digital Personal Data Protection Act, 2023, Government of India. Read the current Act and the rules made under it on the official government sites.

Sandbox test values

Send one of these values as fileNumber 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: dob: 1990-01-01, 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 passport file
SB0000000000001
200
200 with valid true, name, dob and applicationType.
File number not found
SB0000000000002
200
200 with valid false and no passport details.
Verification source times out
SB0000000000005
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
SB0000000000006
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
SB0000000000007
429TOO_MANY_REQUESTS
Too many requests. Back off and retry with exponential delay and jitter.
Wallet balance too low
SB0000000000008
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
SB000000000000
400BAD_REQUEST
Validation error that names the field. Nothing is looked up and nothing is charged.

Frequently asked questions

What does the passport verification API check?

It checks a passport application file number together with a date of birth and returns valid, status, the file number, name, dob, applicationType, the application received date, a referenceId and a verificationId. It is an application-record check. It does not return the passport booklet number, issue or expiry dates or a validity status, so it cannot tell you whether a passport is valid for travel.

Is the input the passport number or the file number?

The file number, not the number inside the booklet. The sample is PA1079341954215, two letters and thirteen digits, taken from the application receipt. A booklet number is a different identifier, so label your form field precisely or users will type the wrong number and the call will fail validation.

Does the response include a name match score?

No. You can send an optional name, documented as the name to match against records, but the documented response has no match result and returns the name as one string. Compare it with your applicant's name yourself using token matching that tolerates initials, name changes and transliteration.

Does this endpoint need an IP-allowlisted key?

Yes. StampMitra's SDK documentation describes Passport and Driving Licence as needing an IP-allowlisted key, and the server's message is passed through otherwise. An IP allowlist is a plan feature on the pricing page, so confirm your plan includes one and test the allowlist before go-live.

Why is a date of birth required?

The date of birth acts as a second key for the lookup. The consequence is that a valid false result can mean a wrong file number or a wrong date, so ask the applicant to re-check both, collect the date with a picker producing YYYY-MM-DD and avoid telling them which input is wrong.

When am I billed for a passport check?

Usage is recorded and the production wallet debited when the verification completes, at the premium rate. A negative result is still a completed, billed determination. A malformed input, bad key or missing scope or allowlist returns 400, 401 or 403 and is not billed, and sandbox calls never debit your wallet.

Which workflows suit an application-record check?

Forex card and remittance onboarding, travel and visa agencies, overseas education and recruitment consultancies and employer pre-departure checks. In each it supports a consistency and data-quality decision. Where you need the booklet number or expiry, collect them through your document process because this endpoint does not return them.

How should I handle name differences across documents?

Normalise to upper case, remove punctuation and honorifics, compare token sets with initials allowed and ignore order. Pass a high overlap, send a middle band to a person with both names on screen, and ask for a document showing a name change when the overlap is low. Set thresholds from real applicants, not sandbox.

Can I test passport verification for free?

Yes. A sandbox key starting with sk_test_ never debits your wallet and returns sample data with synthetic names, so the same input always gives the same answer. Use it for the form, normalisation, error handling and screens, and test the production IP allowlist path separately before launch.

What personal data should I store after the check?

Usually the outcome, reason codes, referenceId and timestamp. Avoid keeping the file number or date of birth unless a rule or genuine need requires it, do not collect passport scans you do not need, keep personal fields out of logs, set a retention period and explain what you keep in your notice.

How do I avoid paying for unnecessary premium calls?

Run cheaper checks such as PAN first and stop at the first hard failure, label the file number field clearly, show the typed values back for confirmation, de-duplicate on a hash of the normalised file number and date of birth, and reuse a recent completed result within one onboarding journey.

What does a 403 on this endpoint mean?

Usually a missing verification.passport.read scope or a key that is not IP-allowlisted, both configuration problems. It is not retryable, so raise an alert, check the key, scope and allowlist, and tell the applicant the check is temporarily unavailable instead of suggesting they entered something wrong.

Build with AI

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

ENDPOINT: POST /v1/verify/passport
- Verify Passport
- Required scope: verification.passport.read
- Parameters:
  - fileNumber (string, required): Passport application file number, format PA1079341954215. Not the passport number.
  - dob (string, required): Date of birth (YYYY-MM-DD).
  - name (string, optional): Name to match against records.
- Example request body: {"fileNumber":"PA1079341954215","dob":"1998-12-31","name":"John doe"}
- Response fields: referenceId, verificationId, valid, status, fileNumber, name, dob, applicationType, applicationReceivedDate
- Example response: {"referenceId":"SMV-20260927-4W19X6","verificationId":"VRF-6N2R8D4YTH3K","valid":true,"status":"VALID","fileNumber":"PA1079341954215","name":"John doe","dob":"1998-12-31","applicationType":"NORMAL","applicationReceivedDate":"2003-12-31"}
- 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 and valid is optional and is omitted when the passport office does not provide it. Dates are ISO yyyy-mm-dd strings. fileNumber is the application file number, not the passport number. The applicant's personal details are masked in your call records; the response itself carries them in full.

Rules for this verification
- Validate fileNumber, dob 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.