StampMitraDevelopers
LiveVerification API

Voter ID Verification API for India: EPIC Lookup, Name Match and Age Checks

Verify a Voter ID in real time.

POST/v1/verify/voter-idScope verification.voter.read₹5 per call
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/voter-id" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "voterId": "UAI4574761",
    "name": "HARSHIT PRAJAPATI"
  }'
Example responseJSON
{
  "referenceId": "SMV-20260927-7H83M1",
  "verificationId": "VRF-4C8P2WJ6ZK9T",
  "valid": true,
  "status": "VALID",
  "epicNumber": "UAI4574761",
  "name": "HARSHIT PRAJAPATI",
  "nameInRegionalLang": "हर्षित",
  "age": "23",
  "relationType": "FTHR",
  "relationName": "RAJ PRAJAPATI",
  "relationNameInRegionalLang": "राज",
  "fatherName": "RAJ PRAJAPATI",
  "dob": "2000-12-07",
  "gender": "Male",
  "address": "GOVT JUNIOR COLLEGE SIRWAR",
  "photoUrl": "https://example.com/voter-photos/UAI4574761.jpeg",
  "splitAddress": {
    "district": [
      "INDORE"
    ],
    "state": [
      "Madhya Pradesh"
    ],
    "city": [
      "SANER"
    ],
    "pincode": "560034",
    "country": [
      "IN",
      "IND",
      "INDIA"
    ],
    "addressLine": "GOVT JUNIOR COLLEGE SIRWAR"
  },
  "state": "Madhya Pradesh",
  "assemblyConstituencyNumber": "211",
  "assemblyConstituency": "SANER",
  "parliamentaryConstituencyNumber": "25",
  "parliamentaryConstituency": "INDORE",
  "partNumber": "27",
  "partName": "SIRWAR",
  "serialNumber": "713",
  "pollingStation": "GOVT JUNIOR COLLEGE SIRWAR"
}

A voter ID verification API takes the number printed on an Elector's Photo Identity Card, known as the EPIC number, and returns what the electoral record holds for it: the name (also in the regional language of the roll), the relative named on it, date of birth, gender, age, address, constituencies, roll part and polling station. With StampMitra you send POST /v1/verify/voter-id with a voterId and, optionally, the name you expect, using a key that carries the verification.voter.read scope. The response comes back with a valid flag, a status, those record fields, and a referenceId and verificationId for your records.

This page is for the developer adding an ID-document step to onboarding and for the compliance or operations owner who has to decide what that step proves. It is deliberately practical about the awkward parts: an address that was correct at the last electoral roll revision, a date of birth you might use for an age gate, names that were transliterated from a regional language, and a card that tells you nothing about whether the person holding it is the person on it. If you only need the field list, the Voter ID API reference has it. Here you will find what to do with the fields.

Contract details here are drawn from StampMitra's Voter ID API reference; where that reference says nothing, the page says nothing too. It is general information, not legal advice.

Key takeaways

  • Endpoint: POST https://api-b2b.stampmitra.in/v1/verify/voter-id. Body: voterId, plus an optional name. Scope: verification.voter.read.
  • The response guarantees referenceId, verificationId and valid. Everything else is optional and appears when the electoral roll provides it: status, epicNumber, name, nameInRegionalLang, age, the relative fields, fatherName, dob, gender, address, splitAddress, photoUrl, state, the constituency, part and polling station fields. The photo is only a link, and there is no name-match score, so you do the name comparison yourself.
  • Price is the standard verification rate, ₹5 per completed call on pay-as-you-go, excluding GST. Sandbox is free and never debits the wallet.
  • A valid result shows that the number exists in the record. It does not show that the applicant is the person on the card.
  • Address and age come from the record as it stood at its last update. Use them to corroborate, not as the final word on where someone lives today.
  • Date of birth, gender and address are personal data. Keep them out of logs and store only what the decision needs.
  • Malformed input returns 400 and is not billed. A negative result is a completed, billed check.
  • Voter ID works best as one document in a ladder with PAN, driving licence and bank account checks, ordered by cost and by what you need to prove.

