StampMitraDevelopers
Livee-Stamp Paper APIStep 5 of 8

e-Stamp parties API: attach and correct party details on an order

Attach first/second party (and witness) details to an e-Stamp order.

POST/v1/estamp/orders/:orderId/partiesScope estamp.parties.writeAPI fee ₹5 per call
curl -X POST "https://api-b2b.stampmitra.in/v1/estamp/orders/:orderId/parties" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customerName": "Rahul Kumar",
    "customerMobile": "+919876543210",
    "customerEmail": "[email protected]"
  }'

An e-stamp has names on it, and the names have to be right. Ask three people on a product team where party details go in an e-Stamp integration and you will get three answers: on the stamp line, on the parties route, or in the agreement itself. All three are partly right, and the confusion is the main source of rejected orders and of corrections nobody can explain afterwards. This page sorts it out. It explains what the parties route does, what it deliberately does not, how it relates to the party fields on the order, how state requirements change what you collect, how to treat the personal data involved, and how to build a clean correction flow. It is step five of the eight-step e-Stamp flow.

A heads-up that saves time: the route is smaller and more specific than its name suggests. It does not model every person in your agreement. It corrects the contact details held for an order, during the review stage, and it has a few behaviours that surprise people who assume otherwise. Those behaviours are verified here and called out where they matter.

Three places party data lives

Keep these separate in your head and in your database.

PlaceWhat it holdsWhen you provide it
The stamp line on the orderThe names of the first party and second party, who pays the duty, and related fieldsAt order creation, in POST /v1/estamp/orders
The parties routeContact details held for the order: name, mobile, email, address and PAN text, corrected by youAfter the order exists, to attach or correct
Your own agreement and workflowEveryone who signs, including witnesses, signatories and authorised representativesIn your product, never sent to the stamp API

The stamp line is what the order is validated and placed on. The parties route is a correction channel for contact-level details tied to the order record. Your agreement is yours: the stamping API has no concept of witnesses or of more than two named parties, and that is deliberate.

The route at a glance

POST /v1/estamp/orders/:orderId/parties attaches or corrects party details on an existing e-Stamp order.

PropertyValue
Scopeestamp.parties.write
Rate limit30 requests per 60 seconds
MeteredYes. Each successful call carries StampMitra's API fee, charged to your API credit wallet
Path parameterorderId, the Core order id
BodyAny of customerName, partyName, customerMobile, customerEmail, partyAddress, partyPan, all optional strings
Idempotency keyNot used on this route

The base URL is https://api-b2b.stampmitra.in. On the order creation response you will find both an id and an orderId. This route takes the orderId field, the Core order id. Check this in your first sandbox response rather than assuming, and store both identifiers.

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

curl -s -X POST "$BASE/v1/estamp/orders/6a0e2b9a-5f1d-4c63-9c2e-0d4e7b1f3a55/parties" \
  -H "Authorization: Bearer $STAMPMITRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "customerName": "Anita Rao", "customerMobile": "+919800000001", "customerEmail": "[email protected]", "partyAddress": "Flat 4B, Example Heights, Pune" }'

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.
orderIdrequiredpathThe e-Stamp order id.
customerNamestringCustomer's full name.
partyNamestringCounter-party's full name.
customerMobilestringCustomer's mobile number.
customerEmailstringCustomer's email address.
partyAddressstringParty's address.
partyPanstringParty's PAN.

What the call actually does

It helps to know what happens behind the route, because the behaviour explains the rules about when to call it.

  1. It finds the order's active procurement request. The route acts on the request that was created when you placed the order. If there is none that is still active, for example because the order was cancelled, the call is refused with a message that the operation does not apply to this order.
  2. It records your values as corrections. The values you send are stored on the request's party record, marked as coming from a correction rather than from the original prefill, and a timeline entry notes which fields were changed.
  3. It mirrors some values to linked records. The name, mobile number, email and address are also written to the customer and address records that the order points to, so the order and its customer record do not drift apart. The PAN text is stored only on the request's party record. It is not written to any identity or KYC record.
  4. It re-validates when that makes sense. If the order is in NEEDS_INFORMATION, VALIDATION_FAILED or WARNINGS, the platform runs validation again straight after your correction. In any other state, the values are saved but no re-validation is attempted.
  5. It returns the stored party data. The response is the updated party record.

