StampMitraDevelopers
Livee-Stamp Paper APIStep 4 of 8

Stamp duty calculation API: validate the duty amount and price the whole e-stamp

Calculate applicable stamp duty for a given article, state and transaction value.

POST/v1/estamp/duty/calculateScope estamp.duty.calculateAPI fee ₹5 per call
curl -X POST "https://api-b2b.stampmitra.in/v1/estamp/duty/calculate" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stateCode": "MH",
    "articleCode": "5",
    "stampDutyAmount": 500
  }'

Search for a "stamp duty calculation API" and you will find tools that take a property value and a state and print a duty figure. The StampMitra duty calculation endpoint is a different and more cautious thing, and the difference is the single most useful fact on this page. You tell it which state, which article and which duty amount you intend to buy. It tells you whether that amount can actually be issued there, and it prices everything around it: service charges, GST on those charges, any discount, and the total your customer will pay. POST /v1/estamp/duty/calculate is step four of the eight-step e-Stamp flow, and it is the first step that costs anything.

This page explains exactly what the call does and does not decide, every field of the request and the response, how the total is assembled, the validation rules and the messages they produce, how to treat a quote you have shown a customer, how to cache and meter it, and how to test and audit it. It is written for developers, with plain notes for the people who own the compliance decision about the duty itself.

What the endpoint is, in one paragraph

POST /v1/estamp/duty/calculate runs the platform's one authoritative pricing calculation for an e-stamp. It needs the estamp.duty.calculate scope, is rate limited to 30 requests per 60 seconds, and is metered against your API credit wallet, so each successful call carries StampMitra's API fee. The response is never to be recalculated, adjusted or overridden on your side: show what it returns. Sandbox calls do not debit your wallet.

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

curl -s -X POST "$BASE/v1/estamp/duty/calculate" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "stateCode": "MH", "articleCode": "ART1", "districtCode": "PUNE", "sroValue": "SRO-14", "stampDutyAmount": 1000 }'

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.
stateCoderequiredstringState code, e.g. MH.
articleCoderequiredstringStamp article code from the articles lookup.
stampDutyAmountrequirednumberStamp duty amount to calculate charges for; must be positive.
districtCodestringDistrict code, where the state needs one.
sroValuestringSub-registrar office value, where the state needs one.
doorstepDeliverybooleanWhether doorstep delivery is requested.
couponCodestringCoupon code to apply.
masterDataVersionintegerMaster-data version the caller last read.

What the call decides and what it leaves to you

Be precise about the division of labour, because getting it wrong is how a product ends up charging customers the wrong duty with great confidence.

QuestionWho answers it
Which article fits this document?You, or your counsel. The API cannot classify a document
How much statutory duty does this document attract?You, or your counsel, using the state's published rules or its own calculator
Can this amount be bought for this state and article?The API. It checks denominations, minimums, maximums and any configured duty rule
What are the service charges for this order?The API
How much GST applies and on what?The API: GST on service charges, never on duty
What is the total the customer pays?The API, in totalAmount

StampMitra's service terms say the same in legal language. The platform does not itself determine statutory stamp duty unless a service expressly provides a calculation based on authorised data, where duty is determined by an authority the developer must rely on that determination, and a technical amount displayed by an API does not override the statutory requirement for the transaction. The explainer on how duty is calculated by state covers how a duty figure is reached in the first place: instrument and article, state, measure, shape, caps and cess.

That is why the field is called stampDutyAmount and is required. It is an input, not an output.

The request, field by field

FieldTypeRequiredMeaning
stateCodestringYesState code from GET /v1/estamp/states, for example MH
articleCodestringYesArticle code from the state's article list
stampDutyAmountnumberYesThe duty amount to buy, in rupees. Must be positive
districtCodestringWhen the state requires itDistrict code, when sroRequired is true
sroValuestringWhen the state requires itSub-registrar office value, when sroRequired is true
doorstepDeliverybooleanNoWhether doorstep delivery is requested
couponCodestringNoA coupon to apply. It is trimmed and upper-cased
masterDataVersionintegerNoThe catalogue version your cache last read