What an EPIC is and what the lookup returns

The Election Commission of India issues the Elector's Photo Identity Card to registered voters, and the number on it identifies the voter's entry in the electoral roll. Under the hood the lookup resolves that number to the roll entry. StampMitra's reference does not name the upstream source or describe update frequency, so treat the response as a snapshot of the entry at the moment of the call.

The sample response for a valid number:

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.
voterIdrequiredstringEPIC / Voter ID number, format ABC1234567.
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 voter ID is valid. Always present.
statusstringOutcome of the lookup: VALID or INVALID.
epicNumberstringThe voter ID (EPIC) number that was looked up.
namestringThe voter's registered name, when the voter ID is valid.
nameInRegionalLangstringThe voter's name in the regional language of the roll.
agestringThe voter's age in years, as a string, when available.
relationTypestringType of the relation named on the roll (for example FTHR for father, HUSB for husband).
relationNamestringName of the relative named on the roll.
relationNameInRegionalLangstringThe relative's name in the regional language of the roll.
fatherNamestringThe voter's father's name, when the roll gives it.
dobstringThe voter's date of birth, ISO yyyy-mm-dd, when the roll has one.
genderstringThe voter's gender, when the voter ID is valid.
addressstringThe registered address as one line, when the voter ID is valid.
photoUrlstringA link to the voter photo, when the roll has one. A link only, never image data; it can expire, so fetch it promptly.
splitAddressobjectThe registered address split into parts.
splitAddress.districtarrayDistrict(s).
splitAddress.statearrayState name(s), as a flat list.
splitAddress.cityarrayCity or town name(s).
splitAddress.pincodestringPIN code.
splitAddress.countryarrayCountry, as the codes and name given by the registry.
splitAddress.addressLinestringThe address as one line.
statestringThe registered state, when the voter ID is valid.
assemblyConstituencyNumberstringAssembly constituency number.
assemblyConstituencystringAssembly constituency name.
parliamentaryConstituencyNumberstringParliamentary constituency number.
parliamentaryConstituencystringParliamentary constituency name.
partNumberstringPart number of the electoral roll.
partNamestringPart name of the electoral roll.
serialNumberstringSerial number of the voter within the part.
pollingStationstringName of the polling station.

Reading the fields in the order that matters for decisions:

valid is the headline. If it is false, there is nothing further to interpret: the number did not resolve to a record, and the right action is to ask the user to re-enter or to offer another document.

name is the elector's name as held in the record. This is the field you compare with your applicant's name. In the documented sample it is upper case.

dob is the date of birth as an ISO calendar date, and age is a string such as "23". Treat dob as the primary value and compute age yourself at the time of your decision; the returned age is a convenience that reflects the moment the record was read.

gender is a word such as Male in the sample. Do not assume values beyond those you have seen.

address is the address as one free-text line, and state is the state of the electoral roll entry. If you intend to compare the address with a structured address from your form, use splitAddress, which gives the same address in parts: district, state, city and country are lists of strings, and pincode and addressLine are strings.

nameInRegionalLang is the name in the regional language of the roll, and relationType, relationName and relationNameInRegionalLang name the relative recorded against the voter (FTHR in the sample stands for father). fatherName repeats the father's name when the roll gives it. Keep the regional-language text as a string and do not try to transliterate it yourself for matching.

assemblyConstituency, parliamentaryConstituency (each with its number), partNumber, partName, serialNumber and pollingStation place the voter in the roll. They are useful for support and audit, and rarely needed for a yes or no decision.

photoUrl is a link to the photo held against the entry, when there is one. It is a link only, never image data, and it can expire, so fetch it promptly if you need it and do not store the link as a permanent reference.

status is VALID or INVALID and agrees with valid; branch on valid.