Two practical consequences follow. First, the best moment to call the route is when the order is waiting for information or has failed validation, because that is when a correction can change the outcome. Second, treat a correction after placement as a record-keeping action, not a way to change a stamp that is already being generated.

One party, not two: the `partyName` surprise

The route models a single party. customerName and partyName both write the same underlying name. If you send both, customerName wins. This means partyName does not set a counter-party. A product that sends the first party as customerName and the second party as partyName will find that the second name is ignored, which is a classic source of "I corrected it but nothing changed".

The right way to name the second party is on the stamp line, as secondParty, when you create the order. If the second party's name was wrong at creation and the order has not moved on, the practical route is to cancel the order, which is possible before it has been placed, and create it again with the right stamp line, using a new idempotency key because the body has changed. Do not try to correct a second party through this route.

You want to changeUse
The first party's contact name, mobile, email or address on the order recordThe parties route
The PAN text held against the orderThe parties route, partyPan
The second party's nameCancel and recreate the order with a corrected stamp line
Who pays the duty, the purpose, the property areaCancel and recreate the order
A witness or additional signatoryYour own agreement workflow

The fields, one by one

FieldTypeWhere it landsNotes
customerNamestringThe party record and the linked customer recordWins if partyName is also sent
partyNamestringThe same name field as customerNameAn alias, not a second party
customerMobilestringThe party record and the linked customer recordSend in a consistent format, with country code
customerEmailstringThe party record and the linked customer recordUsed for communication about the order
partyAddressstringThe party record and the order's primary address lineA single flattened string; city, state and postal code on the address are not rewritten
partyPanstringThe party record onlyText only; not written to KYC records

Every field is optional, but an empty body does nothing useful. Send the fields you mean to set, and do not send fields you do not want to change. Whether a field you omit is left as it is or cleared is not documented as a guarantee, so for corrections send the complete set of values you want recorded rather than relying on partial updates.

The party fields on the stamp line

The stamp line, covered in the order creation page, is where parties are first named.

FieldRequiredMeaning
firstPartyYesThe first party to the instrument
secondPartyNoThe second party, where the article uses one. Not applicable for articles flagged isSecondPartyNA
stampDutyPayerNoWho pays the duty
payerPhoneNoThe payer's phone number
payerGenderNoMALE, FEMALE or OTHER
purposeNoThe nature of the instrument, for example a rental agreement

A contract note belongs here. The public order contract currently takes firstParty and secondParty as plain names. The issuing side models a party as an object with a name and optional address, phone, fatherHusbandName and gender. Those optional properties are exactly what the state flags firstPartyAddressRequired and fatherHusbandNameRequired ask for. If a state requires them, validate a sample order in sandbox, see what the validation says, and ask developer support which form your account should use. Keep the accepted shape as a fixture so that a change shows up in your tests.

State requirements that change what you collect

The state detail from the lookup step tells you which extra party details a state wants.

State flagWhat it means for party data
firstPartyAddressRequiredThe first party's address is needed
fatherHusbandNameRequiredThe state asks for a father's or husband's name for the first party
panCardImageRequiredThe state wants an image of the PAN card
propertyAreaRequiredThe stamp line needs a property area
sroRequiredDistrict and SRO must accompany the order

A null on any of the first three means "not known". Collect the minimum, rely on the validation response, and be ready to ask the user for more. The API has no route for uploading a PAN card image. If a state requires one, the review stage will ask for it and you should work with developer support to route it, rather than inventing an upload in your own product that the platform does not read.

The honest design is a form that collects what the flags say, then validates early. Run POST /v1/estamp/orders/validate before creating the order, so that missing party information shows up as a NEEDS_INFORMATION result with a message while the user is still on the screen, instead of as a pending order days later.

Who counts as a party

Whether someone is a party to an instrument is a legal question. In general terms, a party is a person or entity whose rights or obligations the document creates or changes. The stamp line names the first party and, where the article uses one, the second party. Some practical points follow, and none of them is legal advice.

  • Individuals. Use the name as it appears on the identity document the person will use elsewhere in the transaction. Initials, honorifics and spelling variants cause mismatches that surface later.
  • Companies and other entities. Use the registered name of the entity, not a brand or the signatory's name. If you verify the entity first, the GSTIN verification response gives you the registered name to copy.
  • Proprietorships and partnerships. The legal form decides who the party is. If you are unsure, ask counsel instead of guessing in code.
  • Signing on someone's behalf. An authorised representative signs for the party, but the party named on the stamp is generally the principal. The authority belongs in your agreement workflow.
  • More than two persons. The stamp line names two. Additional co-owners, co-tenants or guarantors are described in the agreement text; whether the article or the state needs them named on the stamp is a question for counsel.

