---
title: "Create DigiLocker URL API Reference"
description: "Generate a DigiLocker redirect URL to initiate consent-based Aadhaar document retrieval."
canonical: "https://eps.eko.in/docs/digilocker-create-url"
---


> **Canonical URL:** https://eps.eko.in/docs/digilocker-create-url
> This is a machine-readable Markdown version of the page for AI agents and LLMs. The primary (HTML) version lives at the canonical URL above.

# Create DigiLocker URL API Reference

`POST https://staging.eko.in/ekoapi/v3/tools/kyc/digilocker`

Generate a DigiLocker redirect URL to initiate consent-based Aadhaar document retrieval.

Creates a one-time DigiLocker URL that redirects the customer to the DigiLocker portal for consent-based retrieval of Aadhaar (and other) documents. After the customer authorises access on DigiLocker, they are redirected back to the provided `redirect_url`. The `reference_id` returned is then used to fetch the verified document data via the Get DigiLocker Document API.

> View product & pricing details: [DigiLocker Integration](https://eps.eko.in/products/digilocker-api.md)

## Body parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| initiator_id | string | yes | Registered mobile number of the API user (see Platform Credentials). e.g. 9962981729 |
| user_code | string | yes | User code of the retailer/agent the service is run for. e.g. 20810200 |
| client_ref_id | string | no | Unique reference id per API call, generated by your system. e.g. REQ-20260101-001 |
| document_requested | array | yes | List of document types requested for verification. Defaults to ["AADHAAR"]. e.g. AADHAAR |
| redirect_url | string | yes | The URL to redirect the customer back to after completing the DigiLocker authorisation journey. e.g. https://yourapp.com/kyc/callback |

## Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| developer_key | string | yes | Static API key issued to your account after KYC. |
| secret-key | string | yes | Dynamic per-request signature: base64(HMAC-SHA256(timestamp, base64(access_key))). |
| secret-key-timestamp | string | yes | Current time in milliseconds since UNIX epoch, used to compute secret-key. Must match server time. |
| content-type | string | yes | application/json e.g. application/json |

## Response

⭐ marks fields highlighted as verifiable.

| Field | Type | Description |
| --- | --- | --- |
| status | number | Primary success indicator (0 = success). |
| message | string | Human-readable response / error message. |
| response_status_id | number | Granular status id; see the shared error-codes table. |
| response_type_id | number | A unique id for every possible response shape (success or error) — useful for client logic branching and analytics. |
| data | object | API-specific response payload. |
| data.reference_id ⭐ | number | Unique reference ID for this DigiLocker session. Store this to call Get DigiLocker Document after the customer completes the DigiLocker journey. |
| data.url ⭐ | string | DigiLocker redirect URL. Present this URL to the customer to begin document authorisation. |
| data.document_requested | array | Echo of the document types requested. |
| data.redirect_url | string | The callback URL provided in the request. |

## Example request

```json
{
  "initiator_id": "9962981729",
  "user_code": "20810200",
  "client_ref_id": "REQ-20260101-001",
  "document_requested": [
    "AADHAAR"
  ],
  "redirect_url": "https://yourapp.com/kyc/callback"
}
```

## Example response

```json
{
  "status": 0,
  "response_status_id": 0,
  "message": "DigiLocker URL created successfully",
  "response_type_id": 1388,
  "data": {
    "reference_id": 7483920,
    "url": "https://digilocker.gov.in/auth?session_id=abc123xyz",
    "document_requested": [
      "AADHAAR"
    ],
    "redirect_url": "https://yourapp.com/kyc/callback"
  }
}
```

## Error scenarios

| Status | Scenario |
| --- | --- |
| 200 | Invalid redirect_url format |