referenceId is StampMitra's transaction identifier in the format SMV-YYYYMMDD-XXXXXXX. It is present on every completed call, including a negative one, and it is not an idempotency key. verificationId (format VRF- plus 12 characters) is StampMitra's own id for this verification, generated for every call; quote it in support requests.

What the record cannot tell you

A voter ID check is a record lookup. Be explicit about its limits in your policy and your product copy.

It does not prove who is presenting the card. The response can carry a link to the roll photo, but that does not tie the number to the person in front of you: someone can type a real EPIC number that belongs to another person. If your risk model needs to tie the document to the applicant, pair it with a selfie and liveness step or another check that carries a biometric, which this endpoint does not provide.

It does not prove current residence. An address is whatever the electoral roll holds. People move, and updates to the roll lag behind.

It is not a citizenship determination. An EPIC establishes enrolment as an elector. How your regulator treats it as an identity or address document depends on your sector, so check the current rules that apply to you rather than assuming.

It carries no name-match score. The name field you may send is documented as the name to match against records, but the documented response shows no match result. Do not build logic that looks for a field that is not in the contract. Compare the returned name with your applicant's name yourself.

Handling the date of birth

Age gates are a common reason to verify an ID. The temptation is to read the returned age and compare. A more reliable pattern is to derive age from dob at the moment you need it, in Indian Standard Time.

JavaScript
export function ageOn(dobIso, today = new Date()) {
  const [y, m, d] = dobIso.split("-").map(Number);
  // Compare calendar dates, not timestamps, so the birthday itself counts.
  const t = new Date(today.getTime() + 5.5 * 3600_000); // shift to IST
  let age = t.getUTCFullYear() - y;
  const before = t.getUTCMonth() + 1 < m || (t.getUTCMonth() + 1 === m && t.getUTCDate() < d);
  if (before) age -= 1;
  return age;
}

export function meetsMinimumAge(voter, minimum = 18) {
  return ageOn(voter.dob) >= minimum;
}

Two cautions. First, a returned dob may be a placeholder or approximate in an older record, for example a date of 1 January of the birth year. If your decision hangs on a narrow margin, such as someone turning eighteen this month, send the case to review and ask for a second document. Second, if the applicant typed a date of birth into your form, compare it with the record's dob and treat a mismatch as a reason to look, not an automatic rejection, because transposed digits happen.

Matching the name

Names in the electoral record can differ from names on other documents for ordinary reasons: the roll was prepared in a regional language and transliterated, a surname comes first, a middle name is missing, honorifics were dropped. Plan for a gray zone.

A workable approach is to normalise both strings to upper case, remove punctuation and honorifics, split into tokens and compare token sets, allowing initials to match full names.

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

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

export function nameOverlap(a, b) {
  const A = nameTokens(a), B = nameTokens(b);
  if (A.length === 0 || B.length === 0) return 0;
  const hit = (x, y) => x === y || (x.length === 1 && y.startsWith(x)) || (y.length === 1 && x.startsWith(y));
  const matched = A.filter((x) => B.some((y) => hit(x, y))).length;
  return matched / Math.max(A.length, B.length);
}

Map the overlap into three bands: a high overlap passes, a middle band goes to a person, a low overlap fails. Choose the cut-offs from a sample of your own real applicants, not from sandbox, whose names are synthetic. Write the thresholds down with a date.

Using the address sensibly

The address arrives as one free-text string, with splitAddress giving the same address in parts. People sometimes expect to use it as proof of current address, which it is not. Use it for three modest things instead.

Corroboration. Compare the state, and where present the pincode, with what the applicant declared. A different state is worth a question, not a rejection.

Pre-fill with confirmation. Offering the address back to the user to confirm or correct saves typing, provided you show it and let them edit it. Do not silently store it as their current address.

Fraud signals. The same address string appearing across many unrelated applicants in a short window is a pattern to look at, though you must store the address to see it, so weigh that against the minimisation advice below.