Three notes. Send stampDutyAmount as a JSON number, not a string. Send only fields the endpoint documents, since this is a validated body. And send districtCode and sroValue together: a state that requires an SRO needs both, and the error names whichever is missing.

The response, field by field

The response combines catalogue echoes, the paper breakdown, the price breakdown and version markers. Every amount in the example is made up for illustration.

JSON
{
  "stateCode": "MH",
  "articleCode": "ART1",
  "districtCode": "PUNE",
  "sroValue": "SRO-14",
  "fulfilmentSpeed": "STANDARD",
  "deliveryOption": null,
  "eta": { "text": "Within 1 working day", "minutes": 1440 },
  "expectedBy": "2026-10-30T09:12:03.000Z",
  "papers": [{ "value": 1000, "count": 1 }],
  "paperCount": 1,
  "requiredDuty": null,
  "stampDutyAmount": 1000,
  "serviceCharges": [
    { "key": "PROCUREMENT_FEE", "basis": "FIXED", "amount": 100, "couponEligible": true, "unitAmount": 100, "quantity": 1 }
  ],
  "serviceChargeSubtotal": 100,
  "discountAmount": 0,
  "taxableServiceCharges": 100,
  "gstAmount": 18,
  "gstRatePercent": 18,
  "totalAmount": 1118,
  "masterDataVersion": 14,
  "masterDataVersionStale": false,
  "pricingVersion": 7
}
FieldWhat it tells you
stateCode, articleCode, districtCode, sroValueThe selection as the server understood it. District and SRO are null when not used
fulfilmentSpeedSTANDARD for API quotes
deliveryOptionThe delivery option chosen, or null
eta, expectedByA text and minutes estimate for the chosen speed, and the time it implies. Both can be null when no estimate is set
papers, paperCountThe papers the amount is issued as. For API orders each line is one physical stamp, so this is a single entry with a count of 1
requiredDutyThe minimum duty a configured rule demands for this selection, or null when no rule applies or it cannot be evaluated
stampDutyAmountThe statutory duty, exactly as you sent it. Never taxed, never discounted
serviceChargesOne entry per charge: key, basis, amount, couponEligible, unitAmount and quantity
serviceChargeSubtotalThe sum of the service charges
discountAmountAny discount, applied to service charges only
taxableServiceChargesThe service charges after discount, which is what GST is charged on
gstAmount, gstRatePercentGST on the taxable service charges, and the rate
totalAmountWhat the customer pays: duty plus service charges after discount plus GST
masterDataVersion, masterDataVersionStaleThe current catalogue version, and whether the one you sent is out of date
pricingVersionThe version of the pricing configuration used

Responses on the partner channel can also carry pricingChannel, wholesaleApplied, pricingChannelFallback, discountApplied and warnings. These describe which pricing layer produced the numbers and any discount applied to your organisation. Read them for diagnostics and log them, but do not branch on their absence, since a response without them is normal.

How the total is built

The arithmetic is short, and it is worth seeing once so that nothing in a response surprises you.

  1. Start from the statutory duty, stampDutyAmount. It goes straight to the total, untouched.
  2. Add up the service charges. Each has a key, such as a procurement fee, a convenience fee, a rapid charge or a delivery charge, and a basis that says how it was computed: a fixed amount, a percentage of the duty, a percentage of the subtotal, or a percentage that applies only above a threshold.
  3. Subtract any discount. Discounts, whether from a coupon or from a discount agreed for your organisation, apply to service charges marked couponEligible, never to duty.
  4. Charge GST at gstRatePercent on what is left, taxableServiceCharges. Duty carries no GST.
  5. The total is duty plus taxable service charges plus GST.
LineIllustrative amountNotes
Statutory duty1,000.00Untaxed, undiscounted, passed through at cost
Service charges100.00Sum of the fee lines
Discount0.00Coupon or organisation discount, on service charges only
Taxable service charges100.00Subtotal after discount
GST at 18 percent18.00On the taxable service charges
Total1,118.00totalAmount

The state decides the fee lines, and the pricing page says state-wise procurement fees are shared once production access is approved, so this page does not list them. What matters for your code is the structure: duty is one line, fees are a list, GST is computed for you, and the total is a single field. Show the lines to your customer in that order, with duty labelled as the statutory amount, because the three parts behave differently and a customer who understands that is far less likely to dispute the total later.

