> 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/remote-key-storage/api-specification.md).

# API Specification

Remote Key Storage follows the CCA **eSign Remote API 1.1**. ASP-facing operations:

| # | Operation                | Transport                   | Payload                                |
| - | ------------------------ | --------------------------- | -------------------------------------- |
| 1 | Certificate enrolment    | HTTPS browser redirect      | `txnreq` / `txnresp` (form-urlencoded) |
| 2 | Initiate eSign           | HTTPS API (POST)            | Signed `<Esign>` XML                   |
| 3 | User authentication page | HTTPS browser redirect      | `txnref` = Base64(\`txn                |
| 4 | Response                 | HTTPS POST to `responseUrl` | Signed `<EsignResp>` XML               |
| 5 | Check signing status     | HTTPS API                   | Signed `<EsignStatus>` XML             |

## Initiate eSign — `<Esign>`

```xml
<Esign ver="1.0" signerid="rkumar" ts="2026-10-12T10:15:30" txn="ASP-RKS-000789"
       maxWaitPeriod="30" aspId="ASPXXXX0001"
       responseUrl="https://asp.example.com/rks/callback"
       redirectUrl="https://asp.example.com/rks/done">
  <Docs>
    <InputHash id="1" hashAlgorithm="SHA256" docInfo="Form AOC-4"
               docUrl="https://asp.example.com/d/1" responseSigType="PKCS7pdf">…hex…</InputHash>
    <!-- up to id="10" -->
  </Docs>
  <Signature>…</Signature>
</Esign>
```

| Attribute               | Required | Description                                   |
| ----------------------- | -------- | --------------------------------------------- |
| `ver`                   | Yes      | API version                                   |
| `signerid` / `username` | No       | Subscriber KYC username                       |
| `ts`                    | Yes      | ISO 8601, IST, ±30 minutes                    |
| `txn`                   | Yes      | Unique per ASP–ESP pair per day               |
| `maxWaitPeriod`         | Yes      | Minutes (default 1440)                        |
| `aspId`                 | Yes      | ASP ID                                        |
| `responseUrl`           | Yes      | Final result delivered here (background POST) |
| `redirectUrl`           | No       | Browser return URL                            |

`InputHash` attributes are the same as eSign v3 (`id` 1–10, `SHA256`, `docInfo` ≤ 50 chars, `docUrl`, `responseSigType`).

## Response and status

`<EsignResp>` and `<EsignStatus>` follow the eSign API 3.3 structure — `status` 1 / 0 / 2, constant `resCode`, `UserX509Certificate`, `DocSignature` per hash and an eMudhra XML signature. Status data is retained for at least 30 days.

{% hint style="warning" %}
**Review before publishing:** the CCA document shows `ver="1.0"` on `<Esign>` and `ver="3.3"` on `<EsignResp>`/`<EsignStatus>`, and uses both `signerid` and `username`. Confirm the exact values eMudhra's KMS expects.
{% endhint %}