When your product is uncertain, say so to the user and offer help from a person. A confident wrong name is worse than a question.

Names: normalisation and transliteration

Names are where small inconsistencies turn into large corrections. A few habits reduce them.

  1. Collect the name as one field per party, in the form it appears on the identity document, not split across first, middle and last unless your own records need that.
  2. Trim and collapse whitespace. Remove leading and trailing spaces and double spaces, and nothing else.
  3. Do not change case on the user's behalf in a way that alters meaning. Display as typed; if you must normalise for comparison, do it on a copy.
  4. Be explicit about script. If the identity document is in a regional script and the transliteration in English is what appears on the stamp, show the user the English form and ask them to confirm it.
  5. Keep the original and the submitted value. If a correction is needed later, you can see what the user entered and what you sent.

Do not strip honorifics or initials unless the user has agreed. The person who reads the certificate will compare it with the signature and the identity documents.

Verify before you stamp

Because the stamping API does not check identity, it is common to verify the parties first with the platform's verification APIs, which use the same key and the same conventions.

You holdCheckAPI
An individual's PANThe PAN exists, its status, and a name matchPAN verification
A company's GSTINThe registration, its status and the registered nameGSTIN verification

A verified name is the best input for firstParty or secondParty, since it removes spelling disagreements. Remember what a verification proves and what it does not: it shows that a number and a name agree with a record, not that the person in front of you owns it. The PAN guide and the GSTIN guide go deeper. Under the service terms, StampMitra does not determine legal identity or the contractual relationship between parties unless a verification service expressly does so.

Matching names after verification

Verification and stamping can disagree about a name without either being wrong. A PAN record may hold a name in capitals with the surname first, while the person signs with initials. Decide your rule in advance and apply it the same way every time.

  1. Treat the verified registered name as the canonical text for the stamp line when the user agrees to it.
  2. If the name-match score is low or the verdict is a mismatch, do not guess. Show the user both forms and let them choose, or send the case to a reviewer.
  3. Store the verification reference next to the party row, so that anyone reading the order later can see where the name came from.
  4. Never let a mismatch silently pass because stamping is the next step on the screen. A wrong name on a stamp is a correction at best and a new order at worst.

Verification calls are billed separately from stamping calls, so decide whether the check belongs before the quote, which spends a little earlier, or just before order creation, which spends only on orders that are going ahead. Most products verify when the user submits the party details and stamp only after the check passes.

When to call the route

The right moment depends on the order's status, which you read from GET /v1/estamp/orders/:id.

Order statusWhat the route doesAdvice
NEEDS_INFORMATIONSaves your correction and re-validatesThe ideal moment to send missing details
VALIDATION_FAILEDSaves and re-validatesCorrect the cause named in the message
WARNINGSSaves and re-validatesUse it if a warning is about party data
PENDING_REVIEW, READY_TO_PLACESaves, no automatic re-validationUse sparingly, since a reviewer may already be looking at the order
Placed or laterSaves, no re-validationTreat as record-keeping, not as a way to change the stamp
CANCELLEDRefused, since there is no active requestCreate a new order instead

Each successful call is charged, so do not call on every keystroke or on every blur event. Collect the corrections, show a review screen, and send them once. Because the route does not use an idempotency key, a timeout leaves you unsure whether the call was processed. A second identical call is harmless to the data, because it writes the same values, but it can be charged again, so retry only on clear transport failures and with backoff.

A clean correction flow in code

JavaScript
// Node 18+; server side only
const BASE = "https://api-b2b.stampmitra.in";
const headers = { Authorization: `Bearer ${process.env.STAMPMITRA_API_KEY}`, "Content-Type": "application/json" };

const CORRECTABLE = new Set(["NEEDS_INFORMATION", "VALIDATION_FAILED", "WARNINGS"]);

