> For the complete documentation index, see [llms.txt](https://docs.emudhradigital.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emudhradigital.com/documentation/esign-v3-ca-ekyc-account/asynchronous-signing-flow.md).

# Asynchronous Signing Flow

eSign v3 is asynchronous: the ASP submits a request, receives an immediate acknowledgement, and gets the final result by callback (or by polling the status API).

## Sequence

```
ASP server                         eMudhra ESP                         Signer
   │ POST <Esign> (signed XML) ───────►│                                    │
   │◄── EsignResp status="2" (pending), resCode                             │
   │ redirect user (redirectUrl flow) or ask user to open eMudhra app ────►│
   │                                   │◄── username + PIN + 2nd factor ────│
   │                                   │    review docs (docInfo/docUrl),   │
   │                                   │    accept / unselect documents     │
   │                                   │ key pair → CSR → one-time DSC      │
   │                                   │ sign each hash, destroy key        │
   │◄── POST EsignResp status="1"/"0" to responseUrl (background)          │
   │                                   │── POST txnref to redirectUrl ─────►│ (browser returns to ASP)
   │ (optional) POST <EsignStatus> ───►│                                    │
   │◄── EsignResp (1 / 0 / 2) ─────────│                                    │
```

## Step by step

1. **Submit** — the ASP POSTs the signed `<Esign>` XML (up to 5 `InputHash` entries).
2. **Acknowledge** — eMudhra validates and returns `EsignResp` with `status="2"` and a `resCode`.
3. **Authenticate** — the signer is redirected (browser) or prompted in the eMudhra app. With browser redirection eMudhra posts `txnref = Base64(txn|resCode)` as form data to bring the user into the flow.
4. **Review** — the signer sees each document's `docInfo` and can open `docUrl`. Unselected documents return error `206` for that hash.
5. **Sign** — eMudhra issues a one-time DSC using the requested `signingAlgorithm` and signs each accepted hash.
6. **Callback** — the final `EsignResp` is POSTed (`application/xml`) to `responseUrl`. If `redirectUrl` was supplied, the browser is returned there.
7. **Reconcile** — if the callback is missed, call the status API with the same `txn`. Status is retained for at least 30 days.

## Expiry

If the signer does not complete within `maxWaitPeriod` minutes (default 1440 = 24 hours), the transaction fails with error `113` (user timeout).

## Implementation tips

* Make the `responseUrl` handler **idempotent** — the same `txn` may be delivered more than once or reconciled via status check.
* `resCode` is constant across all responses for a transaction — use it as your correlation key.
* `docUrl` must remain reachable for the whole wait period.
