Creating an e-stamp order is the one step in the flow where a mistake costs real money and a retry can cost it twice. Everything before it was reading and pricing. Everything after it is waiting. This is the step that commits. It is also the step with the most misunderstandings, because "order created" does not mean what most developers expect: it means a request has been validated, paid for from your balances and put in front of a human reviewer, not that a stamp exists. This page walks through the whole order surface: validating before you create, creating safely with an idempotency key, reading and listing orders, cancelling, and the other order resource in the reference that you should probably not use for stamping. It is step six of the eight-step e-Stamp flow.
It is written for backend developers who will write the order worker, and for the product and operations people who will live with its output. Where behaviour is surprising it is stated plainly, with the reason.
The order routes at a glance
All of these are under the base URL https://api-b2b.stampmitra.in, authenticated with Authorization: Bearer <key> or x-api-key, and gated by the estamp.enabled entitlement.
| Route | Purpose | Scope | Rate limit | Metered by StampMitra |
|---|---|---|---|---|
POST /v1/estamp/orders/validate | Check an order without saving it | estamp.orders.validate | 30 per 60 s | No |
POST /v1/estamp/orders | Create an order (needs Idempotency-Key) | estamp.orders.create | 30 per 60 s | Per order, where the per-order fee is enabled |
GET /v1/estamp/orders | List your organisation's orders | estamp.orders.read | Default | No |
GET /v1/estamp/orders/:id | Read one order | estamp.orders.read | Default | No |
POST /v1/estamp/orders/:id/cancel | Cancel an order | estamp.orders.cancel | 30 per 60 s | No |
GET /v1/estamp/orders/:id/export | Reconciliation export | estamp.orders.read | Default | No |
GET /v1/estamp/stamps/:stampId | Read one stamp | estamp.stamps.read | Default | No |
POST /v1/estamp/stamps/:stampId/cancel, .../replace | Cancel or replace one stamp | estamp.stamps.cancel, estamp.stamps.replace | 30 per 60 s | No |
GET /v1/estamp/stamps/:stampId/certificate | Certificate status and download link | estamp.stamps.read | Default | No |
The stamp and certificate routes belong to the order status and document access page. This page covers the order itself.
POST/v1/orders
Create an order (generic - works for any entitled serviceCode, including e-Stamp)
Request parameters
| Field | Type | Description |
|---|---|---|
Authorizationrequired | header | Bearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted. |
Idempotency-Key | header | Optional idempotency key (1 to 255 characters), kept for 24 hours. The same key and the same request replays the stored response; the same key with a different request is 422 IDEMPOTENCY_KEY_REUSED; the same key while the first request is still running is 409 IDEMPOTENCY_IN_PROGRESS (see Retry-After). |
externalOrderIdrequired | string | Your own reference for this order. |
externalCustomerIdrequired | string | Your own reference for the customer. |
serviceCoderequired | string | The entitled service to order (e.g. an estamp.* code). |
details | object | Free-form service-specific payload (e-Stamp field shape is not finalized). |
Response fields
| Field | Type |
|---|---|
externalOrderId | string |
createdAt | string |
serviceCode | string |
GET/v1/orders/:id
Get an order
Request parameters
| Field | Type | Description |
|---|---|---|
Authorizationrequired | header | Bearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted. |
GET/v1/orders/:id/status
Get order status
Request parameters
| Field | Type | Description |
|---|---|---|
Authorizationrequired | header | Bearer <api-key> (e.g. sk_test_... in sandbox, sk_live_... in production). The x-api-key header is also accepted. |
What "created" means
When POST /v1/estamp/orders succeeds, the platform has done four things in order. It has validated your stamp lines against the issuing side's rules. It has priced each line afresh. It has debited the duty from your Stamp Duty Wallet and the service fee from your Service Fee Wallet. And it has written an order record that is waiting for review. It has not placed the order with the issuing vendor. A human operations reviewer confirms placement separately, outside this API, and only then does the order turn into stamps.
This design is deliberate. A silently duplicated or mistaken e-stamp order is a real-money mistake, and a human in the loop is the guard. It has consequences you should design for:
- An order will sit in a pre-placement status for a while. Do not show it to a customer as "stamped".
- The status vocabulary at this point is the platform's own:
PENDING_REVIEW,READY_TO_PLACE,WARNINGS,NEEDS_INFORMATION,VALIDATION_FAILEDandCANCELLED. The issuing vendor's own statuses appear later, on the stamps. - You cannot rush review by calling an API. Your product should communicate expected waiting time honestly, and track the actual elapsed time per order.
The request body
Both the validate and create routes take the same body: your own reference for the whole order, and a stamps array of one or more lines.
{
"reference": "lease-2026-0412",
"stamps": [
{
"clientReference": "line-001",
"state": "MH",
"category": "e_stamp",
"articleCode": "ART1",
"denomination": 1000,
"firstParty": "Vikram Shetty",
"secondParty": "Anita Rao",
"purpose": "Leave and licence agreement",
"district": "PUNE",
"sro": "SRO-14",
"propertyArea": "850 sq ft"
}
]
}| Field | Required | Meaning |
|---|---|---|
reference | No | Your own reference for the whole order. Distinct from the Idempotency-Key header |
stamps | Yes | One or more lines. All lines must share one state |
clientReference | No | Your own id for the line, echoed back on the created order's stamps[] |
state | Yes | State the line is issued in |
category | No | e_stamp (default) or traditional_stamp |
articleCode | Yes | Article from the state's catalogue |
denomination | Yes | The duty amount in rupees, a positive number |
firstParty | Yes | First party to the instrument |
secondParty | No | Second party, where the article uses one |
stampDutyPayer, payerPhone, payerGender | No | Who pays the duty, their phone, and MALE, FEMALE or OTHER |
purpose | No | Nature of the instrument |
district, sro | No | When the state needs them |
propertyArea | No | When the article needs an area |
cessAmount | No | When a cess applies |
quantity | No | Identical stamps for the line, default 1 |
costCentre, businessUnit, linkedDocRef | No | Your own tags and a linked document reference |
One order is one state. A body whose lines name different states is rejected with a 400 that lists the distinct states found. If you need stamps in two states, create two orders, each with its own idempotency key.
A contract note on party and area fields. The public contract currently takes firstParty and secondParty as plain names and propertyArea as a string. The issuing side models a party as an object with a name and optional address, phone, fatherHusbandName and gender, and a property area as a unit and a value. When a state's flags ask for a first-party address or a father's or husband's name, those properties are where that data belongs. Run a sample through the validate route in sandbox, keep the shape that is accepted as a fixture, and ask developer support which form your account should use. This is the part of the contract most likely to be refined.
Validate first
POST /v1/estamp/orders/validate runs the same validation as creation without saving anything and without charging. It returns HTTP 200 whether the result is READY_TO_PLACE, WARNINGS or NEEDS_INFORMATION, and a 400 only for VALIDATION_FAILED, meaning input that cannot be fixed by adding information. The response has no id, since nothing was persisted.
{
"valid": true,
"reference": "lease-2026-0412",
"state": "MH",
"status": "READY_TO_PLACE",
"isTest": false,
"counts": { "total": 1, "e_stamp": 1, "traditional_stamp": 0 },
"errors": [],
"warnings": [],
"quote": { "faceValueTotal": 1000, "serviceFeeTotal": 99, "gstOnFee": 17.82, "serviceWalletDebitTotal": 99 },
"createdAt": "2026-10-29T09:12:03.000Z"
}valid is false only when a detail is missing (NEEDS_INFORMATION); errors and warnings are lists of { index, message } where index is the zero-based stamp line. quote holds the priced totals in rupees: faceValueTotal is what the Stamp Duty Wallet pays, serviceWalletDebitTotal what the Service Fee Wallet pays (the fee before GST), gstOnFee the GST on the fee. It is null only if pricing was unavailable for that call. The sandbox and production answer with exactly this shape.
| Validate result | HTTP | What it means | What to do |
|---|---|---|---|
READY_TO_PLACE | 200 | Nothing wrong found | Proceed to create |
WARNINGS | 200 | Passed with notes, often about pricing or compliance | Show the warnings to the user and let them confirm |
NEEDS_INFORMATION | 200 | A detail is missing | Collect it, then validate again |
VALIDATION_FAILED | 400 | Input is malformed or unfixable | Fix the input, using the message |
Make validate the last step before the confirmation screen. It surfaces field-level problems while the user is still there, and it is free, so there is no reason to skip it.
curl -s -X POST "$BASE/v1/estamp/orders/validate" \
-H "Authorization: Bearer $STAMPMITRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "reference": "lease-2026-0412", "stamps": [ { "state": "MH", "articleCode": "ART1", "denomination": 1000, "firstParty": "Vikram Shetty", "secondParty": "Anita Rao" } ] }'Create, with a mandatory idempotency key
POST /v1/estamp/orders takes the same body plus a required Idempotency-Key header.
curl -s -X POST "$BASE/v1/estamp/orders" \
-H "Authorization: Bearer $STAMPMITRA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: lease-2026-0412-v1" \
-d '{ "reference": "lease-2026-0412", "stamps": [ { "clientReference": "line-001", "state": "MH", "articleCode": "ART1", "denomination": 1000, "firstParty": "Vikram Shetty", "secondParty": "Anita Rao", "purpose": "Leave and licence agreement" } ] }'HTTP 201 means the order record exists. The header is mandatory on this route and only this route, because an order that spends money must never be retriable by accident.
Idempotency, precisely
The behaviour is simple to state and easy to get wrong.
| Situation | Result |
|---|---|
| First request with a new key | The order is created, and the response is stored against the key |
| Same key, same body, again | The original response is replayed. No second order, no second debit |
| Same key, different body | 422 with the code IDEMPOTENCY_KEY_REUSED. The key was already used with a different request. Nothing is created |
No Idempotency-Key header | 400 with the code IDEMPOTENCY_KEY_REQUIRED. Nothing is created |
| Same key while the first request is still being processed | 409 with the code IDEMPOTENCY_IN_PROGRESS and a Retry-After header. Wait that long and resend the identical request: you get the first request's response |
A key is scoped to your organisation, to this route and to the environment, so a sandbox key never matches a production one and the same string on another route is a different key. A key is kept for 24 hours: inside that window it replays, after it a repeat runs as a new request. A key must be 1 to 255 printable characters, otherwise the answer is 400 IDEMPOTENCY_KEY_INVALID. A replay returns the same status and body as the first answer.
Four rules make this work in practice.
- Derive the key from something stable that you own. An agreement id plus a version works:
lease-2026-0412-v1. A random value generated per attempt defeats the purpose, since a retry would generate a new one. - Change the key when you change the body. If the user corrects a field and you resubmit, the body is different, so use
-v2. Reusing the key gets a 422IDEMPOTENCY_KEY_REUSED. - Persist the key before you send. Write it to your database, send the request, then record the outcome. After a crash you can see what was in flight.
- Retry with the same key and the same body. After a timeout, send the identical request. You either get the original response or the order is created now, and either way you do not get two.
Idempotency also protects the money. The wallet debit is keyed to the order so that a duplicate submission cannot debit twice, and if a request failed after debiting, the debits are credited back. For the money rules, see the payment page.
// Node 18+; server side only
import { randomUUID } from "node:crypto";
const BASE = "https://api-b2b.stampmitra.in";
const headers = { Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}`, "Content-Type": "application/json" };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
export async function createEstampOrder({ agreementId, version, reference, stamps }) {
const key = `${agreementId}-v${version}`; // stable, derived from our own ids
const body = JSON.stringify({ reference, stamps });
for (let attempt = 0; attempt < 4; attempt++) {
let res;
try {
res = await fetch(`${BASE}/v1/estamp/orders`, { method: "POST", headers: { ...headers, "Idempotency-Key": key }, body });
} catch (e) { // transport failure: unknown outcome, same key, same body
await sleep(1000 * 2 ** attempt); continue;
}
const out = await res.json();
if (res.status === 201) return { ok: true, order: out };
if (res.status === 409 && out.error?.code === "IDEMPOTENCY_IN_PROGRESS") { await sleep(1000 * Number(res.headers.get("retry-after") ?? 1)); continue; } // first attempt still running
if (res.status === 409 || res.status === 400 || res.status === 422) return { ok: false, status: res.status, message: out.error.message }; // do not retry
if (res.status === 402) return { ok: false, status: 402, message: "check wallet balances" };
if (res.status === 429 || res.status >= 500) { await sleep(1000 * 2 ** attempt); continue; } // same key replays safely
throw Object.assign(new Error(out.error?.message), { status: res.status, requestId: out.error?.requestId });
}
return { ok: false, status: 0, message: "unknown outcome: read the order list before retrying" };
}import os, time, requests
BASE = "https://api-b2b.stampmitra.in"
H = {"Authorization": f"Bearer {os.environ['STAMPMITRA_API_KEY']}"}
def create_estamp_order(agreement_id: str, version: int, reference: str, stamps: list) -> dict:
key = f"{agreement_id}-v{version}" # stable, derived from our own ids
body = {"reference": reference, "stamps": stamps}
for attempt in range(4):
try:
r = requests.post(f"{BASE}/v1/estamp/orders", json=body,
headers={**H, "Idempotency-Key": key}, timeout=30)
except (requests.ConnectionError, requests.Timeout):
time.sleep(2 ** attempt); continue # unknown outcome: same key, same body
data = r.json()
if r.status_code == 201:
return {"ok": True, "order": data}
if r.status_code == 409 and data["error"]["code"] == "IDEMPOTENCY_IN_PROGRESS":
time.sleep(int(r.headers.get("Retry-After", 1))); continue # first attempt still running
if r.status_code in (400, 409, 422):
return {"ok": False, "status": r.status_code, "message": data["error"]["message"]}
if r.status_code == 402:
return {"ok": False, "status": 402, "message": "check wallet balances"}
if r.status_code == 429 or r.status_code >= 500:
time.sleep(2 ** attempt); continue
r.raise_for_status()
return {"ok": False, "status": 0, "message": "unknown outcome: list orders by reference before retrying"}After an unknown outcome, such as a timeout followed by repeated failures, do not guess. List your orders and look for your reference before you decide.
What the response contains
The create response is the order, with its stamps.
{
"id": "estord_9c1f2a3b",
"orderId": "6a0e2b9a-5f1d-4c63-9c2e-0d4e7b1f3a55",
"reference": "lease-2026-0412",
"state": "MH",
"status": "PENDING_REVIEW",
"isTest": false,
"stampCount": 1,
"stamps": [{ "id": "eststamp_4f21ab", "clientReference": "line-001" }],
"errors": [],
"warnings": [],
"warningsAcknowledged": false,
"createdAt": "2026-10-29T09:12:03.000Z",
"updatedAt": "2026-10-29T09:12:03.000Z"
}| Field | What it tells you |
|---|---|
id | The order id used in GET /v1/estamp/orders/:id and the cancel and export routes |
orderId | The Core order id. The parties route takes this one |
reference | Your own order-level reference, echoed |
state | The state of the order |
status | The pre-placement status |
isTest | Whether the order was created in the sandbox environment |
stampCount, stamps | The number of lines and, for each, a stamp id and your clientReference |
errors, warnings, warningsAcknowledged | Validation findings on the order and whether warnings have been acknowledged |
createdAt, updatedAt | Timestamps |
Store id, orderId, each stamp id, your reference and each clientReference together. They are the join keys between your records and the platform's. The stamps[].id values are what you use later to read a stamp and fetch its certificate.
The create response can carry errors and warnings arrays. A WARNINGS status means the order was created and is flagged for attention. The public contract does not document a request field for acknowledging warnings, so treat warnings as something the user reads at the validate step before creating. If a 400 about unacknowledged warnings ever appears, note the requestId and ask developer support how your account should proceed.
What happens to money at creation
Order creation is when the statutory duty and the service fees are paid for. Before any order record is written, the platform debits the duty from your Stamp Duty Wallet and the service fee, net of GST, from your Service Fee Wallet. If the second debit fails, the first is reversed. If the order cannot be created after the debits, they are credited back. A shortfall in either balance means the order is refused and nothing is created. In that case the answer is a 402 PAYMENT_REQUIRED whose message says which wallet is short, the Stamp Duty Wallet or the Service Fee Wallet, so you know which one to top up.
After you top up, retry with the same key and body. Because nothing was created, the retry runs cleanly. The payment page covers the wallets, top-ups and ledgers.
Two other points. The price used is the one computed at creation, not the one from your earlier quote, so a catalogue or pricing change in between shows up in the order. And separately from the duty and fee wallets, a per-order StampMitra API fee can apply to order creation where it is enabled for your account, charged once per created order to your API credit wallet and never for a failed creation. Check your plan and the pricing page, where the API fee for the e-Stamp surface is ₹5 per charged call on pay-as-you-go before GST.
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
orders.create
Your API key needs this scope to call the endpoint.
Multi-line orders
An order can contain several lines, all in one state, which is how you buy a rental agreement stamp and an indemnity stamp in one go. Each line becomes its own stamp with its own id.
- One idempotency key covers the whole order. The key protects the order, not each line.
- Give every line a
clientReference. It is echoed back instamps[], which is how you match platform stamps to your documents. - Pricing is per line, with the whole order's paper count in mind. Where pricing depends on how many papers an order has, the total can differ from the sum of single-line quotes.
- Lines are independent after placement. One stamp can be cancelled or replaced without touching the others.
- Use
quantityfor identical stamps. If you need three identical stamps for one document type, setquantity: 3on a line instead of repeating it.
If one line has a problem, the validate route reports it before you create. Prefer fixing the line over splitting the order, unless the lines belong to different states.
When one line of several is the problem
A multi-line body is validated as a whole. If a single line is missing a detail or fails a rule, the order's status reflects it, and the message names the line by its position or its clientReference, which is one more reason to set that field on every line. Your handling has three options. Fix the line and validate again before creating, which is the best case and the reason validate exists. If the order was already created and sits in NEEDS_INFORMATION, supply the missing detail where the route allows it and read the order again. Or, if the line is simply wrong, cancel the order before placement and recreate it with a corrected body and a new key. Avoid splitting a healthy multi-line order into several single-line orders just to isolate one bad line, unless the lines are in different states, since the whole-order paper count can affect pricing.
Statuses, and how to model them
Two vocabularies exist and they describe different moments. Store both and do not merge them.
| Where | Value | Meaning |
|---|---|---|
| Order | PENDING_REVIEW | Created, waiting for a reviewer |
| Order | READY_TO_PLACE | Validated, ready for placement |
| Order | WARNINGS | Created with warnings |
| Order | NEEDS_INFORMATION | More detail needed |
| Order | VALIDATION_FAILED | Could not be validated |
| Order | CANCELLED | Cancelled |
| Stamp | PLACED, ASSIGNED, GENERATING, VERIFYING, VERIFIED | The issuing side's progress, once placed |
| Stamp | CANCELLED | Cancelled at the issuing side |
A sound internal model has your own states on top: draft, validated, submitted, in_review, needs_info, placed, stamped, failed and cancelled, derived from the platform's statuses. Map unknown strings to a "needs attention" state instead of throwing, and keep the raw platform value in a column, so an unexpected status is visible and does not break your poller.
Listing, reading and exporting
GET /v1/estamp/orders lists your organisation's orders, and only yours, newest first. The response has items, an array of orders, and nextCursor, a string to pass back as the cursor query parameter for the next page and null on the last page. Use limit (1 to 100, default 20) to size a page. For clients that read the earlier fields, data repeats items and pagination carries page, limit and total; total is exact on the last page and null while more pages follow, and page is honoured for the first 20 pages. The sandbox and production answer with exactly this shape.
{ "items": [ { "id": "estord_9c1f2a3b", "status": "PENDING_REVIEW" } ], "nextCursor": "estord_7d3e1c20", "data": [ { "id": "estord_9c1f2a3b", "status": "PENDING_REVIEW" } ], "pagination": { "page": 1, "limit": 20, "total": null } }curl -s "$BASE/v1/estamp/orders?limit=20" -H "Authorization: Bearer $STAMPMITRA_API_KEY"
curl -s "$BASE/v1/estamp/orders?limit=20&cursor=estord_7d3e1c20" -H "Authorization: Bearer $STAMPMITRA_API_KEY"
curl -s "$BASE/v1/estamp/orders/estord_9c1f2a3b" -H "Authorization: Bearer $STAMPMITRA_API_KEY"
curl -s "$BASE/v1/estamp/orders/estord_9c1f2a3b/export" -H "Authorization: Bearer $STAMPMITRA_API_KEY"The list is the tool for resolving unknown outcomes, since your reference appears on each order. GET /v1/estamp/orders/:id returns one order, with a 404 if it does not belong to your organisation. The export route returns a small CSV for reconciliation, as a filename and a csv string with the columns id, orderId, status, state, articleCode, denomination, providerRef, createdAt and updatedAt. It describes the order's first stamp line, so for a multi-line order use it as a status summary, not as a full ledger.
Cancelling
POST /v1/estamp/orders/:id/cancel behaves differently depending on how far the order has come.
| Order situation | What the call does |
|---|---|
| Not yet placed | The order is cancelled directly and returned as CANCELLED |
| Placed with the issuing side | A cancellation request is sent to the vendor, and the order changes when the vendor confirms. The immediate response may still show the old status |
| Completed, or already cancelled | 409 INVALID_STATE |
So cancellation is clean before placement and asynchronous after it. Do not assume that a 200 means the money is back, and do not mark your own record as cancelled until the platform's record says so. Single stamps can be cancelled with POST /v1/estamp/stamps/:stampId/cancel while they are in a cancellable vendor state, and a defective stamp can be replaced with .../replace. A verified stamp cannot be cancelled.
Cancel and recreate, or correct?
Both paths exist, and the choice depends on what is wrong. A contact detail that sits on the party record, such as a mobile number, an email or an address, is corrected through the parties route, and no new order is needed. A fact on the stamp line itself, such as the second party's name, the article, the amount, the property area or the payer, cannot be edited in place. For those, cancel the order while it is still before placement and create a new one. Choose a new idempotency key for the new body, keep the old order's ids in your audit table, and tell the customer that the first request was withdrawn. If the order has already been placed, cancelling becomes a request to the issuing side that may not succeed, and a stamp that has been verified cannot be cancelled at all. Ask for a replacement only for a defect, not for a wrong detail.
Building the order worker as a small durable state machine
Order creation is a good place to be boring. The safest worker is a small state machine whose every step is written down before it happens, so that a crash at any point can be resumed without guessing.
| Your state | Entered when | Next action | If the process dies here |
|---|---|---|---|
draft | The user is still editing | None | Nothing was sent |
validated | Validate returned READY_TO_PLACE or accepted WARNINGS | Wait for confirmation | Nothing was sent |
submitting | You persisted the key and body and are about to send | Send the create request | Resend the same key and body |
submitted | You received a 201 and stored the ids | Poll order status | Read the order by id |
in_review | The order is in a pre-placement status | Poll with backoff | Poll again |
needs_info | The status is NEEDS_INFORMATION or VALIDATION_FAILED | Ask the user, correct, or recreate | Pick up from the queue |
placed | Stamps exist and are progressing | Poll stamps | Poll again |
stamped | A certificate is available and saved | Notify the user | Nothing to repeat |
cancelled, failed | Terminal | None | Nothing to repeat |
The critical row is submitting. Persist the idempotency key and the exact body before you send, in the same transaction that moves the state. If the process dies after sending and before recording the response, the next run finds a record in submitting, resends the identical request, and gets either the original response or a fresh creation. No guesswork and no duplicate. This is the same outbox idea used for payments and emails, applied to stamps.
Run the worker with a small concurrency limit, since the create route allows 30 requests per 60 seconds and a burst is more likely to cause trouble than to save time. Process one order per key at a time, and keep the polling job separate from the submitting job so that a slow poll never delays a send. Make each handler safe to run twice, because at-least-once delivery from a queue will eventually run one twice.
Living with the review wait
Every order spends time in review, and your customers feel it. Treat the wait as a product feature to design, not as latency to hide.
- Measure it. Record the time from
submittedtoplacedfor each order, and watch the median and the slow tail. Your own numbers are better than any catalogue estimate. - Say what you know. "Your stamp request is with our team and usually moves within about a working day" is honest. "Instant" is not.
- Notify on change, not on a timer. Message the user when the order moves to needing information, when it is placed, and when the certificate is ready. Silence between those is fine.
- Set an escalation threshold. If an order is still in review after several times your usual wait, create an internal task and, if needed, contact developer support with the order references.
- Never promise a stamp time you cannot control. A stamp is needed before execution of the document, so tell the user to leave room, and show them where the order stands.
A status page for your own customers, driven by your stored platform status, answers most "where is my stamp" questions before they become tickets.
An audit trail for what you committed
Creating an order commits money and states, on a document that may matter for years. Record enough to reconstruct the decision.
- What the user confirmed: the state, the article, the amount, the parties, and the exact text of any warning they accepted.
- Who confirmed it, whether the customer or a member of your team, and when.
- What you sent: the idempotency key and a hash or copy of the body.
- What came back: the full response with its
requestId, and every later status change with a timestamp. - Which rules were in force: the article mapping version, the catalogue version and the pricing version where you have them.
- What changed afterwards: corrections, cancellations and replacements, each linked to the original order.
For higher-value or unusual documents, add a second approver before create. The article and the duty are decisions with legal weight, and a two-person rule is cheap. Restrict who can see party details, set a retention period that matches your own obligations, and keep the audit table append-only so that history cannot be edited. These records are what answer a question from a customer, an auditor or an authority months later, and what let you explain a cancelled order in one query.
Errors and how to react
All errors use { "error": { "code", "message", "requestId" } }. The code is derived from the HTTP status, with one exception noted in the table, and the message carries the detail.
| Status | Code | When | What to do |
|---|---|---|---|
| 400 | IDEMPOTENCY_KEY_REQUIRED | Missing Idempotency-Key on order creation. Nothing was created | Send a key and resend |
| 400 | BAD_REQUEST | Validation failure, lines in different states, or the organisation not entitled | Read the message, fix and resend |
| 401 | UNAUTHORIZED | Missing or invalid key | Fix the key |
| 402 | PAYMENT_REQUIRED | The Stamp Duty Wallet or the Service Fee Wallet cannot cover the order (the message names which), or, where the per-order API fee is enabled, the API credit wallet cannot cover it. Nothing was created and nothing was charged | Top up the wallet the message names and retry with the same key |
| 403 | FORBIDDEN | Valid key without the scope | Add estamp.orders.create or the relevant scope |
| 404 | NOT_FOUND | No such order for your organisation | Check the id, and which key you used |
| 409 | IDEMPOTENCY_IN_PROGRESS | A request with this key is still being processed. Retry-After says when to retry | Resend the identical request after the delay |
| 409 | CONFLICT | The action is not possible in the current state, for example cancelling an order that is already placed | Read the status |
| 422 | IDEMPOTENCY_KEY_REUSED | The key was already used with a different request. Nothing was created | Use a new key for a new body |
| 409 | SERVICE_UNAVAILABLE | e-Stamp ordering is paused. The message is customer-facing | Retry later with backoff and tell the user |
| 429 | TOO_MANY_REQUESTS | More than 30 requests in 60 seconds. The response carries Retry-After | Back off for that long |
| 502 | INTERNAL_ERROR | Upstream unreachable, or an unmapped upstream failure | Retry with the same key |
| 503 | INTERNAL_ERROR | A dependency is temporarily unavailable. The response carries Retry-After | Retry after that delay |
Branch on the status first and use the message for display. Log the requestId on every failure.
The generic order route, and why not to use it
The reference also lists POST /v1/orders, the platform-wide order resource that works for any entitled service code, including e-Stamp ones. It takes externalOrderId, externalCustomerId, serviceCode and a free-form details object. For stamping it is a poor fit, for plain reasons. It has no typed state, article or denomination fields, so nothing validates what you put in details. It has no pre-creation validate route, no multi-line support and no stamp-level cancel or certificate routes. Its idempotency key is optional where the e-Stamp route's is mandatory. The e-Stamp order routes exist because stamping needs all of those. If you have a reason to use the generic route, for example an existing integration for another service code, ask developer support first and keep it out of your stamping path.
Sandbox and production
A sandbox key runs the order routes on a simulation. Nothing reaches the issuing side, no real wallet is touched and nothing is charged, so you can build and test the whole order path for free before you switch to a production key. This page covers the order. The order status and document access page covers stamps and the certificate, and the payment page covers the fake wallets that the simulation debits.
A lifecycle that moves by itself
A sandbox order advances with the time since it was created, so polling GET /v1/estamp/orders/:id shows progress with no action from you.
| Status | Default time after creation | What it stands for |
|---|---|---|
CREATED | 0 seconds | The order exists and the sandbox wallets have been debited |
PAYMENT_PENDING | 5 seconds | Waiting for the simulated payment |
PROCESSING | 15 seconds | The simulated issuing service is generating the stamps |
ISSUED | 30 seconds | The stamps are VERIFIED and the certificate can be fetched |
Those are the defaults and an environment can shorten them, so read sandbox.nextStatusAt on the order instead of hard-coding the times. A sandbox order body has the same fields as a production one, plus a sandbox object with the scenario, statusChangedAt and nextStatusAt, and a failure object with a code and a message when the order ended badly. Ids look like estord_sbx_ and eststamp_sbx_ followed by ten characters, and isTest is true.
These statuses belong to the sandbox. A production order uses the platform's pre-placement vocabulary described earlier on this page, waits for a human reviewer and does not advance by itself. Write your status mapping so that it accepts both sets, and do not treat the sandbox timing as a promise about production.
Special test inputs
To force an outcome, put one of these markers in the order reference, or in the clientReference of any stamp line. Matching ignores case and surrounding spaces, and the whole value must be the marker.
| Marker | What happens |
|---|---|
SBX-PAYMENT-FAILED | The order reaches PAYMENT_PENDING, then ends PAYMENT_FAILED when it would have started processing. The sandbox debit is credited back |
SBX-ISSUANCE-FAILED | The order reaches PROCESSING, then ends ISSUANCE_FAILED with the failure code ISSUANCE_FAILED, as if the issuing service had returned an error. Credited back |
SBX-CANCELLED | A reviewer cancels the order when it would have started processing, so it ends CANCELLED. Credited back |
SBX-EXPIRED | The order is never completed and ends EXPIRED. Credited back |
SBX-DUPLICATE | POST /v1/estamp/orders answers 409 and creates nothing. The validate route answers WARNINGS instead |
SBX-WARNING | The validate route answers WARNINGS with a pricing note. Create proceeds normally |
You also get these without any marker: a 400 for an amount the article does not allow, a 400 for a state that needs a district and an SRO (Karnataka, KA), a 400 for an unavailable state (UP), a 402 when a sandbox wallet is too low, a 422 IDEMPOTENCY_KEY_REUSED for a reused idempotency key with another body and a 429 at the open-order limit. The state, instrument and article page lists the sandbox catalogue.
What matches production and what does not
- Validation. The body validators are the production ones, so a malformed body gets the same status and message in both environments. The catalogue checks (unknown state or article, denomination, district, SRO) use the production wording against the smaller sandbox catalogue.
- Idempotency. The same key and the same body replays the original response, with no second order and no second debit. A different body under the same key is rejected with
422and the codeIDEMPOTENCY_KEY_REUSED, and a request that arrives while the first is still running with409andIDEMPOTENCY_IN_PROGRESS, exactly as in production. A sandbox key replays for as long as the sandbox order is stored. - Money. Creating an order debits the sandbox Stamp Duty Wallet and Service Fee Wallet, a failed or cancelled order credits them back once, and a short balance is a
402. See the payment page. - Events. Each change of status sends the matching
order.*webhook to the organisation's sandbox endpoints only. See the order status and document access page. - Limits. An organisation can have 50 open sandbox orders at once. The next create answers
429with the codeSANDBOX_ESTAMP_ORDER_LIMITand creates nothing. Open orders finish by themselves in about thirty seconds, or you can cancel them. Sandbox orders and their stamps are deleted after 30 days. Every sandbox request on the order routes also counts toward the sandbox call limits (10 requests a minute and 200 a day per organisation, and 50 a day per IP address, resetting at midnight IST): validate, create, list, get, cancel and export, and every poll. - The review step. Production orders wait for a person. The sandbox has none, which is the main reason its timing tells you nothing about how long a real order takes.
Moving to production
Production needs an approved production access request and funded wallets. Before launch, rehearse one low-value production order from end to end, because that is the only way to see the real review wait and the real certificate. The sandbox versus production guide covers the switch.
Reconciling orders with your records
Keep a table that ties your world to the platform's, and check it daily.
| Your column | Source | Purpose |
|---|---|---|
agreement_id, version | Your own | What you were stamping |
idempotency_key | Your own | The key sent for this attempt |
platform_order_id | Response id | Reading, cancelling, exporting |
core_order_id | Response orderId | The parties route |
stamp_id, client_reference | Response stamps[] | Reading stamps and certificates |
platform_status, status_changed_at | Polls | Your own timeline |
submitted_at, quote_total, quote_request_id | Your own | What the user saw |
A daily job lists orders for the last few days and compares them with this table. It flags orders the platform has and you do not (an unknown outcome you never resolved), orders you have and the platform does not (a failed create you marked as done), and statuses that have not moved for longer than your expectation. Most disputes end quickly when these three lists are empty.
Worked example: three lines and a retry
A broker app stamps a leave and licence agreement together with an indemnity bond and an affidavit for one customer, all in one state. It sends three lines with clientReference values lease, indemnity and affidavit. The validate call returns WARNINGS with a note on one line, which the app shows to the customer, who confirms.
The app persists the key broker-7731-v1 and sends the create request. The connection drops before the response arrives, and the client sees a timeout. The app does not know whether the order exists. It retries with the same key and the same body. The platform replays the original response, which shows one order with three stamps. There is one order and one debit, not two.
Later the customer corrects the licensee's name on the lease line. The app has no way to edit the stamp line, and the order is still PENDING_REVIEW, so it cancels the order, which succeeds directly, builds a new body with the corrected line, and sends it with the key broker-7731-v2. The first order shows CANCELLED, the second is created, and the audit table lists both with their request ids. The clientReference values lease, indemnity and affidavit match the three stamps on the new order to the app's documents.
The daily reconciliation job finds the first order cancelled and the second in review, and nothing it cannot account for.
Testing
| Test | What it proves |
|---|---|
| Validate returns each of the four outcomes for crafted bodies | Your UI handles all of them |
| Create without the header returns 400 and sends nothing twice | You never omit the key |
| Same key and body twice returns the same order | Replay works |
Same key with a changed body returns 422 IDEMPOTENCY_KEY_REUSED | You use a new key for a new body |
| Mixed-state lines are rejected before you send | You prevent a predictable 400 |
| A timeout then retry produces one order | Retries are safe |
| A short wallet returns 402 and the message names the wallet | You top up the right wallet |
| Cancel before placement succeeds, after placement is treated as asynchronous | You handle both |
| Unknown status strings land in "needs attention" | A new status cannot crash the poller |
Common mistakes
- Treating
201as "stamped". It means the order is waiting for review. - Random idempotency keys. A retry then creates a second order.
- Reusing a key after changing the body. You get a 422
IDEMPOTENCY_KEY_REUSED. - Concurrent requests with one key. The second gets a 409
IDEMPOTENCY_IN_PROGRESSwithRetry-After. Wait, then resend the identical request. - Skipping validate. It is free and catches most problems.
- Mixed states in one order. One order is one state.
- Using the generic
/v1/ordersroute for stamping. It lacks the typed fields and the safeguards. - Marking an order cancelled on a 200 after placement. The vendor confirms later.
- Ignoring
clientReference. It is how you match stamps to documents.
Where this fits in the flow
Order creation is step six of eight. Before it come the catalogue, the schema, the state, instrument and article lookup, the duty and value calculation and the parties. After it come the payment and the order status and document access. The overview guide shows all eight with a rental example, the order flow guide goes deeper on webhooks and retries, and the e-Stamp API reference lists the routes 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 article, the duty and the document are your responsibility, as the service terms explain.
Sources
- StampMitra e-Stamp API reference, order creation, checked 2026-10-29.
- StampMitra authentication reference for keys, scopes and the error envelope, checked 2026-10-29.
- StampMitra Verification, e-Stamp and e-Sign Service Terms, sections 11 to 14, checked 2026-10-29.
- StampMitra pricing and billing rules, checked 2026-10-29.
Frequently asked questions
What does the e-Stamp order API do when I create an order?
It validates your stamp lines, prices each line afresh, debits the duty from the Stamp Duty Wallet and the service fee from the Service Fee Wallet, and writes an order that waits for human review. It does not place the order with the issuing vendor by itself.
Is the Idempotency-Key header required?
Yes, on POST /v1/estamp/orders only. Without it you get a 400. The same key with the same body replays the original response, and the same key with a different body returns 422 IDEMPOTENCY_KEY_REUSED, so a retry can never create a second order. A missing header is 400 IDEMPOTENCY_KEY_REQUIRED, and a second request while the first is still running is 409 IDEMPOTENCY_IN_PROGRESS with Retry-After.
How should I build an idempotency key?
Derive it from stable ids you own, such as the agreement id plus a version. Persist it before sending, resend the identical request after a timeout, and use a new key when you change the body, since reusing it returns 422 IDEMPOTENCY_KEY_REUSED.
Why is my new order PENDING_REVIEW and not a certificate?
Order creation stops at validation and review. A human operations reviewer confirms placement with the issuing vendor separately, so a new order starts in a pre-placement status and stamps and certificates appear only after placement.
Should I call validate before create?
Yes. POST /v1/estamp/orders/validate runs the same checks without saving or charging, and returns 200 for READY_TO_PLACE, WARNINGS or NEEDS_INFORMATION and 400 only for VALIDATION_FAILED. Use it to show problems while the user is still on the form.
Can one order contain stamps for different states?
No. One order is one state, and a body with lines in different states is rejected with a 400 listing the states found. Create one order per state, each with its own idempotency key.
What is the difference between id and orderId in the response?
id identifies the order in the order routes such as get, cancel and export. orderId is the Core order id that the parties route takes. Store both along with each stamps[].id and your clientReference values.
How do I cancel an e-stamp order?
POST /v1/estamp/orders/:id/cancel cancels directly before placement. After placement it sends a cancellation request that the vendor confirms later, and a completed order returns 409 INVALID_STATE. Do not mark your record cancelled until the platform's record says so.
What if my create request times out?
Retry the identical request with the same Idempotency-Key. You either receive the original response or the order is created now, never two. If outcomes stay unknown, list your orders and look for your reference before deciding.
What do I get when my wallet is short?
A 402 PAYMENT_REQUIRED whose message says whether the Stamp Duty Wallet or the Service Fee Wallet is short. Nothing is created or charged. Top up that wallet and retry with the same key.
Should I use POST /v1/orders for stamping?
No. The generic order route has no typed state, article or denomination fields, no validate route, no multi-line support and an optional idempotency key. The e-Stamp order routes exist because stamping needs all of those.
Can a multi-line order cost more than the sum of its parts?
It can differ where pricing depends on the number of papers in an order, because each line is priced with the whole order's paper count in mind. Treat the sum of single quotes as an estimate and the order's pricing as the figure that counts.