If a state charges the procurement fee per paper, the entry has quantity greater than one and unitAmount is the per-paper figure. Display unitAmount x quantity where quantity is above 1, and amount is always the line total.

The validation rules, in the order they are applied

Most 400 and 404 responses come from a short, ordered list of checks. Knowing the order tells you which message to expect.

  1. Service availability. If e-Stamp ordering is paused platform-wide, or the state's daily order cap is used up, the call is refused with a 409 and a message you can show.
  2. State. The state must exist and be currently available for e-Stamp. An unknown state is a 404 naming it. A state that exists but is not available is a 400.
  3. Article. The article must exist for the state and be allowed for e-Stamp there. Otherwise a 404 or a 400 naming the article and state.
  4. District and SRO. If the state requires them, both must be present and valid: missing ones give a 400 naming the missing field, and unknown ones give a 404.
  5. Denomination and range. If the article is limited to fixed amounts, stampDutyAmount must be one of them. Otherwise it must lie within the effective minimum and maximum, and at least requiredDuty if a duty rule applies. A failure is a 400 with a message listing the allowed values or the limit.
  6. Pricing. Only then are service charges, GST and discounts computed.

Checks one to five are free of pricing side effects. Because the calculation is metered only when it succeeds, a rejected amount does not cost you the API fee. Your UI should still avoid sending obviously invalid amounts, since it costs a round trip and rate limit.

The error messages you will actually see

Every error uses { "error": { "code", "message", "requestId" } }. For this endpoint the code is derived from the HTTP status, and the message is the useful part. The wording below is representative.

StatusCodeMessage patternWhat to do
400BAD_REQUESTState X is not currently available for e-StampTell the user, offer another state or a physical stamp
400BAD_REQUESTArticle X is not available for e-Stamp in YChoose another article
400BAD_REQUESTState X requires districtCode and sroValueCollect and send them
400BAD_REQUESTstampDutyAmount must be one of 100, 200, 500, 1000 for ART1 in MHShow the list, let the user pick
400BAD_REQUESTstampDutyAmount must be at least N for A in SRaise the amount to at least N
400BAD_REQUESTstampDutyAmount must not exceed N for SLower the amount, or split the document
400BAD_REQUESTOrganisation is not entitled to e-StampCheck your production access status
401UNAUTHORIZEDMissing or invalid API keyFix the key
402PAYMENT_REQUIREDInsufficient wallet balance to cover this callTop up the API credit wallet, then retry
403FORBIDDENKey lacks estamp.duty.calculateAdd the scope
404NOT_FOUNDState X not found, Article X not found for state Y, district or SRO not foundRefresh your lists
409CONFLICTe-Stamp ordering is paused, or the state's cap is reachedRetry later, tell the user
429TOO_MANY_REQUESTSMore than 30 requests in 60 secondsBack off
502INTERNAL_ERRORUpstream unreachableRetry with backoff

Numbers in those messages are illustrative. In your code, branch on the status first and use the message for display. If you want to turn a message into a structured hint, such as the list of allowed amounts, parse it defensively, and prefer reading allowedAmounts from the article catalogue, which gives you the same list as data.

Fixed denominations, ranges and `requiredDuty`

Whether an amount is allowed depends on the article's effective rule, covered in the lookup page. In practice you meet two shapes. A fixed list means only those amounts can be bought, and anything else is refused with the list. A range means any amount between a minimum and a maximum is fine. On top of either, a state can have a configured duty rule that sets a minimum for a given selection. When one applies, requiredDuty appears in the response and the amount you send must be at least that.

Treat requiredDuty as a floor, not as the answer. You may buy more duty than required, for example by choosing a larger denomination, but never less. If the response shows requiredDuty: null, no rule applied or the rule could not be evaluated. It does not mean the document needs no duty. The determination of duty still belongs to you, and the explainer shows how a team reaches it.

Coupons and organisation discounts

A couponCode is optional. It is trimmed and upper-cased, and it can reduce service charges that are marked couponEligible. It never reduces duty. If a client sends too many unknown coupon codes, the platform stops applying typed coupons for that client but still returns a quote, so a bad coupon does not block a price.