export async function correctParties({ orderId, coreOrderId, fields }) {
  // 1. Read the order so we only auto-correct when it can change the outcome
  const orderRes = await fetch(`${BASE}/v1/estamp/orders/${orderId}`, { headers });
  const order = await orderRes.json();
  if (!orderRes.ok) throw Object.assign(new Error(order.error?.message), { status: orderRes.status, requestId: order.error?.requestId });
  if (order.status === "CANCELLED") return { applied: false, reason: "order-cancelled" };

  // 2. Send the complete set of values we want recorded, as strings, with no empty values
  const body = Object.fromEntries(Object.entries(fields).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
  const res = await fetch(`${BASE}/v1/estamp/orders/${coreOrderId}/parties`, { method: "POST", headers, body: JSON.stringify(body) });
  const out = await res.json();
  if (res.status === 429) return { applied: false, reason: "rate-limited" };
  if (!res.ok) throw Object.assign(new Error(out.error?.message), { status: res.status, requestId: out.error?.requestId });

  return { applied: true, revalidated: CORRECTABLE.has(order.status), stored: out };
}
Python
import os, requests

BASE = "https://api-b2b.stampmitra.in"
H = {"Authorization": f"Bearer {os.environ['STAMPMITRA_API_KEY']}"}
ALLOWED = {"customerName", "customerMobile", "customerEmail", "partyAddress", "partyPan"}

def correct_parties(core_order_id: str, fields: dict) -> dict:
    body = {k: v.strip() for k, v in fields.items() if k in ALLOWED and isinstance(v, str) and v.strip()}
    if not body:
        return {"applied": False, "reason": "nothing to send"}
    r = requests.post(f"{BASE}/v1/estamp/orders/{core_order_id}/parties", json=body, headers=H, timeout=20)
    data = r.json()
    if r.status_code == 429:
        return {"applied": False, "reason": "rate-limited"}
    if not r.ok:
        err = data["error"]
        raise RuntimeError(f"{r.status_code} {err['code']} {err['message']} req={err['requestId']}")
    return {"applied": True, "stored": data}

Notice the order of operations: read the order status first, then send the full set of values, then log what changed without logging values. The code never sends partyName, since it would only duplicate customerName.

Edge cases worth designing for

Real parties do not arrive as tidy records. A short list of cases, each routed to a person instead of resolved in code, will save you from the worst surprises. None of this is legal advice.

  • A name that changed. A party's name may differ between identity documents after marriage, a legal name change or a spelling correction. Ask which name the document should carry, and keep a note of what was chosen and why.
  • A party outside India. Overseas addresses and foreign phone numbers may not fit the formats your form expects. Allow them, mark the record for review, and expect the reviewer to ask questions.
  • An entity that has changed form. Companies convert, merge and rename. Use the name currently registered, and verify it rather than copying an old document.
  • A deceased party or an estate. Someone acting for a person who has died is a matter for counsel before it is a matter for your form.
  • A minor or a person who needs a representative. Who signs and in what capacity is a legal question. Offer a way to flag it and hand over to a human.
  • Joint owners and co-tenants. The stamp line names two parties. How the agreement treats additional persons is a drafting question, and whether the state needs them on the stamp is for counsel.
  • A party who is also the payer, or is not. stampDutyPayer exists for the case where the person paying the duty is not the first party. Collect it explicitly instead of assuming.

The pattern is the same each time: a clear flag in your form, a record of what the user said, and a person who decides.

Running the `NEEDS_INFORMATION` queue

If your product creates many orders, some will come back asking for more. Treat that queue as an operations process with an owner, not as an occasional surprise.

  1. Detect early. A job lists orders in NEEDS_INFORMATION, VALIDATION_FAILED and WARNINGS every few minutes, and creates one task per order if none is open.
  2. Read the message. The status comes with errors and warnings that say which field is the problem. Copy them onto the task, with the requestId of the read.
  3. Ask the user once. Send a clear, specific request: which detail, why it is needed, and how to provide it. Avoid asking for everything again.
  4. Apply the correction once. When the user replies, apply it through the correction function and add a note to the task. Do not retry blindly on a timeout; read the order again first.
  5. Close or escalate. If the order moves to READY_TO_PLACE, close the task. If the same message comes back, escalate to developer support with the order references and the messages.
  6. Measure. Track how many orders need information, which fields are missed most often, and how long the loop takes. The most-missed field is a form bug.

A useful target is to make this queue shrink over time. Each recurring cause points at a question your form should have asked earlier.

Errors and how to react

All errors use { "error": { "code", "message", "requestId" } }. The code is derived from the HTTP status.

StatusCodeWhenWhat to do
400BAD_REQUESTThe organisation is not entitled to e-Stamp, a field fails validation, or the order has no active requestRead the message, and check entitlement and the order's status
401UNAUTHORIZEDMissing or invalid keyFix the key
402PAYMENT_REQUIREDThe API credit wallet cannot cover the callTop up and retry
403FORBIDDENValid key without estamp.parties.writeAdd the scope
404NOT_FOUNDNo such order for your organisationCheck the id: use orderId, not id
429TOO_MANY_REQUESTSMore than 30 requests in 60 secondsBack off
502INTERNAL_ERRORUpstream unreachableRetry with backoff; the call may or may not have been processed

A 400 for an order with no active request is the one that surprises people. It usually means the order was cancelled or is otherwise no longer open. Read the order's status before you decide what to do next.

Sandbox and production

Parties attach to sandbox orders. A sandbox key accepts the same body, stores the party fields against the sandbox order you name and returns them, so you can build and test your correction flow end to end. Send the orderId from a sandbox order you created (the id starts with estord_sbx_). Calling the route a second time merges the new fields into the stored ones.

Situation in sandboxResult
An open sandbox order200 with the stored party data
An order id that does not exist for your organisation404, the same as production
An order that has already finished (ISSUED, failed, cancelled or expired)409, because there is nothing left to correct
A body with an unknown field or a wrong type400, with the same message as production

Because a sandbox order finishes by itself in about thirty seconds, create the order and send the parties call straight away, and write a second test that expects the 409 once the order is ISSUED. Sandbox keys never debit your wallet. Production needs an approved production access request and a funded API credit wallet, and in production the parties call also triggers a fresh review of the order. The sandbox versus production guide covers the switch. The parties call 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).

