Skip to content

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

POSThttps://gateway.staging.finsour.io/v1/identity/digilocker-consent

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

Scheme API key travels in the X-Api-Key header

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

Content type application/json

Headers

NameTypeRequiredDescriptionConstraints
Idempotency-KeystringRequiredA 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

NameTypeRequiredDescriptionConstraints
inputobjectRequiredThe details to check.—
input.redirectUrlstringRequiredWhere 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.documentsarray of stringsRequiredWhat the person is asked to share: one or two of PAN and DRIVING_LICENCE, each at most once.1 to 2 items
optionsobjectOptionalSettings for this call.—
options.referencestringOptionalYour own reference for this call. It comes back unchanged as meta.reference.1 to 128 characters
options.consentobjectOptionalThe person's consent to this check.—
options.consent.obtainedbooleanRequiredSend true once the person has agreed to the check.Always true
options.consent.atstring (date-time)RequiredWhen the person gave consent.—
options.consent.purposestringRequiredWhat 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

Status 200 · content type application/json

NameTypePresentDescriptionConstraints
dataobjectAlwaysThe result of the check.—
data.sessionIdstringAlways—Matches ^dls_[0-9A-HJKMNP-TV-Z]{26}$
data.consentUrlstringAlwaysSend 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.expiresAtstringAlwaysWhen 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

CodeStatusMeaningRetrying
API_VERSION_UNSUPPORTED400That API version is no longer supported.Do not retry automatically
IDEMPOTENCY_KEY_INVALID400That Idempotency-Key does not meet the required format.Do not retry automatically
IDEMPOTENCY_KEY_REQUIRED400An Idempotency-Key header is required for this request.Do not retry automatically
REQUEST_MALFORMED400The request could not be parsed.Do not retry automatically
AUTH_KEY_EXPIRED401The API key is not valid.Do not retry automatically
AUTH_KEY_INVALID401The API key is not valid.Do not retry automatically
AUTH_KEY_MISSING401No API key was presented.Do not retry automatically
AUTH_KEY_REVOKED401The API key is not valid.Do not retry automatically
INSUFFICIENT_BALANCE402The available balance is not enough for this request.Do not retry automatically
AUTH_IP_NOT_ALLOWED403This API key may not be used from this address.Do not retry automatically
ENTITLEMENT_MISSING403This organization is not entitled to that product in this environment.Do not retry automatically
ORGANIZATION_SUSPENDED403This organization is not active.Do not retry automatically
PRODUCT_NOT_AVAILABLE403That product is not available.Do not retry automatically
PRODUCT_RETIRED403That product has been withdrawn.Do not retry automatically
SCOPE_INSUFFICIENT403This API key does not carry the scope this product requires.Do not retry automatically
DIGILOCKER_SESSION_NOT_FOUND404No open DigiLocker session has that id.Do not retry automatically
PRODUCT_NOT_FOUND404No such product.Do not retry automatically
DIGILOCKER_CONSENT_PENDING409The person has not yet given consent on DigiLocker.Safe to retry
DIGILOCKER_STEP_INVALID409The DigiLocker session is not at this step.Do not retry automatically
IDEMPOTENCY_KEY_REUSED409That idempotency key was already used for a different request.Do not retry automatically
PRICE_UNAVAILABLE409No active price covers this product right now.Safe to retry
REQUEST_IN_PROGRESS409An earlier attempt with this key is still running.Safe to retry
SETTLEMENT_PENDING409This request is awaiting reconciliation by an operator.Do not retry automatically
API_VERSION_SUNSET410That API version passed its announced sunset date.Do not retry automatically
REQUEST_TOO_LARGE413The request body is too large.Do not retry automatically
UNSUPPORTED_MEDIA_TYPE415That content type is not accepted on this route.Do not retry automatically
DIGILOCKER_CONSENT_DENIED422The person did not give consent on DigiLocker.Do not retry automatically
DIGILOCKER_DETAILS_MISMATCH422The details do not match the person's DigiLocker record.Do not retry automatically
DIGILOCKER_OTP_INVALID422The code was not accepted. Ask the person for the code they received and try again.Do not retry automatically
DIGILOCKER_SESSION_EXPIRED422The DigiLocker session has expired. Start a new session.Do not retry automatically
SANDBOX_FIXTURE_MISSING422No sandbox fixture exists for this input. Use a different test value.Do not retry automatically
UPSTREAM_REJECTED422The upstream source rejected the input.Do not retry automatically
VALIDATION_FAILED422The request payload is invalid.Do not retry automatically
CONCURRENCY_LIMIT429Too many simultaneous requests.Safe to retry
QUOTA_EXCEEDED429The allowance for this window is spent.Do not retry automatically
RATE_LIMITED429Too many requests.Safe to retry
INTERNAL_ERROR500An unexpected error occurred.Safe to retry
OUTCOME_UNCERTAIN502The outcome of this request is not yet known. Retry with the same Idempotency-Key.Do not retry automatically
UPSTREAM_UNAVAILABLE502The upstream source is unavailable. Retry shortly.Safe to retry
MAINTENANCE_MODE503The service is in a maintenance window.Safe to retry
NO_PROVIDER_AVAILABLE503No provider can serve this product right now.Safe to retry
SERVICE_OVERLOADED503The service is shedding load. Retry shortly.Safe to retry
UPSTREAM_TIMEOUT504The 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

ScopeLimitWindowAt the limit
Your API key, within your organisation's limitThe figure in X-RateLimit-LimitPer minute429 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

  1. Arrange access

    Tell us how DigiLocker fits your onboarding. We arrange access for your organization under the applicable service contract.

  2. 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.

  3. The person consents

    The person signs in to DigiLocker and consents, or enters the one-time code they received.

  4. 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.

  5. 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 .