Separately, your organisation may have a discount agreed for the partner channel. When it applies, it lowers service charges only, GST is recomputed on what remains, and it does not stack with a coupon or an automatically applied offer: when a partner discount is in force, the typed coupon is ignored. The discountApplied and warnings fields describe this when they appear. A coupon that did not apply is not an error. Show the customer the quote you received, and if they typed a code that was ignored, tell them so.

A quote is not a lock

This is the point where integrations get into trouble. The quote you show a customer is accurate for the moment you asked. The order is priced again when it is created.

When you create an order, the platform quotes each stamp line afresh and debits wallets based on that new quote. If the pricing configuration or the catalogue changed between your quote and the order, the order uses the new numbers. The service terms warn about the same thing: statutory charges can be revised between quotation and payment. So treat your display as an estimate with a very short shelf life, and design accordingly.

  • Quote close to the order. Request the quote when the user confirms, not when they first typed an amount.
  • Carry the versions. Keep pricingVersion and masterDataVersion with the quote, so you can tell later whether anything changed.
  • Re-quote on a mismatch. If your order flow sees a different total, show the new figure and ask for confirmation before charging.
  • Keep an audit record. Store the full quote response, its requestId and the time with the order. It is your evidence of what the customer saw.

The order creation page covers how the order reports its own pricing and what happens to wallet balances.

Caching quotes and controlling cost

Because each successful call carries the API fee, do not call on every keystroke or on every page render. A quote depends on its inputs and on the catalogue and pricing versions. A cache keyed on a hash of those inputs is safe for a short time.

JavaScript
// Node 18+; server side only
import crypto from "node:crypto";

