StampMitraDevelopers
Livee-Stamp Paper APIStep 2 of 8

e-Stamp schema API: build the quote form from the platform's own field list

Field schema and dropdown options for a given e-Stamp instrument (state, article, value ranges, etc.).

GET/v1/estamp/schema/:serviceCodeScope estamp.readAPI fee ₹5 per call
curl -X GET "https://api-b2b.stampmitra.in/v1/estamp/schema/:serviceCode" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY"

A form that asks for the wrong things is the cheapest way to lose a user and the most expensive way to lose an order. The e-Stamp schema route exists so that you do not guess. GET /v1/estamp/schema/:serviceCode returns the field definitions the quote step needs, as data, so that your form can be built from the platform's answer instead of from a spreadsheet someone made last quarter. It is step two of the eight-step e-Stamp flow, and it is the shortest response in the whole API. That brevity is deceptive: the interesting questions are about what the schema does not contain.

This page explains what the route returns, how to read each field, why "options" in the product name does not mean what many developers expect, how to build a schema-driven form without painting yourself into a corner, how the schema relates to the state flags and the order contract, and how to test it. It assumes you have already read the catalogue page and know which service code you are using.

What the schema route is, in one paragraph

The route returns generic form-rendering metadata for the e-Stamp product. The path takes a serviceCode, but e-Stamp has exactly one schema, so the value is accepted for consistency with other schema lookups and does not change the answer. The response is a list of field definitions. Each field has a name, a label, a type, a required flag and, where relevant, a pattern and a placeholder. The route needs the estamp.read scope, is not metered by StampMitra, and is rate limited to 60 requests per 60 seconds.

cURL
export STAMPMITRA_API_KEY="sk_test_xxxxxxxxxxxx"
export BASE="https://api-b2b.stampmitra.in"

curl -s "$BASE/v1/estamp/schema/estamp.instrument.rent_agreement" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY"

The response today

The schema currently describes the inputs of the duty calculation, which are five fields.

JSON
{
  "fields": [
    { "name": "stateCode", "label": "State", "type": "text", "required": true, "placeholder": "MasterDataState.code, e.g. MH" },
    { "name": "articleCode", "label": "Article", "type": "text", "required": true, "placeholder": "MasterDataArticle.code, scoped to stateCode" },
    { "name": "districtCode", "label": "District", "type": "text", "required": false, "placeholder": "Required when the state requires SRO selection" },
    { "name": "sroValue", "label": "SRO", "type": "text", "required": false, "placeholder": "MasterDataSro.value, required when the state requires SRO selection" },
    { "name": "stampDutyAmount", "label": "Stamp duty amount", "type": "text", "required": true, "placeholder": "Government e-Stamp duty amount per the applicable State Stamp Act" }
  ]
}
FieldRequiredWhat it isWhere its values come from
stateCodeYesThe state the stamp is issued inGET /v1/estamp/states
articleCodeYesThe article, which is the kind of instrumentGET /v1/estamp/states/:stateCode/instruments
districtCodeConditionalThe district, when the state requires SRO selectionGET /v1/estamp/states/:stateCode/districts
sroValueConditionalThe sub-registrar office, when requiredGET /v1/estamp/states/:stateCode/districts/:districtCode/sros
stampDutyAmountYesThe duty amount you intend to buy, in rupeesYou decide it; the API validates it

Notice that every one of these maps one to one onto the request body of the duty calculation. That is the point. The schema is the quote form. It does not describe the whole order, the party details or the property details, which come from the order contract in the order creation step and from the state flags described below.

Four things the schema does not tell you

Most integration surprises here come from assuming the schema is broader than it is.

It does not contain dropdown options. The product is named "schema and options", and developers often expect the response to carry the list of states or articles. It does not. The schema says that a stateCode field exists and is required. The values for it come from the lookup routes in the next step. Think of the schema as the shape of the form and the lookups as the content of its dropdowns.