Modelling parties in your database

A modest schema keeps corrections traceable.

TableColumns worth havingWhy
agreement_partyid, agreement_id, role (first, second, witness, signatory), legal_name, entity_type, verified_at, verification_refYour own record of everyone in the agreement, including those the stamp API never sees
stamp_order_party_snapshotorder_id, first_party_name, second_party_name, payer_name, submitted_atExactly what you sent on the stamp line
stamp_party_correctionorder_id, fields_changed (names only), corrected_by, corrected_at, request_idAn audit trail of corrections without storing values twice

Keep the snapshot immutable. If the first party changes later, that is a new order, not an edit of the snapshot. And keep roles in your table that the API does not know about, such as witnesses, so that your agreement workflow has somewhere to put them.

Worked example: a correction after a validation warning

A rental platform creates an order for a leave and licence agreement. The stamp line names the licensor as firstParty and the licensee as secondParty. The platform also validated the order first, so the result was clean.

After creation, the order shows NEEDS_INFORMATION with a message that the first party's address is required for the state. The platform had not collected it, because the state's firstPartyAddressRequired flag was null when the form was built. An operations person opens the order in the platform's admin screen, sees the message, and asks the landlord for the address.

The landlord replies. The operations person enters the address, and the admin screen calls the correction function with partyAddress and the existing contact details. The platform reads the order, sees NEEDS_INFORMATION, sends the full set of values, and records that the address field changed, without logging the address. The route saves the correction, mirrors it to the linked records and re-validates. The next read of the order shows READY_TO_PLACE.

Nothing in the flow touched the second party. When the licensee later notices a typo in their own name, the platform sees that the order is READY_TO_PLACE, cancels it before placement, and creates a new order with the corrected stamp line and a new idempotency key. The audit table shows the first order, the correction, the cancellation and the replacement, each with its requestId.

Testing

TestWhat it proves
Correction sent only when the order is NEEDS_INFORMATION, VALIDATION_FAILED or WARNINGSYou use the route when it can change the outcome
partyName is never sentYou avoid the alias trap
Empty strings are filtered outYou do not send blanks
A 400 for a cancelled order is handled as "create a new order"Your flow handles closed orders
A 429 returns a clear "try later" and no retry stormRate limits are respected
Logs contain field names but not valuesPersonal data stays out of logs
The second-party correction path cancels and recreatesYou do not try to edit the second party through this route