JavaScript
export function extractPincode(address) {
  const m = String(address).match(/\b[1-9]\d{5}\b/);
  return m ? m[0] : null;
}

A pincode is six digits and does not begin with zero, which is enough for the pattern above. The record's address may not contain one, so the function returns null rather than guessing.

Input handling and the EPIC format

The documented sample is ABC1234567: three letters followed by seven digits, ten characters in all, and the validation message reads "voterId must match the format ABC1234567". Users type these from a card photo, so expect lower case, spaces and the confusion between the letter O and zero.

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

Do not write a stricter pattern of your own. Older cards and some state series do not follow the three-letter, seven-digit shape, and an over-strict client rule will reject real voters. Normalise lightly and let the API validate. A malformed value returns 400 BAD_REQUEST before verification and is not billed; the message names the field so you can show it to the user.

Billing and failure behaviour

  • Metered as voter.verify, recorded after a successful response. In production the wallet is debited when the verification completes.
  • The price is the standard verification rate, ₹5 per completed call on pay-as-you-go and lower on higher plans. See the pricing page. Rates exclude 18% GST.
  • A negative result, for example a number that does not resolve, is a completed verification. It is recorded, billed and returns a referenceId.
  • 400, 401 and 403 do not complete a verification and are not billed.
  • 402 PAYMENT_REQUIRED means insufficient wallet balance; top up rather than retry.
  • 429 TOO_MANY_REQUESTS is the rate limit. The documented example reads "Rate limit exceeded: 60 requests per 60 seconds for this endpoint." In sandbox it can also be a sandbox limit (10 a minute or 200 a day per organisation; code SANDBOX_RATE_LIMIT, SANDBOX_DAILY_LIMIT or SANDBOX_IP_LIMIT).
  • 502 INTERNAL_ERROR means the upstream service could not be reached. No completed check, no completed-call charge. Retry with backoff.
  • referenceId is not an idempotency key and the route documents no idempotency header, so a timed-out call may already have been billed.
StatusCodeMeaningYour action
400BAD_REQUESTvoterId does not match the formatShow the message, ask for correction
401UNAUTHORIZEDMissing or invalid keyFix deployment
402PAYMENT_REQUIREDWallet balance insufficientTop up, alert operations
403FORBIDDENKey lacks verification.voter.readIssue a key with the scope
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 uses one envelope, { "error": { "code", "message", "requestId" } }, so one parser handles them all and the requestId is what support asks for.

  • 400Validation errorBAD_REQUEST

    voterId must match the format ABC1234567

  • 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

Why a check fails, and what to say to the user

Failure messages to end users should be specific without being accusatory.

  • The number does not resolve. Most often a typo, a card photo misread, or a number from a different series. Ask the user to re-check the card and offer another document if they cannot.
  • The number resolves but the name differs. Often transliteration. Show the user the name you hold and let them confirm which is theirs rather than telling them the check failed.
  • The date of birth differs. Ask whether they entered it correctly. If the record's date is a placeholder, a second document settles it.
  • The service is unavailable. A 502 is not the user's problem. Tell them it is temporarily unavailable and let them continue or resume later.

Keep the technical code for your logs and the plain reason for the screen.

Where voter ID verification fits in a workflow

Field-force and agent onboarding. A company recruiting agents across towns often finds that people have a voter ID but may not have every other document. The flow collects the EPIC number, verifies it, compares the name, shows the address for confirmation, and moves on to a bank account check for payouts. The voter ID is the identity anchor.

Microfinance and group lending. Applicants frequently carry a voter ID as their primary document. A lender verifies it, computes age from dob against its eligibility range, and records the referenceId on the file. The address is used to corroborate the branch catchment, not as legal proof of residence.

Age-restricted services. Where a service must confirm an adult user, the date of birth from a verified document is a stronger input than a self-declared one. The check does not tell you the person on the other end is the document holder, so combine it with other controls where the stakes justify it.