Its placeholder is documentation, not example input. Look at the values: "MasterDataState.code, e.g. MH" and "Government e-Stamp duty amount per the applicable State Stamp Act". These are notes for the developer, describing where a value comes from. If you put them straight into an HTML placeholder attribute, your user will see database table names. Map them to your own copy, and keep the platform text only for tooltips in an admin view.

Its type is a rendering hint, not a validation contract. Every field here has type: "text", including stampDutyAmount. The duty calculation, however, expects a positive number, and sending the string "1000" where a number is expected can fail validation with a 400. Use the schema to decide which control to render, and use the request documentation to decide what to send. Parse the amount to a number before the call.

It does not carry state-specific rules. Whether a state wants a district and SRO, a property area, a cess amount or a father's or husband's name is state-specific. That information lives on the state detail route as boolean flags and on the requirements route as a per-state field list, both described below. The generic schema deliberately does not change from state to state.

Where the dropdown options really come from

Putting the schema together with the lookups gives you the complete picture of the quote form.

Form controlDefined byFilled byNotes
State selectSchema field stateCodeGET /v1/estamp/statesShow only states that report e-stamp availability
Article selectSchema field articleCodeGET /v1/estamp/states/:stateCode/instrumentsReload when the state changes
District selectSchema field districtCodeGET /v1/estamp/states/:stateCode/districtsShow only when the state's sroRequired flag is true
SRO selectSchema field sroValueGET /v1/estamp/states/:stateCode/districts/:districtCode/srosReload when the district changes
Duty amountSchema field stampDutyAmountThe user, or your compliance logicConstrain with the article's allowedAmounts or minimumAmount where present

The dependency chain is state, then article, then district, then SRO. A change upstream clears everything downstream. A form that preserves a stale article after the state changes will produce a quote request that fails with a message about the article, and the user will not understand why.

Which fields to show: the conditional logic

The schema marks districtCode and sroValue as not required because they are not required everywhere. Whether they are required for a given state is not in the schema. It is in the state detail:

cURL
curl -s "$BASE/v1/estamp/states/MH" -H "Authorization: Bearer $STAMPMITRA_API_KEY"

The response includes boolean flags sroRequired, cessRequired, propertyAreaRequired, fatherHusbandNameRequired, firstPartyAddressRequired and panCardImageRequired, along with eStampAvailable, traditionalAvailable, minAmount and maxAmount. Use them to drive which controls appear. If sroRequired is true, show the district and SRO selects and make them mandatory. If it is false, hide them and do not send them.

That gives a clean separation of responsibilities between the three sources.

SourceDescribesChanges when
Schema routeThe generic fields of the quoteThe e-Stamp product itself gains or loses a field
State detail flagsWhich extra inputs this state wantsThe state's master data changes
Requirements routeA per-state list of data and document requirementsThe state's requirements are re-synced

A schema-driven form is really a three-layer form: render the generic fields from the schema, add or hide conditional fields from the state flags, and consult the requirements route for state-specific detail beyond that. The requirements route returns 404 until a state's requirements have been synced, which is a normal condition. Treat it as "no extra requirements known" and rely on the flags and on server-side validation.

Building the form from the schema

A small renderer is enough. The principle is to treat the schema as data and to keep your own presentation layer in front of it.

