DigiLocker Consent API
New
Open a consented DigiLocker session for a person, by a consent link or with a one-time code, so your application can read the documents they agree to share.
Overview
DigiLocker is the Government of India's platform for issued documents. A person's Aadhaar, PAN and driving licence can be held there, issued by the authority that issued the original. Reading a document from DigiLocker needs the person's consent first. They have to sign in to their own DigiLocker and agree to share it with you, and your application then reads it from the session that consent opened. The DigiLocker Consent API opens that session, in one of two ways: a consent link, where the person signs in on DigiLocker's own page and is sent back to yours, or a start call with their Aadhaar details followed by a one-time code. Either way, you get a session to read their documents from.
- Category
- KYC Services
- Coverage
- People with a DigiLocker account holding the documents you ask for
- Input
- Documents wanted and a return page; or the person's Aadhaar number, name, date of birth, gender and mobile, then a code
- Output
- A session reference with its expiry, and a consent link or whether a one-time code was sent
- Typical users
- Lenders and NBFCs, fintech platforms, insurers, brokerages, staffing and gig platforms
- Coverage note
- Only the documents the person holds in DigiLocker and agrees to share
The overview and the sections after the reference are the FinSour API catalog’s own record for this service, rendered unaltered.
Endpoint URL and method
Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.
Authentication
Send your API key in this header on every call, from your own server: a key sent from a browser is refused. A key starting fs_test_ calls the sandbox and one starting fs_live_ calls production, at the same address. Create keys in the FinSour console.
Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.
Request parameters
Headers
| Name | Type | Required | Description | Constraints |
|---|---|---|---|---|
Idempotency-Key | string | Required | A key you generate for each attempt. Sending the same key again returns the first answer instead of running the check twice; the same key with a different body is refused. | 8 to 255 characters. Matches ^[A-Za-z0-9._:-]+$ |
Body
| Name | Type | Required | Description | Constraints |
|---|---|---|---|---|
input | object | Required | The details to check. | — |
input. | string | Required | Where the person is sent after consenting: https://host[:port][/path][?query]. At most 2048 characters; no credentials, no fragment, no whitespace; the host is a name and not localhost or an IPv4 address. When the person comes back, consent=granted, consent=denied or consent=failed is added to this address's query and your own parameters are kept; nothing else is added, so carry your own reference in the query to know whose consent it was. In SANDBOX http://localhost[:port] and any https host name are accepted too. | Matches ^https:\/\/(?!(?:[\w-]+\.)*[Ll][Oo][Cc][Aa][Ll][Hh][Oo][Ss][Tt](?:[:/?]|$))(?!\d+(?:\.\d+){3}(?:[:/?]|$))\w[\w.-]*(?::(?:\d{1,4}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?(?:[/?][!"$-~]*)?$. At most 2048 characters |
input. | array of strings | Required | What the person is asked to share: one or two of PAN and DRIVING_LICENCE, each at most once. | 1 to 2 items |
options | object | Optional | Settings for this call. | — |
options. | string | Optional | Your own reference for this call. It comes back unchanged as meta.reference. | 1 to 128 characters |
options. | object | Optional | The person's consent to this check. | — |
options. | boolean | Required | Send true once the person has agreed to the check. | Always true |
options. | string (date-time) | Required | When the person gave consent. | — |
options. | string | Required | What the check is for, for example kyc. | 1 to 64 characters |
Request samples
cURL
curl -X POST https://gateway.staging.finsour.io/v1/identity/digilocker-consent \
-H "X-Api-Key: $FINSOUR_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"input": {
"redirectUrl": "<redirectUrl>",
"documents": "<documents>"
}
}'Node.js
const response = await fetch("https://gateway.staging.finsour.io/v1/identity/digilocker-consent", {
method: "POST",
headers: {
"X-Api-Key": process.env.FINSOUR_API_KEY,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": {
"redirectUrl": "<redirectUrl>",
"documents": "<documents>"
}
}),
});
console.log(response.status, await response.json());Python
import os
import uuid
import requests
response = requests.post(
"https://gateway.staging.finsour.io/v1/identity/digilocker-consent",
headers={
"X-Api-Key": os.environ["FINSOUR_API_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"input": {
"redirectUrl": "<redirectUrl>",
"documents": "<documents>",
},
},
timeout=30,
)
print(response.status_code, response.json())Generated from the fields above. Replace each value in angle brackets with your own; the key is read from FINSOUR_API_KEY.
Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.
Response schema
| Name | Type | Present | Description | Constraints |
|---|---|---|---|---|
data | object | Always | The result of the check. | — |
data. | string | Always | — | Matches ^dls_[0-9A-HJKMNP-TV-Z]{26}$ |
data. | string | Always | Send the person's browser here. A bearer link for one consent: do not log it or share it. | Matches ^https:\/\/\w[\w.-]*(?::\d{1,5})?(?:[/?][!"$-~]*)?$. At most 4096 characters |
data. | string | Always | When the session ends: the person's consent and your document calls all fall inside this one window. | Matches ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?Z$ |
Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.
Error codes
| Code | Status | Meaning | Retrying |
|---|---|---|---|
API_VERSION_UNSUPPORTED | 400 | That API version is no longer supported. | Do not retry automatically |
IDEMPOTENCY_KEY_INVALID | 400 | That Idempotency-Key does not meet the required format. | Do not retry automatically |
IDEMPOTENCY_KEY_REQUIRED | 400 | An Idempotency-Key header is required for this request. | Do not retry automatically |
REQUEST_MALFORMED | 400 | The request could not be parsed. | Do not retry automatically |
AUTH_KEY_EXPIRED | 401 | The API key is not valid. | Do not retry automatically |
AUTH_KEY_INVALID | 401 | The API key is not valid. | Do not retry automatically |
AUTH_KEY_MISSING | 401 | No API key was presented. | Do not retry automatically |
AUTH_KEY_REVOKED | 401 | The API key is not valid. | Do not retry automatically |
INSUFFICIENT_BALANCE | 402 | The available balance is not enough for this request. | Do not retry automatically |
AUTH_IP_NOT_ALLOWED | 403 | This API key may not be used from this address. | Do not retry automatically |
ENTITLEMENT_MISSING | 403 | This organization is not entitled to that product in this environment. | Do not retry automatically |
ORGANIZATION_SUSPENDED | 403 | This organization is not active. | Do not retry automatically |
PRODUCT_NOT_AVAILABLE | 403 | That product is not available. | Do not retry automatically |
PRODUCT_RETIRED | 403 | That product has been withdrawn. | Do not retry automatically |
SCOPE_INSUFFICIENT | 403 | This API key does not carry the scope this product requires. | Do not retry automatically |
DIGILOCKER_SESSION_NOT_FOUND | 404 | No open DigiLocker session has that id. | Do not retry automatically |
PRODUCT_NOT_FOUND | 404 | No such product. | Do not retry automatically |
DIGILOCKER_CONSENT_PENDING | 409 | The person has not yet given consent on DigiLocker. | Safe to retry |
DIGILOCKER_STEP_INVALID | 409 | The DigiLocker session is not at this step. | Do not retry automatically |
IDEMPOTENCY_KEY_REUSED | 409 | That idempotency key was already used for a different request. | Do not retry automatically |
PRICE_UNAVAILABLE | 409 | No active price covers this product right now. | Safe to retry |
REQUEST_IN_PROGRESS | 409 | An earlier attempt with this key is still running. | Safe to retry |
SETTLEMENT_PENDING | 409 | This request is awaiting reconciliation by an operator. | Do not retry automatically |
API_VERSION_SUNSET | 410 | That API version passed its announced sunset date. | Do not retry automatically |
REQUEST_TOO_LARGE | 413 | The request body is too large. | Do not retry automatically |
UNSUPPORTED_MEDIA_TYPE | 415 | That content type is not accepted on this route. | Do not retry automatically |
DIGILOCKER_CONSENT_DENIED | 422 | The person did not give consent on DigiLocker. | Do not retry automatically |
DIGILOCKER_DETAILS_MISMATCH | 422 | The details do not match the person's DigiLocker record. | Do not retry automatically |
DIGILOCKER_OTP_INVALID | 422 | The code was not accepted. Ask the person for the code they received and try again. | Do not retry automatically |
DIGILOCKER_SESSION_EXPIRED | 422 | The DigiLocker session has expired. Start a new session. | Do not retry automatically |
SANDBOX_FIXTURE_MISSING | 422 | No sandbox fixture exists for this input. Use a different test value. | Do not retry automatically |
UPSTREAM_REJECTED | 422 | The upstream source rejected the input. | Do not retry automatically |
VALIDATION_FAILED | 422 | The request payload is invalid. | Do not retry automatically |
CONCURRENCY_LIMIT | 429 | Too many simultaneous requests. | Safe to retry |
QUOTA_EXCEEDED | 429 | The allowance for this window is spent. | Do not retry automatically |
RATE_LIMITED | 429 | Too many requests. | Safe to retry |
INTERNAL_ERROR | 500 | An unexpected error occurred. | Safe to retry |
OUTCOME_UNCERTAIN | 502 | The outcome of this request is not yet known. Retry with the same Idempotency-Key. | Do not retry automatically |
UPSTREAM_UNAVAILABLE | 502 | The upstream source is unavailable. Retry shortly. | Safe to retry |
MAINTENANCE_MODE | 503 | The service is in a maintenance window. | Safe to retry |
NO_PROVIDER_AVAILABLE | 503 | No provider can serve this product right now. | Safe to retry |
SERVICE_OVERLOADED | 503 | The service is shedding load. Retry shortly. | Safe to retry |
UPSTREAM_TIMEOUT | 504 | The upstream source did not respond in time. | Safe to retry |
Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.
Rate limits
| Scope | Limit | Window | At the limit |
|---|---|---|---|
| Your API key, within your organisation's limit | The figure in X-RateLimit-Limit | Per minute | 429 RATE_LIMITED, with Retry-After in seconds. Every answer past authentication carries X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset. |
Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.
Use cases
- Lending: reading an applicant's PAN and driving licence with consent
- Gig and staffing: reading a driver's licence before the first shift
- Insurance and broking: completing KYC with issued documents
- Assisted onboarding: opening a session with Aadhaar details and a code
What this service does
Two ways to open a session
A consent link, where the person signs in on DigiLocker's own page and returns to yours, or a start call with their Aadhaar details followed by a one-time code.
Consent given on DigiLocker itself
The person sees which documents you asked for and agrees on DigiLocker, and your page is told whether consent was granted, denied or failed.
One session, several documents
Read every document the session covers while it is open, with the document APIs: PAN and driving licence from a consent link, Aadhaar and PAN from a code session.
A session that expires
Every session carries its expiry time. Once it ends, a new consent is needed, so no standing access is left behind.
How a check runs
Arrange access
Tell us how DigiLocker fits your onboarding. We arrange access for your organization under the applicable service contract.
Ask for a consent link, or start with Aadhaar details
Send the documents you want and your return page to get a consent link, or send the person's Aadhaar details to start a session.
The person consents
The person signs in to DigiLocker and consents, or enters the one-time code they received.
The session opens
Your page is told the outcome of the consent, or the confirmed code opens the session, and you hold the session reference.
Read the documents
Call the document APIs the session covers with the session reference while it is open.
Questions
- What is a DigiLocker session?
- It is the person's consent, held for a short time, that lets your application read the documents they agreed to share from their DigiLocker.
- Should I use the consent link or the start call?
- Use the consent link when your flow can send the person to DigiLocker and receive them back. Use the start call and code when the person gives their Aadhaar details in an assisted flow, and when you need their e-Aadhaar.
- Which documents can a consent link ask for?
- PAN and driving licence, one or both. The e-Aadhaar is read from a session opened with the start call and code.
- How do I know whose consent came back?
- Put your own reference in the return address of the link. When the person comes back, your page receives that address with the consent outcome added.
- What if the person declines?
- Your page is told consent was denied. Offer another way to complete KYC rather than ending the journey.
- How do I get access to the DigiLocker APIs?
- Start with Get API and tell us how DigiLocker fits your onboarding and what volumes you expect. We set up access under the applicable service contract.
Catalog entry last updated .