Customer data refresh. A business updating stale customer records can verify a number the customer supplies and offer the returned address for confirmation. Never overwrite the customer's own address without their confirmation.

The document ladder: voter ID with PAN, driving licence and bank checks

No single document answers every question. Think of a ladder, and stop climbing when you have what the decision needs.

You need to establishReach forWhy
A person exists and has a government-issued identityVoter ID, Driving Licence or PassportDifferent people hold different documents
A tax identity and registered namePAN verificationNames and the PAN status that finance teams rely on
A real account to payBank account verificationConfirms the account and the holder name
A business entityGSTIN verificationLegal and trade names, status

Run the document the applicant volunteers first, then the one your finance or regulatory rules require. If the voter ID name and the PAN name agree, and the bank account name agrees with both, you have three independent records that are mutually consistent, which is considerably stronger than any one of them. Stop at the first hard failure. Because the checks have different rates, running the cheapest decisive one first saves money without losing signal.

Integration walkthrough

cURL

cURL
curl -X POST "https://api-b2b.stampmitra.in/v1/verify/voter-id" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"voterId":"ABC1234567","name":"Rahul Kumar"}'

Node.js

The Node.js SDK and Python SDK wrap this endpoint if you prefer a client library. The raw calls show exactly what they do.

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

export async function verifyVoterId({ voterId, name }, { timeoutMs = 20000 } = {}) {
  const res = await fetch(`${BASE}/v1/verify/voter-id`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ voterId: normaliseVoterId(voterId), ...(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_voter_id(voter_id: str, name: str | None = None, timeout: int = 20) -> dict:
    payload = {"voterId": re.sub(r"[\s\-.]", "", voter_id.upper())}
    if name:
        payload["name"] = name
    resp = requests.post(
        f"{BASE}/v1/verify/voter-id",
        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
export function assessVoter(result, applicant, { minOverlap = 0.85, minAge = 18 } = {}) {
  if (result.valid !== true) return { outcome: "reject", reason: "not_found", referenceId: result.referenceId };
  const overlap = nameOverlap(applicant.name, result.name);
  const reasons = [];
  if (overlap < minOverlap) reasons.push("name_unclear");
  if (applicant.dob && applicant.dob !== result.dob) reasons.push("dob_differs");
  if (!meetsMinimumAge(result, minAge)) reasons.push("under_minimum_age");
  return {
    outcome: reasons.length === 0 ? "approve" : "review",
    reasons,
    referenceId: result.referenceId,
  };
}

The function rejects only on a record that does not resolve. Everything else that is not a clean match goes to a reviewer, because the cost of a wrongly rejected genuine applicant is usually higher than the cost of a short manual look.

Edge cases and odd inputs

  • Placeholder dates of birth. Some records hold a date such as 1 January of the birth year. Send narrow-margin age decisions to review.
  • Regional-language names. The same person may be written differently across documents. Allow transliteration variance and keep a reviewer in the loop.
  • Card photos misread. 0 versus O, 1 versus I, 5 versus S. Show the number back to the user in a clear typeface and let them confirm before the call.
  • Duplicate cards. A person can hold a replacement card with a different number after a transfer or correction. A negative on an old number does not mean the person is not enrolled; ask for the current card.
  • Newly enrolled voters. A number issued recently may not appear yet. Retry later and offer an alternative document meanwhile.
  • Empty or short addresses. Treat the address as optional and tolerate an empty string.
  • E-EPIC downloads. A digital copy of the card carries the same number. Normalise it like any other.
  • Case and spacing in name. Normalise before comparing.
  • Applicants under eighteen. An EPIC exists only for enrolled electors, so a younger applicant is a signal to look more closely at the document and the age.

Audit logging and monitoring

What should a record of a voter ID check contain? Enough to reconstruct the decision, and no more. Your applicant ID, the referenceId, the outcome with reason codes, the name-overlap score and the thresholds that applied, the HTTP status, the requestId for errors and a timestamp. Not the EPIC number, the name, the date of birth, the gender, the address, or the raw response. When debugging needs a link between a log line and an EPIC, store a keyed hash.

StampMitra's own request logs are available at GET /v1/logs and in the dashboard, kept for as long as your plan allows, up to 365 days on Scale. Your decision records are yours to retain according to what your audits require.

Three trends deserve attention. A climbing review rate often follows a form or OCR change. A climbing rate of 400 responses points at the client, usually normalisation. And a cluster of 502 calls is a cue to degrade gracefully, for instance by letting the applicant continue with a different document while the service recovers. Keep 429 and 402 counts on the same board.

Modelling the cost

A voter ID check is a standard-rate call. The costs that matter are retries and fallbacks.

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

Suppose a lender onboards 5,000 applicants a month, 40 percent choose voter ID as their document, and 20 percent of those need a second attempt because of a misread number. That is 2,000 first attempts and 400 retries, 2,400 calls. Multiply by your plan's standard rate and add 18% GST on the top-up. A UI that shows the typed number back to the user for confirmation before submitting cuts the retry share. Dropping it from 20 percent to 5 percent saves 300 calls a month, which pays for the extra screen very quickly.

If you offer applicants a choice among documents, remember that a fallback is a second call at its own rate. Model the expected number of calls per applicant, not per document.

Sandbox and production

The sandbox key, sk_test_, arrives with sign-up and never touches your wallet. It serves sample data: Voter ID has no published magic inputs, so a given EPIC always gets the same reply, roughly two in three of them valid, with made-up names throughout. That is plenty for authentication, scope handling, normalisation, error paths and the approve, review and reject screens, and a few saved responses keep unit tests off the network. It will not help you choose name thresholds or estimate genuine failure rates, and sandbox limits are not production limits.

For production you need an sk_live_ key, created after your organisation's KYC and a Voter ID production application are approved. The server picks the environment from the key. Apply from the dashboard with a specific description of your use, fund the wallet, swap the secret, and watch the first live traffic closely.

Restrict the key

Because the response includes date of birth and address, grant the key only verification.voter.read (see the authentication docs), give each service its own, hold it in a secrets manager, bind it to your servers' addresses wherever your plan includes an IP allowlist, and call only from the backend. A 403 on a valid key means the scope is missing.

A worked scenario: onboarding collection agents in small towns

Consider a fictional lender, Paramount Microcredit, that hires collection agents in towns where many candidates hold a voter ID but not necessarily a passport or a driving licence. The agent signs up in a mobile app. Here is what the backend does, and why each step is there.

  1. The app asks for the EPIC number and shows it back. After the agent types it, the screen repeats the number in large type and asks "Is this exactly what is printed on your card?". The confirmation step exists because a misread character costs a billed call and an annoyed candidate.
  2. The backend normalises and calls once. It uppercases, strips spaces and posts to /v1/verify/voter-id with the typed name. If the call returns 429, the app tells the agent to wait a few seconds; if 502, it saves the draft and offers to resume.
  3. The record resolves. The backend compares the returned name with the name from the application using token overlap, and compares the returned dob with the typed date of birth.
  4. A clean match moves on. If the overlap is high and the date of birth agrees, the agent proceeds to the bank account step with the verified name as the expected account holder name.
  5. A middle result opens a task. If the overlap falls in the gray zone, a reviewer sees both names and the date of birth, with the address text hidden unless the reviewer opens it. Most of these turn out to be initials or a transliteration difference, and the reviewer approves with a reason code.
  6. A dob difference gets a second document. If the record's date of birth differs and the record's date is a first of January, the app asks for a second document rather than rejecting.
  7. The agent confirms the address. The app shows the address from the record and asks the agent to confirm it or type their current one. Only the confirmed value is stored as the agent's address.
  8. Records kept. Paramount stores the referenceId, the outcome, the reason codes, the reviewer ID and timestamps. It does not store the voterId, the record's address or the date of birth from the response, because the loan product does not need them after onboarding.

What makes this workable is that no step relies on something the endpoint does not provide: the photo comes only as a link, so the lender relies on its own selfie step for liveness, and there is no match score, so the lender computes overlap itself. The check supplies a reliable record; the lender's process supplies the judgement.

Production checklist

  1. The key has only verification.voter.read, sits in a secrets manager and is IP-restricted where possible.
  2. The voterId is normalised, not strictly validated, on your side.
  3. Age is computed from dob in IST at decision time.
  4. Names are compared with token matching and thresholds taken from real data.
  5. The address is shown for confirmation, never silently stored as current.
  6. Retries happen only on 429 and 502, with backoff.
  7. Logs hold reference IDs and outcomes, not personal fields.
  8. Wallet balance and 402 alerts exist.
  9. A review queue exists with a written policy.
  10. The notice states why the ID is verified and what is kept.
  11. You have tested a misread number, a transliterated name, a placeholder date of birth, a 429 and a 502.

Common mistakes

  • Assuming the response contains a name-match score. It does not. Compare names yourself.
  • Treating a valid number as proof of the person. There is no photo in the response.
  • Using age from the response as a stored fact. Derive it from dob when you need it.
  • Storing the address as the customer's current address. Confirm it with them.
  • Writing a strict EPIC regex. Older series differ, and genuine voters get rejected.
  • Logging the response. It puts dates of birth and addresses in log storage.
  • Rejecting on a name difference. Transliteration is the usual cause.
  • Calling from the client. It exposes the key and sidesteps your allowlist.

Sources

  • Voter ID API reference, StampMitra product data: request fields, response example, scope and validation message, checked October 2026.
  • Pricing, StampMitra: per-call rates, plan limits and log retention, checked October 2026. Rates exclude 18% GST.
  • Election Commission of India, for how the Elector's Photo Identity Card and the electoral roll 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 voterId 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 Voter ID
SBX0000001
200
200 with valid true and the elector record (name, dob, gender, address, state).
Voter ID not found
SBX0000002
200
200 with valid false and no elector details.
Verification source times out
SBX0000005
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
SBX0000006
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
SBX0000007
429TOO_MANY_REQUESTS
Too many requests. Back off and retry with exponential delay and jitter.
Wallet balance too low
SBX0000008
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
SBX000000
400BAD_REQUEST
Validation error that names the field. Nothing is looked up and nothing is charged.

Frequently asked questions

What does the voter ID verification API return?

It returns the full voter record: valid and status, the EPIC number, name (also in the regional language), the relative named on the roll, dob, gender, age, address and splitAddress, a photoUrl link, state, constituencies, roll part, serial number and polling station, plus a referenceId and a verificationId. Only referenceId, verificationId and valid are always present. There is no name-match score, so you compare the returned name with your applicant's name yourself.

What is an EPIC number and what format does the API expect?

EPIC is the number on the Elector's Photo Identity Card. The documented sample is ABC1234567, three letters and seven digits. Normalise to upper case without spaces and let the API validate, because older series differ and a strict client pattern would reject genuine voters.

Does a valid result prove the applicant is the person on the card?

No. The record lookup shows that the number exists and what the roll holds for it. Someone can type another person's real number. If you need to tie the document to the applicant, add a selfie and liveness step or another check that carries a biometric.

Can I use the returned address as proof of current residence?

Treat it as corroboration only. The address is whatever the electoral roll held at its last update, and people move. Show it to the user to confirm or correct, and store only the value they confirm as their current address.

How should I use the date of birth for an age check?

Compute age from dob in Indian Standard Time at decision time rather than trusting the returned age as a stored fact. Some older records hold placeholder dates such as a first of January, so send narrow-margin cases to review and ask for a second document.

Is there a name match score in the response?

No. You may send a name, documented as the name to match against records, but the documented response shows no match result. Compare names yourself using token matching that tolerates initials and transliteration, and set thresholds from real applicant data.

When am I billed for a voter ID check?

Usage is recorded and the production wallet debited only after the verification completes. A negative result is still a completed, billed check. A malformed voterId, bad key or missing scope returns 400, 401 or 403 and is not billed, and sandbox calls never debit your wallet.

Which errors should my integration handle?

Handle 400 for a malformed voterId, 401, 402 for low wallet balance, 403 for a missing scope, 429 for the rate limit and 502 when the upstream service is unreachable. Retry only 429 and 502 with backoff, and log the requestId from the shared error envelope.

Can I test voter ID 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. It proves plumbing and error handling, not your name-matching thresholds or real failure rates.

What personal data should I store after the check?

Store the outcome, reason codes, referenceId and timestamp. Avoid storing dob, gender, address or the voterId unless a rule or genuine need requires it, keep them out of logs, set a retention period and explain in your notice what you keep and why.

How does voter ID fit with PAN, driving licence and bank checks?

Think of a ladder. Verify the document the applicant volunteers, then the PAN for tax identity, then a bank account for payouts. If the voter ID, PAN and bank account names agree you have three consistent records. Stop at the first hard failure and run cheaper decisive checks first.

Why does my valid key return 403 on this endpoint?

The key is valid but lacks the verification.voter.read scope. Issue a key with that scope, keep it narrow and call from your backend only. Where your plan includes an IP allowlist, restrict the key to your servers, because this endpoint returns date of birth and address.

Build with AI

Integrate Voter ID 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 · Voter ID · 7,714 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 "Voter ID" API
Verify a Voter ID in real time.
Production service code: voter.verify

ENDPOINT: POST /v1/verify/voter-id
- Verify Voter ID
- Required scope: verification.voter.read
- Parameters:
  - voterId (string, required): EPIC / Voter ID number, format ABC1234567.
  - name (string, optional): Name to match against records.
- Example request body: {"voterId":"UAI4574761","name":"HARSHIT PRAJAPATI"}
- Response fields: referenceId, verificationId, valid, status, epicNumber, name, nameInRegionalLang, age, relationType, relationName, relationNameInRegionalLang, fatherName, dob, gender, address, photoUrl, splitAddress, state, assemblyConstituencyNumber, assemblyConstituency, parliamentaryConstituencyNumber, parliamentaryConstituency, partNumber, partName, serialNumber, pollingStation
- Example response: {"referenceId":"SMV-20260927-7H83M1","verificationId":"VRF-4C8P2WJ6ZK9T","valid":true,"status":"VALID","epicNumber":"UAI4574761","name":"HARSHIT PRAJAPATI","nameInRegionalLang":"हर्षित","age":"23","relationType":"FTHR","relationName":"RAJ PRAJAPATI","relationNameInRegionalLang":"राज","fatherName":"RAJ PRAJAPATI","dob":"2000-12-07","gender":"Male","address":"GOVT JUNIOR COLLEGE SIRWAR","photoUrl":"https://example.com/voter-photos/UAI4574761.jpeg","splitAddress":{"district":["INDORE"],"state":["Madhya Pradesh"],"city":["SANER"],"pincode":"560034","country":["IN","IND","INDIA"],"addressLine":"GOVT JUNIOR COLLEGE SIRWAR"},"state":"Madhya Pradesh","assemblyConstituencyNumber":"211","assemblyConstituency":"SANER","parliamentaryConstituencyNumber":"25","parliamentaryConstituency":"INDORE","partNumber":"27","partName":"SIRWAR","serialNumber":"713","pollingStation":"GOVT JUNIOR COLLEGE SIRWAR"}
- 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 electoral roll does not provide it. Dates are ISO yyyy-mm-dd strings and age is a string. photoUrl is a link only, never image data, and can expire. The voter's personal details are masked in your call records; the response itself carries them in full.

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