JavaScript
// Node 18+ / browser-safe logic; call StampMitra from your server, not the browser
const BASE = "https://api-b2b.stampmitra.in";
const headers = { Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}` };

// Your own labels and hints, keyed by field name. The schema's placeholder is developer text.
const COPY = {
  stateCode: { label: "State", hint: "Where the document will be signed" },
  articleCode: { label: "Type of document", hint: "Choose the closest match" },
  districtCode: { label: "District", hint: "" },
  sroValue: { label: "Sub-registrar office", hint: "" },
  stampDutyAmount: { label: "Stamp duty (Rs)", hint: "As decided for this document" },
};

export async function loadQuoteFormSpec(serviceCode, stateFlags) {
  const res = await fetch(`${BASE}/v1/estamp/schema/${encodeURIComponent(serviceCode)}`, { headers });
  const body = await res.json();
  if (!res.ok) throw Object.assign(new Error(body.error?.message), { status: res.status, requestId: body.error?.requestId });

  return body.fields
    .filter((f) => (f.name === "districtCode" || f.name === "sroValue") ? stateFlags?.sroRequired : true)
    .map((f) => ({
      name: f.name,
      required: f.name === "districtCode" || f.name === "sroValue" ? Boolean(stateFlags?.sroRequired) : f.required,
      pattern: f.pattern ?? null,
      kind: f.name === "stampDutyAmount" ? "number" : "select",
      label: COPY[f.name]?.label ?? f.label,   // unknown new fields still render, with the platform label
      hint: COPY[f.name]?.hint ?? "",
    }));
}
Python
import os, requests

BASE = "https://api-b2b.stampmitra.in"
H = {"Authorization": f"Bearer {os.environ['STAMPMITRA_API_KEY']}"}

KNOWN = {"stateCode", "articleCode", "districtCode", "sroValue", "stampDutyAmount"}

def load_schema(service_code: str) -> dict:
    r = requests.get(f"{BASE}/v1/estamp/schema/{service_code}", headers=H, timeout=15)
    body = r.json()
    if not r.ok:
        err = body["error"]
        raise RuntimeError(f"{r.status_code} {err['code']} req={err['requestId']}")
    unknown = [f["name"] for f in body["fields"] if f["name"] not in KNOWN]
    if unknown:
        # a new field appeared: log it and render it generically instead of failing
        print("new e-Stamp schema fields:", unknown)
    return body

Two design choices in that code are worth copying. Unknown fields are logged and rendered generically instead of crashing the form, so a schema that grows does not break your checkout. And your copy lives in your code, keyed by field name, so that the platform's developer notes never reach a customer.

Treat unknown fields as a feature

The schema is small today and designed to describe form inputs generically. If it gains a field, the best outcome is that your form shows it and the user can fill it in. A good fallback is to render an unknown field as a plain text input with the platform's label, mark it required according to required, validate it against pattern if one is supplied, and include its value in the request body under name. Whether the downstream route accepts an extra field is a question for a test, not an assumption, so alert your team when you see a new field and let a person decide how to present it.

The mirror image matters too. A field that disappears from the schema should not break your form. If your code has a hard dependency on a field being present, you will find out in production on the day the platform changes. Prefer lookups by name with sensible defaults.

Pattern, required and the limits of client-side validation

When a field carries a pattern, it is a regular expression you can apply in the browser before the user submits. Client-side validation is a courtesy: it saves a round trip. It is never the authority. The server validates everything again, and it knows things the schema does not, such as which denominations a state allows for an article.

A good division is this. In the browser, check that required fields are filled, that the amount is a positive number, and that any pattern matches. On your server, before calling the duty calculation, check that the state and article come from the lookups you served and not from a tampered request. Then let the API have the last word. When it answers 400 with a message such as "stampDutyAmount must be one of 100, 200, 500, 1000", show that to the user in plain language and let them pick again.

Caching and refresh

The schema changes rarely, so cache it. A day is a reasonable lifetime for most products, with a manual refresh button in your admin tools. Keep the cache keyed by serviceCode even though the answer is currently identical for all codes, because the route's contract allows for that to change.

Refresh on two triggers. First, on deploy, so that a new release is always tested against current data. Second, when a duty calculation returns a 400 that your form could not have predicted, which is a hint that the schema or the state data has moved under you. Pair the schema cache with a version of the state data: the duty calculation accepts a masterDataVersion and reports masterDataVersionStale, which tells you when your cached catalogue is out of date.

Contract tests and fixtures

The simplest safety net is a fixture. Save one real response from the sandbox as fixtures/estamp-schema.json in your repository, and write a test that feeds it to your form builder and asserts the expected controls. When the platform changes the schema, your integration test against the live sandbox, run nightly rather than on every commit, compares the live response with the fixture and fails with a readable diff.

TestWhat it proves
Fixture renders five controls with the right namesThe renderer handles the current schema
Fixture plus sroRequired: false hides district and SROThe conditional logic works
Fixture plus an extra field renders a generic inputForward compatibility holds
Fixture minus stampDutyAmount fails loudlyYou notice a breaking change
Live sandbox response equals the fixture (nightly)You hear about schema changes first

Localising the form

Many Indian products need forms in Hindi and other languages. The schema's label is English, and that is fine, because it is a fallback. Keep a translation table keyed by field name and fall back to the platform's label for anything you have not translated. Do not translate by field position, and do not rely on the label text as a key. Hindi labels for the duty amount and SRO deserve review by someone who stamps documents for a living, since an ordinary translation may confuse a landlord.

Keep the control types accessible: use real <select> elements for the lookups, associate labels with inputs, give errors a place that screen readers announce, and make sure the amount field has an input mode suitable for numbers. These are the same details that make a quote form usable on a phone, which is where many users will meet it.

Errors and how to react

All errors use { "error": { "code", "message", "requestId" } }.

StatusCodeWhenWhat to do
400BAD_REQUESTThe organisation is not entitled to e-StampCheck the catalogue and your production access status
401UNAUTHORIZEDMissing or invalid keyFix the key
403FORBIDDENValid key without estamp.readAdd the scope
429TOO_MANY_REQUESTSMore than 60 requests in 60 secondsBack off, and rely on the cache
502INTERNAL_ERRORUpstream unreachableRetry with backoff, serve the cached schema meanwhile

Because the schema is cached, most users will never see these. The route is a read, so retries are safe, and none of them are charged.

Sandbox and production

The schema is generic product metadata, so sandbox and production return the same answer. That makes it a good first call in a sandbox session: it needs no state data, spends no money (it still counts toward the sandbox limits, like every e-Stamp sandbox request) and proves that your key, scope and entitlement are right. Production needs an approved production access request. The sandbox versus production guide covers the switch, and the authentication reference explains scopes.

Worked example: a quote form for a broker app

A broker app builds a "get your stamp price" screen for rental agreements.

On server start the app fetches the schema and caches it for 24 hours. It finds five fields and builds a form specification: a state select, an article select, an optional district and SRO pair, and a numeric amount.

The user opens the screen and the app loads the state list from GET /v1/estamp/states. The user chooses a state. The app calls GET /v1/estamp/states/:stateCode, reads sroRequired: true and propertyAreaRequired: true, reveals the district and SRO selects, and loads the districts. The app reloads the article list for the state and clears any previous selection.

The user picks an article. The app reads that article's allowedAmounts. Where the list is present, it turns the amount field into a dropdown of those values. Where it is absent, it shows a numeric field with the article's minimumAmount as a lower bound and the state's minAmount and maxAmount as the range. The user enters the duty decided by the broker's compliance rule.

On submit, the browser sends the choices to the broker's server. The server checks that the state and article came from its own lookups, converts the amount to a number, and calls the duty calculation. A 400 with a denomination message is shown as "That amount cannot be issued for this document. Choose one of 100, 200, 500 or 1000", built from the message. A 200 produces a price breakdown.

Midway through the following month the platform adds an optional field to the schema. The broker's nightly contract test fails with a diff, an engineer reads it, and by lunchtime the form renders the new field generically while the team decides how to present it. No user noticed.

From quote fields to order fields

The quote form is only the first form. When the user confirms, you build the stamp line for the order, and the field names change in small ways that are easy to get wrong. Keep this mapping in one place in your code.

Quote field (schema)Order stamp-line fieldNotes
stateCodestateSame value. One order covers exactly one state
articleCodearticleCodeSame value
stampDutyAmountdenominationThe same rupee amount, renamed
districtCodedistrictOnly when the state needs it
sroValuesroOnly when the state needs it

The order line carries more than the quote did. Here is the full list of what a stamp line accepts, so that you can plan the second screen of your form while you are still designing the first.

Stamp-line fieldRequiredMeaning
clientReferenceNoYour own reference for this line, echoed back on the created order
stateYesState the stamp is issued in
categoryNoe_stamp or traditional_stamp, default e_stamp
articleCodeYesArticle from the lookup
denominationYesDuty amount in rupees
firstPartyYesName of the first party to the instrument
secondPartyNoSecond party, where the article uses one
purposeNoNature of the instrument, for example a rental agreement
stampDutyPayer, payerPhone, payerGenderNoWho pays the duty, a phone number, and MALE, FEMALE or OTHER
district, sroNoWhen the state requires them
propertyAreaNoWhen the article needs an area
cessAmountNoWhen a cess applies to the article
quantityNoNumber of identical stamps for the line, default 1
costCentre, businessUnit, linkedDocRefNoYour own tags and a linked document reference

Notice that none of the second table is in the schema. The schema covers the quote, and the order contract covers the line. If you generate a single form for both, make sure your renderer can combine a schema-driven first section with a hand-built second section, and keep the two clearly separated in code so that a schema change cannot silently remove an order field. The order creation page covers the line in depth.

The requirements route in practice

The state flags tell you which extra inputs a state wants. The requirements route tells you more. GET /v1/estamp/states/:stateCode/requirements returns the state code and a fields list that is synced from the issuing side and describes the documentary and data requirements for that state. These can include required, optional and conditional fields, whether a second party is needed, rules that depend on the amount, such as a payer gender requirement above a threshold, PAN upload requirements, and property details.

Three practical points. First, the list is dynamic by design, which is what lets you avoid per-state branching in your code: drive controls from the data, not from the state name. Second, the route returns 404 with a message that no requirements have been synced when a state has none on file. That is not a failure. Treat it as "no additional requirements known" and rely on the flags and on server-side validation. Third, the shape of each requirement is owned by the issuing side, so save a real response for each state you support as a fixture, and write your renderer defensively: unknown requirement types fall back to a generic text input and a log line.

cURL
curl -s "$BASE/v1/estamp/states/MH/requirements" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY"

If the requirements route and the state flags ever seem to disagree, trust neither blindly. The authoritative answer is what the API accepts. Run the case through the order validation route, which reports field-level problems and warnings without saving anything, and record the outcome so that a person can settle which source to follow.

Numbers, money and precision in the form

The quote form has one numeric input, and most of the bugs in schema-driven forms are numeric.

  • Rupees, not paise. stampDutyAmount and the order's denomination are in rupees. Payment amounts elsewhere in the API, such as payment intents, use minor units. Keep the unit in the variable name.
  • Decimal strings in responses. The state detail returns amounts such as minAmount and maxAmount as decimal strings like "100.00". Parse them to numbers for comparison, and never concatenate them.
  • No floating-point arithmetic on money. If you must add amounts, use integer paise or a decimal library. The duty calculation already returns totals, so you rarely need to.
  • Positive numbers only. The amount must be positive. Reject zero and negative values in the form so that the API never has to.
  • Respect the allowed set. When the article carries allowedAmounts, replace the free numeric field with a select of those values. Typing an amount that is not on the list leads to a 400 with a message that lists the options.

A small helper that converts the user's input to a number, trims separators such as commas, and refuses anything else, prevents the most common class of avoidable 400 responses.

Server-driven forms: where to put the logic

You have three reasonable architectures, and the right one depends on your stack.

ApproachHow it worksGood whenWatch out for
Backend for frontendYour server calls StampMitra, builds a form spec and sends it to your UI as JSONYou have a single-page app or a mobile appKeep the spec versioned so old app builds keep working
Server-rendered pagesYour server renders the form HTML from the schema on each requestYou use a server framework with templatesCache the schema so each render does not call the API
Build-time snapshotYou fetch the schema at build time and compile it into the front endThe product is small and changes rarelyA schema change needs a rebuild, so add the nightly contract test

In all three cases the API key stays on the server. The browser never talks to StampMitra directly, because the key would be exposed and because you want one place that enforces your own rules about which states and articles you offer. A backend for frontend has one more advantage: it can merge the schema, the state flags and your own configuration into a single form specification, so that the UI is a plain renderer with no knowledge of the platform.

Change management for a schema you do not own

The platform owns the schema, and you own the form. Treat schema changes the way you treat a dependency upgrade.

  1. Detect. The nightly contract test compares the live sandbox response with your fixture and posts a diff.
  2. Classify. A new optional field is low risk. A removed field, a field that becomes required, or a change in a pattern is higher risk.
  3. Test. Run your form against the new response in a staging environment, including a full quote call.
  4. Ship. Update the fixture in the same change as any code that depends on the new shape.
  5. Communicate. If support scripts or documentation mention the form, update them in the same release.

A schema change that you learn about from a customer is a process failure. The cost of the nightly test is a few lines of CI, and the benefit is finding out first.

Privacy and audit of what the form collects

The quote form collects little personal data, but the order forms that follow collect names, phone numbers and addresses. Apply the same discipline from the start. Collect only what the state's flags and requirements say you need, explain why, and avoid copying form contents into analytics events or error logs. When you log a failed quote, record the state, the article and the requestId, not the user's identity. Keep an audit entry of who chose the article and the duty amount, because that decision is the one a reviewer, a customer or an authority may ask about later. The service terms make the developer responsible for the accuracy of what is submitted, and a record of how the form was filled in is the evidence of care.

A short support playbook

When someone reports "the form is asking for something odd", this sequence usually finds the cause in minutes.

  1. Which state did they choose? Fetch its detail and compare the flags with what the form showed.
  2. Was the schema served from cache? Check its age and refetch.
  3. Does the live schema match your fixture? If not, you have found a schema change.
  4. Does the requirements route return anything for the state? A new requirement can explain a new field.
  5. Take the same inputs to the validation route and read the message.

If none of that explains it, send developer support the state code, the article code, the time and a requestId, and say which of the five checks you ran.

The cascade as a small state machine

The dependency chain from state to article to district to SRO is the part of the form where bugs hide, because users change their minds. A small, explicit state machine is easier to test than a tangle of change handlers. The rules are few: choosing a state clears the article, district and SRO and reloads the lists; choosing a district clears the SRO; the amount field is revalidated whenever the article changes, because the allowed amounts belong to the article.

JavaScript
// Framework-free reducer for the quote form's dependent selects
export const initial = { state: null, article: null, district: null, sro: null, amount: null, flags: null };

export function reduce(form, action) {
  switch (action.type) {
    case "state": return { ...initial, state: action.code, flags: action.flags };      // clears everything below
    case "article": return { ...form, article: action.code, amount: null };            // amount depends on the article
    case "district": return { ...form, district: action.code, sro: null };             // SRO depends on the district
    case "sro": return { ...form, sro: action.code };
    case "amount": return { ...form, amount: action.value };
    default: return form;
  }
}

export function isComplete(form) {
  const needSro = Boolean(form.flags?.sroRequired);
  return Boolean(form.state && form.article && Number(form.amount) > 0 && (!needSro || (form.district && form.sro)));
}

Three tests cover most of the risk. Changing the state must reset the article, district, SRO and amount. Changing the article must reset the amount but keep the state. A state with sroRequired: false must be complete without a district or SRO, and a state with sroRequired: true must not.

Two practical details improve the experience. Load each dependent list lazily and show a loading state in the control while it loads, so the user is never looking at a stale list. And remember the user's last complete selection per session, so that a quote for a second document in the same state starts one step further along. Both are small, and both reduce the number of times users reach the amount field with something quietly wrong upstream.

Common mistakes

  • Expecting options inside the schema. They come from the lookup routes.
  • Showing placeholder text to customers. It is developer documentation.
  • Sending the amount as a string. The calculation wants a number.
  • Hardcoding the five fields. The schema can grow, so render from it.
  • Ignoring the state flags. Whether district and SRO are required is not in the schema.
  • Keeping stale downstream selections. Clear the article, district and SRO when the state changes.
  • Treating client validation as authority. The server decides.
  • Caching with no refresh path. Add a manual refresh and a deploy-time refresh.
  • Calling from the browser. Keep the key on your server.

Where this fits in the flow

The schema is step two of eight. Before it comes the catalogue. After it come the state, instrument and article lookup that fills the dropdowns, the duty and value calculation, the parties, the order, the payment and the order status and document access. The overview guide shows all eight with a rental example, and the e-Stamp API reference lists the route in tabular form.

StampMitra is a private LegalTech platform operated by Bani Global Industries LLP. It is not a government body or a law firm, and nothing here is legal advice. Choosing the article and deciding the duty remain your responsibility, as the service terms explain.

Sources

Frequently asked questions

What does the e-Stamp schema API return?

A list of field definitions for the quote form. Each field has a name, label, type, required flag and, where relevant, a pattern and placeholder. Today there are five fields: stateCode, articleCode, districtCode, sroValue and stampDutyAmount.

Does the schema include the list of states and articles?

No. The schema describes the shape of the form only. The values for the state, article, district and SRO selects come from the lookup routes under estamp.read, which you call as the user makes each choice.

Why does the serviceCode in the path not change the response?

e-Stamp has exactly one schema, so the serviceCode is accepted for consistency with other schema lookups and ignored for the answer. Cache the response per service code anyway, since the route's contract allows for that to change later.

Should I show the placeholder text to my users?

No. The placeholders are developer notes such as MasterDataState.code, e.g. MH. Keep your own customer-facing labels and hints keyed by field name, and use the platform text only in admin tooltips.

Why is stampDutyAmount typed as text in the schema?

The type is a rendering hint. The duty calculation expects a positive number, so parse the amount to a number before sending. Use the schema to choose the control and the request documentation to choose what to send.

How do I know whether district and SRO are required?

Read the state detail at GET /v1/estamp/states/:stateCode. If sroRequired is true, show both selects and send districtCode and sroValue to the duty calculation and the order. If it is false, hide them.

How often should I refresh the cached schema?

A day is reasonable for most products. Refresh on deploy, offer a manual refresh in admin tools, and refetch when a duty calculation returns a 400 your form could not have predicted, which hints that the data moved.

What should my form do if the schema gains a new field?

Render it generically as a text input using the platform label, honour required and any pattern, log the new name and alert your team. Whether downstream routes accept the extra value should be confirmed by a test, not assumed.

Is the schema route charged?

No. It is a read under estamp.read and is not among the metered e-Stamp calls. Duty calculation and parties are the charged calls. Sandbox calls never debit a wallet in any case.

What happens if my organisation is not entitled to e-Stamp?

Every /v1/estamp route, including the schema, answers 400 with a message that the organisation is not entitled. Check the service catalogue and your production access status, or contact developer support.

Is the schema the same in sandbox and production?

Yes, it is generic product metadata. That makes it a good first sandbox call: it needs no state data, costs nothing and proves that your key, scope and entitlement are correct.

Build with AI

Integrate e-Stamp Schema / Options 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 · e-Stamp Schema / Options · 5,003 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 "e-Stamp Schema / Options" API
Field schema and dropdown options for a given e-Stamp instrument (state, article, value ranges, etc.).

ENDPOINT: GET /v1/estamp/schema/:serviceCode
- Get the e-Stamp input field schema
- Required scope: estamp.read

Rules for this e-Stamp step
- This is one step of the e-Stamp order flow: services -> state/instrument/article -> schema -> duty -> order -> parties -> payment -> status -> documents.
- Build the form from the schema endpoint and do not invent e-Stamp fields.
- Send an Idempotency-Key header on order creation, store the order id, and make the flow resumable.
- Poll order status with backoff until a final status. Download documents through my backend, never from the browser with the key.
- If an endpoint returns 404 or is not enabled for my key, stop and ask me rather than guessing.

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.