Common mistakes

  • Using partyName for the second party. It writes the same name as customerName.
  • Using id instead of orderId in the path. The route takes the Core order id.
  • Correcting a stamp that is already being generated. The route is for the review stage.
  • Sending corrections on every keystroke. Each success is charged.
  • Putting witnesses into the stamp order. They belong to your agreement workflow.
  • Logging party values. Log field names and the requestId only.
  • Skipping validation before creating the order. Missing details are cheaper to find early.
  • Inventing an upload for the PAN card image. The API has no such route; ask support.
  • Treating a verified number as proof of possession. A match shows consistency with a record, not ownership.

Where this fits in the flow

The parties route is step five of eight. Before it come the catalogue, the schema, the state, instrument and article lookup and the duty and value calculation. After it come the order, the payment and the order status and document access. In the reference timeline parties appear before the order, but because the route takes an order id you create the order first and then attach or correct. The overview guide shows all eight steps 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. Who is a party to your document, and what the stamp must say, are questions for you or your counsel.

Sources

Frequently asked questions

What does the e-Stamp parties route do?

It attaches or corrects the contact details held for an existing e-Stamp order: name, mobile, email, address and PAN text. The values are saved on the order's party record, mirrored to linked customer and address records, and re-validated when the order is waiting for information.

Which id goes in the path, id or orderId?

The orderId, which is the Core order id. The order creation response carries both an id and an orderId, and the parties route takes orderId. Confirm this in your first sandbox response and store both identifiers.

Does partyName set the second party?

No. The route models a single party, and partyName writes the same name as customerName, which wins if both are sent. Name the second party on the stamp line as secondParty, or cancel and recreate the order if it was wrong.

Does the API support witnesses?

No, and that is deliberate. Witnesses sign the agreement, not the stamp purchase. Keep witness details in your own agreement workflow and send only the first and second party to the stamp order.

When should I call the parties route?

When the order is in NEEDS_INFORMATION, VALIDATION_FAILED or WARNINGS, because the platform re-validates straight after the correction. In other states the values are saved without re-validation, and a cancelled order is refused.

Is the parties call charged?

Yes. It is a metered e-Stamp call, charged on success against your API credit wallet at the plan rate. Collect corrections on a review screen and send them once, since each successful call carries the API fee.

Is partyPan verified or used for KYC?

No. The PAN text is stored only on the order's party record and is not written to any identity or KYC record. To check a PAN, use the PAN verification API separately before stamping.

Can I upload a PAN card image through the API?

No such route exists. If a state's panCardImageRequired flag is true, the review stage will ask for it, and you should work with developer support to route it rather than building an upload the platform does not read.

What if I retry a timed-out parties call?

The route has no idempotency key. A repeated call writes the same values, so the data is safe, but it can be charged again. Retry only on clear transport failures, with backoff, and read the order first if unsure.

How do I handle personal data in party details?

Collect only what the state flags and validation require, record consent, keep values out of logs and analytics, restrict who can see them, set a retention period and use fake data in tests. Confirm obligations under the DPDP Act with counsel.

How do I correct the second party's name after the order exists?

Not through this route. If the order has not been placed, cancel it and create a new one with the corrected stamp line and a new Idempotency-Key, since the body has changed. Keep an audit entry of the replacement.

Build with AI

Integrate Parties 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 · Parties · 5,524 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 "Parties" API
Attach first/second party (and witness) details to an e-Stamp order.

ENDPOINT: POST /v1/estamp/orders/:orderId/parties
- Attach/correct e-Stamp order party (customer) details
- Required scope: estamp.parties.write
- Parameters:
  - orderId (path, required): The e-Stamp order id.
  - customerName (string, optional): Customer's full name.
  - partyName (string, optional): Counter-party's full name.
  - customerMobile (string, optional): Customer's mobile number.
  - customerEmail (string, optional): Customer's email address.
  - partyAddress (string, optional): Party's address.
  - partyPan (string, optional): Party's PAN.
- Example request body: {"customerName":"Rahul Kumar","customerMobile":"+919876543210","customerEmail":"[email protected]"}

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.