const BASE = "https://api-b2b.stampmitra.in";
const headers = { Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}`, "Content-Type": "application/json" };
const quotes = new Map();           // key -> { at, quote }
const FRESH_MS = 5 * 60_000;        // a quote shown to a user is good for minutes, not hours

const keyOf = (q) => crypto.createHash("sha256").update(JSON.stringify([
  q.stateCode, q.articleCode, q.districtCode ?? null, q.sroValue ?? null, Number(q.stampDutyAmount),
  Boolean(q.doorstepDelivery), (q.couponCode ?? "").trim().toUpperCase(),
])).digest("hex");

export async function priceStamp(q) {
  const key = keyOf(q);
  const hit = quotes.get(key);
  if (hit && Date.now() - hit.at < FRESH_MS) return { ...hit.quote, cached: true };

  const res = await fetch(`${BASE}/v1/estamp/duty/calculate`, {
    method: "POST", headers, body: JSON.stringify({ ...q, stampDutyAmount: Number(q.stampDutyAmount) }),
  });
  const body = await res.json();
  if (res.status === 400 || res.status === 404 || res.status === 409) return { ok: false, status: res.status, message: body.error.message };
  if (!res.ok) throw Object.assign(new Error(body.error?.message), { status: res.status, requestId: body.error?.requestId });
  quotes.set(key, { at: Date.now(), quote: body });
  return { ok: true, ...body };
}
Python
import hashlib, json, os, time, requests

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

def price_stamp(state, article, duty, district=None, sro=None, doorstep=False, coupon=""):
    body = {"stateCode": state, "articleCode": article, "stampDutyAmount": float(duty)}
    if district: body["districtCode"] = district
    if sro: body["sroValue"] = sro
    if doorstep: body["doorstepDelivery"] = True
    if coupon.strip(): body["couponCode"] = coupon.strip().upper()
    key = hashlib.sha256(json.dumps(body, sort_keys=True).encode()).hexdigest()
    hit = _quotes.get(key)
    if hit and time.time() - hit[0] < 300:
        return {"ok": True, "cached": True, **hit[1]}
    r = requests.post(f"{BASE}/v1/estamp/duty/calculate", json=body, headers=H, timeout=20)
    data = r.json()
    if r.status_code in (400, 404, 409):
        return {"ok": False, "status": r.status_code, "message": data["error"]["message"]}
    r.raise_for_status()
    _quotes[key] = (time.time(), data)
    return {"ok": True, **data}

Each call is a billable event only when it succeeds. The API fee for the e-Stamp surface is ₹5 per charged call on pay-as-you-go before GST, lower on Growth and Scale, and your plan's rate is on the pricing page. Other cost-control habits help too: validate amounts against allowedAmounts before calling, quote once per confirmed selection, and monitor your count of quote calls per completed order. A healthy ratio is a small number; a large one is a UI that quotes on every change.

Sandbox

Free

Build and test with a sandbox key.

Production API fee

₹5 / call

Pay-as-you-go per successful call, lower on Growth and Scale. Excludes 18% GST. State procurement fee and stamp duty are quoted per order. Full pricing

Access scope

estamp.duty.calculate

Your API key needs this scope to call the endpoint.

Billing, wallets and what a failure costs

The duty calculation is one of the metered e-Stamp calls. Metering follows a fixed order. The platform checks entitlement and the price, checks that your API credit wallet can afford the call, runs the handler, and only after success counts the usage and debits the wallet. A call that fails validation is not charged, and a call that fails on StampMitra's side or its provider's side is credited back automatically. If the wallet cannot cover the call, the response is 402 PAYMENT_REQUIRED before any work is done. Sandbox keys never debit, though their usage counts against the sandbox limits (10 a minute, 200 a day per organisation).

Keep two balances apart in your head. The API credit wallet pays the API fee for this call and has GST invoicing. The Stamp Duty Wallet and the Service Fee Wallet pay for the order itself later, as the payment page explains. A quote does not move money from either of those.

Delivery, speed and the time estimate

The request accepts doorstepDelivery, and the response carries fulfilmentSpeed, deliveryOption, eta and expectedBy. Together they describe how and when the stamp reaches the customer. Three habits keep this honest.

First, a delivery choice changes the price. Asking for doorstep delivery adds a delivery charge to the service charges, with GST on it like any other fee, so quote again if the user toggles it. Do not compute the difference yourself. Second, eta and expectedBy are estimates for the chosen speed and can be null when none is configured. Show them as "usually by" and never as a guarantee, since an order passes through review and vendor steps that the quote cannot foresee. Third, for an e-stamp the thing delivered is a certificate file, so "delivery" mostly matters to products that also ship a physical copy. If your product only needs the PDF, leave doorstepDelivery out and do not offer the option.

If a time estimate matters to your customer, say so in your own terms: "We expect your stamp within about a working day of approval, and we will email you when it is ready." Then back that with the status tracking described on the order status page, where the certificate route tells you when the document is actually available.

Numbers, rounding and a reconciliation check

All money in this response is in rupees as JSON numbers with paise, so a few precautions are worth taking.

  • Do not sum floating-point numbers for display. Use the fields the response gives you. If you must add lines, convert to integer paise first, add, and convert back.
  • Check that the lines add up. A cheap defensive test is stampDutyAmount + taxableServiceCharges + gstAmount == totalAmount, compared in paise. If it fails, log the full response with its requestId and show the customer the server's totalAmount anyway, since the server is the authority. The check exists to alert you, not to override.
  • Keep paise. A fee of 50.05 should appear as 50.05, not as 50. Format with two decimals and an Indian digit grouping in the UI, and keep the raw number in your records.
  • Do not round GST yourself. gstAmount is already computed with the platform's rounding.
JavaScript
// Defensive reconciliation of one quote, in integer paise
const paise = (n) => Math.round(Number(n) * 100);

export function reconcile(q) {
  const parts = paise(q.stampDutyAmount) + paise(q.taxableServiceCharges) + paise(q.gstAmount);
  const total = paise(q.totalAmount);
  if (parts !== total) {
    // alert, but trust the server's total
    console.warn("quote does not add up", { requestId: q.requestId, diffPaise: total - parts, quote: q });
  }
  return { totalPaise: total, dutyPaise: paise(q.stampDutyAmount) };
}

Retries, timeouts and the charge you cannot see

The duty calculation is a POST that carries a charge, and it does not take an Idempotency-Key; only order creation does. That has a practical consequence. If your request times out, you do not know whether the platform processed it, and a blind retry might be charged a second time. The charge is small, but the habit matters for the routes that follow.

A sensible policy has four parts. Use a short client timeout and retry only on clear transport failures or 502, with backoff. Never retry in a tight loop. Prefer your own cache: if the same selection was quoted a minute ago, reuse it instead of calling again. And keep a way to see what was charged, since request logs in the dashboard show each call and are retained for between 7 and 365 days depending on your plan. For anything where a duplicate would be expensive, order creation is the call that is protected with a mandatory idempotency key, and the order page explains it.

Pauses, caps and the 409

Two situations produce a 409 on this route and deserve friendly handling. e-Stamp ordering can be paused platform-wide by operations, in which case the message carries a customer-facing explanation. And a state can reach its daily order cap, after which new quotes for that state are refused until capacity returns. Neither is a bug and neither is the user's fault.

For an interactive flow, show the message, save the draft and offer to be notified or to try again later. For a batch or back-office flow, queue the work and retry with exponential backoff rather than failing the whole batch. Never loop on a 409 at speed. And do not collapse it with other failures in your metrics: a 409 spike tells you the service is paused, which is an operational fact worth a separate alert.

Multi-line orders and why sums can differ

The quote you request is for one stamp line. An order can contain several lines, all in one state. When the order is created, each line is quoted on its own and the whole order's paper count is taken into account for any quantity-based pricing. A quote for a single line is therefore priced as an order of one paper.

The consequence is that the total of three separate single-line quotes can differ from the order's actual cost where pricing depends on how many papers an order contains. If your product sells multi-line orders, say so in your interface: show the sum of line quotes as an estimate, and show the order's own pricing as the figure that counts once it is created. Never promise that a multi-line total equals the sum of individual quotes. The order creation page covers multi-line orders and how to read the result.

Adding your own fee on top

Many products charge their customers for their own service in addition to the stamp. That is fine and common, and it is best done cleanly.

  1. Keep your fee on its own line. Never fold it into a StampMitra line or change a StampMitra amount.
  2. Treat the StampMitra total as a cost input. Your price is totalAmount plus your own charge and whatever tax applies to your own service, which is your accounting matter.
  3. Do not apply your own GST logic to duty. Duty is untaxed; your fee is yours to treat under your own tax position.
  4. Record both the platform quote and your price per order, so that margin reports are exact.
  5. Stay transparent. Show customers the statutory duty separately, since it is passed through at cost and never marked up by StampMitra, and let your own fee be visible as yours.

This keeps the customer's view honest and your books tidy, and it avoids the situation where a price change on either side silently changes the other.

Reconciling quotes, orders and invoices

Three records should line up for every order, and a monthly check will tell you if they do not.

RecordWhere it livesWhat it tells you
Your quote recordYour databaseWhat the customer was shown, with versions and requestId
The orderThe order routesWhat was actually priced and created
The wallet ledgers and invoicesWallet transactions and GST invoicesWhat was debited, and what StampMitra billed for its own fees

Match them by your own order reference. Differences are usually explained by a re-quote at creation, by a coupon or discount that applied at one point and not the other, or by an API fee for a quote that was never followed by an order. The API fee for quotes is billed on your API credit wallet with GST invoices, separately from the duty and procurement debits made at order creation. A monthly report that lists orders created, quotes requested and the ratio between them is also a quick view of how well your UI avoids wasteful quoting.

Showing the price to a customer

A good price display separates the three kinds of money, and says what is estimated.

  • Statutory duty, labelled as such, with a short note that it is paid to the state, is not taxed and is not marked up.
  • Service fees, listed by line, with quantity where relevant.
  • GST, shown once, with its rate, and explained as applying to service fees only.
  • Total, large, with a line saying the final amount is confirmed when the order is placed.

Avoid rounding the numbers or merging lines. Do not calculate anything in the browser: pass the response to your front end and render it. If you localise, translate the labels and leave the numbers alone.

Worked examples

All amounts are illustrative. The states, articles and fees are examples and not any state's real values.

A fixed-denomination article. A user in a state where the article allows 100, 200, 500 and 1,000 chooses 500. The app sends the quote. The response shows papers: [{ "value": 500, "count": 1 }], a procurement fee line and GST. The user sees duty 500, fees, GST and a total. Had the user typed 600, the response would have been a 400 listing the four allowed values, and the app, which already knows allowedAmounts from the catalogue, would never have sent it.

A range article with a floor. An article in another state accepts any amount between a minimum and a maximum, and the state has a duty rule that makes requiredDuty 750 for this selection. The user's compliance rule decided 700. The API returns a 400 saying the amount must be at least 750. The app shows "This document needs at least 750 in stamp duty for this selection. Confirm with your reviewer", and offers to retry with 750 once a person has confirmed. It does not silently raise the amount, because the amount is a decision.

A coupon that does not apply. A user enters a coupon on a quote for an organisation that has a partner discount. The response has discountApplied set and the coupon is ignored. The app shows the discounted total and a note, "Your account discount applies; the coupon was not needed", instead of leaving the user wondering where the coupon went.

Testing and audit

A small set of tests covers most of the risk.

TestWhat it proves
Valid selection returns a total equal to duty plus taxable charges plus GSTYou parse the structure correctly
An amount off the allowed list yields a 400 and a readable messageYour UI shows the list and does not retry blindly
A state with sroRequired and no SRO yields a 400 naming the fieldYour form collects what the state needs
An unknown article yields a 404Your cache refresh path works
The same inputs twice within the window call the API onceCaching and cost control work
A changed pricingVersion between quote and order triggers re-confirmationYou do not charge a stale number
A 402 from the API credit wallet raises a clear operator alertLow balance does not silently break quoting

For audit, store for every order the quote request, the full response, its requestId and a timestamp, together with the identity of the person who confirmed the article and the duty amount. If a customer or an authority later asks how a figure was reached, the record answers in minutes.

Sandbox and production

The structure of a sandbox quote is the production one, but the numbers are not. A sandbox key answers from a small, fixed sandbox catalogue and an illustrative fee schedule, so the response has the same fields in the same shape, and the totals will differ from what production returns for the same selection. Treat sandbox as the place to build your display, your rounding and your error handling, and never as a source for the amount you show a customer in production. Sandbox calls never debit a wallet, and nothing reaches the issuing side. A sandbox quote counts toward the sandbox limits like every other e-Stamp sandbox request (10 requests a minute and 200 a day per organisation, and 50 a day per IP address, resetting at midnight IST), so do not load-test quotes there.

What the sandbox keeps from production: your stampDutyAmount is returned untouched and is never recalculated, GST is charged on the service charges only, and the validation errors use the production wording. What it does not have: the live state rules, the live availability of states and the live price book.

Sandbox ruleValue
Procurement feeINR 25 flat per paper
Convenience fee2 percent of the duty, only when the duty is above INR 1,000
Delivery feeINR 49, only with doorstepDelivery: true
GST18 percent of the service charges, never of the duty
CouponsIgnored, with a note in warnings
Most duty for one stampINR 10,00,000

The fee schedule is illustrative. It exists so that your fee table, your GST line and your rounding have realistic structure to work on. A quote for a duty amount of 500, for example, returns a service charge subtotal of 25, GST of 4.50 and a total of 529.50, which is easy to check by hand.

The sandbox catalogue has five states (DL, GJ, KA, MH and UP, which is not available) and five articles. The state, instrument and article page lists them, including which articles take only fixed amounts. Every error in the table above can be triggered on purpose: an unknown state, an unavailable state, an unknown article, a missing district or SRO in KA, an amount an article does not allow, an amount below the floor and an amount above the ceiling. The published reference example (MH, article 5, 500) runs unchanged.

Production needs an approved production access request and a funded API credit wallet. Check one production quote against your sandbox-built display in your go-live rehearsal. The sandbox versus production guide covers key handling.

Common mistakes

  • Expecting the API to derive duty from rent or sale value. You supply the amount.
  • Sending the amount as a string. Send a number.
  • Quoting on every keystroke. Each success is a charged call.
  • Treating a quote as a price lock. The order is priced again at creation.
  • Recomputing GST or totals in your own code. Show the response.
  • Charging GST on duty in your own display. Duty is untaxed.
  • Hiding duty and fees in one number. Customers dispute what they cannot see.
  • Parsing messages as the only source of allowed amounts. Read allowedAmounts from the catalogue.
  • Silently raising an amount after a 400. The amount is a compliance decision.
  • Keeping a duty rate table. The state's rules change and your table will be stale.

Where this fits in the flow

The duty calculation is step four of eight. Before it come the catalogue, the schema and the state, instrument and article lookup. After it come the parties, the order, the payment and the order status and document access. The overview guide shows all eight with a rental example, the explainer covers the legal method behind a duty figure, and the e-Stamp API reference lists the endpoint 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. The duty for your document is a determination for you or your counsel.

Sources

Frequently asked questions

Does the API calculate stamp duty from my rent or property value?

No. You supply stampDutyAmount. The endpoint checks that the amount can be issued for the state and article and prices service charges and GST around it. Deciding the statutory duty is a determination for you or your counsel.

What does the duty calculation response contain?

It echoes the selection and returns papers, requiredDuty, stampDutyAmount, a serviceCharges list, serviceChargeSubtotal, discountAmount, taxableServiceCharges, gstAmount, gstRatePercent and totalAmount, plus masterDataVersion, masterDataVersionStale and pricingVersion for cache checks.

Is GST charged on the stamp duty?

No. GST applies to the service charges only, after any discount. The statutory duty is passed through at cost, untaxed and undiscounted. The totalAmount is duty plus taxable service charges plus GST.

Why does the API reject my duty amount?

The article may allow only fixed denominations, or a range between a minimum and a maximum, and a configured duty rule can set a floor. The 400 message lists the allowed values or the limit, so show it and let the user choose again.

What is requiredDuty?

The minimum duty a configured rule demands for the selection. You may buy more, for example a larger denomination, but not less. Null means no rule applied or it could not be evaluated, not that the document needs no duty.

Is the quote a guaranteed price?

No. The order is priced again when it is created, and catalogue or pricing changes in between are reflected. Quote close to the order, keep pricingVersion and masterDataVersion with the quote, and re-confirm with the customer if the total differs.

Is the duty calculation charged?

Yes. It is a metered e-Stamp call, charged only on success against your API credit wallet. Rejected requests are not charged, calls failing on StampMitra's side are credited back, and sandbox calls never debit a wallet.

How do coupons work?

A couponCode, trimmed and upper-cased, can reduce service charges marked couponEligible, never the duty. If your organisation has a partner discount, it applies instead and the typed coupon is ignored. An ignored coupon is not an error.

Should I send stampDutyAmount as a string or a number?

A number. The field must be a positive JSON number, so parse the user's input before sending, strip separators such as commas, and reject zero and negative values in your form.

How should I cache duty quotes?

Key a short cache on a hash of the state, article, district, SRO, amount, delivery flag and coupon. A few minutes is enough. Quote when the user confirms rather than on every keystroke, since each success is a charged call.

Can a multi-line order cost more or less than the sum of single quotes?

It can, where pricing depends on the number of papers in an order, because each quote is priced as one paper while the order counts all lines. Present the sum as an estimate and the order's own pricing as the figure that counts.

What does a 409 on the duty calculation mean?

e-Stamp ordering is paused by operations or the state's daily order cap is reached. It is not your fault. Show the message, save the draft and retry later with backoff instead of looping.

Build with AI

Integrate Duty / Value Calculation 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 · Duty / Value Calculation · 5,734 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 "Duty / Value Calculation" API
Calculate applicable stamp duty for a given article, state and transaction value.

ENDPOINT: POST /v1/estamp/duty/calculate
- Calculate authoritative e-Stamp duty + service charges
- Required scope: estamp.duty.calculate
- Parameters:
  - stateCode (string, required): State code, e.g. MH.
  - articleCode (string, required): Stamp article code from the articles lookup.
  - stampDutyAmount (number, required): Stamp duty amount to calculate charges for; must be positive.
  - districtCode (string, optional): District code, where the state needs one.
  - sroValue (string, optional): Sub-registrar office value, where the state needs one.
  - doorstepDelivery (boolean, optional): Whether doorstep delivery is requested.
  - couponCode (string, optional): Coupon code to apply.
  - masterDataVersion (integer, optional): Master-data version the caller last read.
- Example request body: {"stateCode":"MH","articleCode":"5","stampDutyAmount":500}

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.