Digi Locker
2 endpoints · Core API
DigiLocker is a flagship initiative of Ministry of Electronics & IT (MeitY) under Digital India programme. DigiLocker aims at 'Digital Empowerment' of citizen by providing access to authentic digital documents to citizen's digital document wallet. DigiLocker is a secure cloud based platform for storage, sharing and verification of documents & certificates.
Benefits
DigiLocker offers users a safe platform for document access on a public cloud. It serves as a platform for the digital issuance and verification of documents and certificates, eliminating the need for paper copies. The issued documents that are accessible through DigiLocker are accepted the same as the original, physical documents.
Business use case — please read before integrating
Prefer the Aadhaar-based fetch flow over the mobile-number flow. Based on direct guidance from the DigiLocker team, the Aadhaar flow (using_aadhaar: true) is more reliable and has a higher success rate for fetching user data. Wherever possible, encourage your users to authenticate with Aadhaar rather than mobile number.
Why the mobile-number flow can fail: If a user's mobile number is registered with MeriPehchaan but their KYC details are not fully compliant or up to date in their DigiLocker account, the login/fetch can fail. In that case the user must first log in to their DigiLocker account, manually correct or complete the required KYC information, and then retry with the same mobile number.
Recommended best practice: For the smoothest experience and the highest fetch success rates, default your integration to the Aadhaar-based flow (using_aadhaar: true). If you do offer the mobile-number flow, handle failures gracefully — prompt the user to retry with Aadhaar, or guide them to log in to DigiLocker and complete their KYC before retrying.
Authentication flows
Aadhaar flow (using_aadhaar: true):
- User enters their Aadhaar number.
- User enters the OTP sent to the mobile number linked to that Aadhaar.
- User enters their DigiLocker PIN. (If forgotten, the user can choose "Forgot PIN" and reset it using their date of birth.)
- User gives consent, and the requested documents/details are fetched.
Mobile-number flow (using_aadhaar: false):
- The user can authenticate with their mobile number, or alternatively with their username, Aadhaar number, PAN, or Driving Licence.
- The only requirement is that the user already has a DigiLocker account set up.
Get digilocker request url details The credit is deducted from your wallet now, when the link is created, but this response shows `isBillable: false` because the charge is not final yet. It becomes final on the first document fetch (that response shows `isBillable: true`), where each additional document uses one more credit. If the link expires before the user completes it, the credit is refunded automatically.
Request parameters:
→ <b>docs (required):</b> Array of document type codes: ADHAR, PANCR, DRVLC, RVCER.
→ <b>webhookUrl (conditional):</b> Required unless a default webhook URL is configured for this API on your account.
→ <b>redirectUrl (optional):</b> Where to send the user after the DigiLocker process.
→ <b>mobileNumber (optional):</b> Used only when `using_aadhaar` is false.
→ <b>using_aadhaar (optional, default false):</b> Set true for the Aadhaar-based sign-in.
→ <b>consent (required, default "Y"):</b> Must be Y. A value of N is rejected.
→ <b>request_id (optional):</b> Your own unique ID to track this request. A UUID is generated if omitted.
Headers
- X-API-KEYstringrequiredYour secret API key for the environment you are calling (Stage and Live use different keys).
- X-API-APP-IDstringrequiredThe App ID issued together with the key.
- Content-Typestringrequiredapplication/json
Body parameters
application/json- consentstringrequiredRequired. The end user's consent to this verification. Send `Y`.minLength 1default Y
- consent_textstringrequiredRequired. The consent statement shown to the end user. Send the default text from the sample.minLength 1default I hear by declare my consent agreeme…
- request_idstringoptionalOptional. Your own id to correlate this call in your logs. A unique id is generated if you leave it out.nullable
- docsarray<string>requiredRequired. Array of DigiLocker document type codes to fetch: ADHAR (Aadhaar), PANCR (PAN card), DRVLC (driving licence), RVCER (vehicle registration).default ["ADHAR","PANCR"]
- webhookUrlstringconditionalConditional: required unless a default webhook URL is configured for this API on your account. HTTPS URL that receives the DigiLocker results. A value sent here overrides the account default.nullabledefault https://example.com/digilocker-webho…
- redirectUrlstringoptionalOptional. URL to redirect the user to after the DigiLocker process is completed.nullabledefault https://example.com/digilocker-done
- mobileNumberstringoptionalOptional. 10-digit mobile number of the user, used only when using_aadhaar is false. If no DigiLocker account exists for this number, the user is moved to the Aadhaar flow. Format is not validated.nullabledefault 9876543210
- using_aadhaarbooleanoptionalOptional. Defaults to false. Set true to have the user sign in with their Aadhaar number, an OTP and their DigiLocker PIN. Recommended for the highest fetch success rate.default false
Sample request body
Responses
200OK
- successbooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 200
- messagestringoptionalNo description.nullabledefault XXXXX
- dataobjectoptionalResponse model returned after initiating a DigiLocker session.
4 fields
- request_urlstringoptionalURL to redirect the user for DigiLocker authorization.nullable
- request_timestampstring (date-time)optionalTimestamp when the request was created.
- expires_atstring (date-time)optionalExpiration timestamp for the DigiLocker session URL.
- transection_IdstringoptionalUnique transaction identifier for tracking the DigiLocker session.nullable
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- isBillablebooleanoptionalWhether this request was charged: true if it was, false if not. Errors always show false. Flows that finish later (ITR Fetch, SHCIL eStamp, DigiLocker, eSign) show false here, because the charge is made when the result is ready. eSign charges each signer when they complete signing. DigiLocker deducts the credit when the link is created and refunds it automatically if the link expires before the user completes it.
400Bad Request
- dataobjectoptionalNo description.
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- successbooleanoptionalNo description.default false
- messagestringoptionalNo description.nullabledefault XXXXX
- isBillablebooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 400
401Unauthorized
- dataobjectoptionalNo description.
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- successbooleanoptionalNo description.default false
- messagestringoptionalNo description.nullabledefault XXXXX
- isBillablebooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 401
500Internal Server Error
- dataobjectoptionalNo description.
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- successbooleanoptionalNo description.default false
- messagestringoptionalNo description.nullabledefault XXXXX
- isBillablebooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 500
Code samplescurl · Node.js · Python
Get digilocker document details by transactionId. Returns exactly the same response structure as the Digilocker webhook. If the data is older than 30 days, it returns a response indicating it is permanently deleted. For the Aadhaar (ADHAR) document, DataXml contains the raw eAadhaar XML alongside the parsed Details.
Headers
- X-API-KEYstringrequiredYour secret API key for the environment you are calling (Stage and Live use different keys).
- X-API-APP-IDstringrequiredThe App ID issued together with the key.
Path parameters
- transactionIdstringrequiredRequired. The `transection_Id` value returned by the init call.
Responses
200OK
- successbooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 200
- messagestringoptionalNo description.nullabledefault XXXXX
- dataobjectoptionalNo description.
2 fields
- transactionIdstringoptionalNo description.nullable
- docsarray<object>optionalNo description.nullable
Each item: 7 fields
- issuedobjectoptionalNo description.
11 fields
- namestringoptionalNo description.nullable
- typestringoptionalNo description.nullable
- sizestringoptionalNo description.nullable
- datestringoptionalNo description.nullable
- parentstringoptionalNo description.nullable
- mimearray<string>optionalNo description.nullable
- uristringoptionalNo description.nullable
- doctypestringoptionalNo description.nullable
- descriptionstringoptionalNo description.nullable
- issuerIdstringoptionalNo description.nullable
- issuerstringoptionalNo description.nullable
- docTypestringoptionalNo description.nullable
- statusstringoptionalNo description.nullable
- fetchedAtstring (date-time)optionalNo description.nullable
- dataPdfstringoptionalNo description.nullable
- dataXmlstringoptionalNo description.nullable
- detailsobjectoptionalNo description.
15 fields
- namestringoptionalNo description.nullable
- dobstringoptionalNo description.nullable
- genderstringoptionalNo description.nullable
- costringoptionalNo description.nullable
- addressstringoptionalNo description.nullable
- villagestringoptionalNo description.nullable
- subDistrictstringoptionalNo description.nullable
- districtstringoptionalNo description.nullable
- statestringoptionalNo description.nullable
- countrystringoptionalNo description.nullable
- pinCodestringoptionalNo description.nullable
- aadhaarNumberstringoptionalNo description.nullable
- kycDateTimestringoptionalNo description.nullable
- photostringoptionalNo description.nullable
- addressDetailsobjectoptionalNo description.
3 fields
- addressLine1stringoptionalNo description.nullable
- addressLine2stringoptionalNo description.nullable
- addressLine3stringoptionalNo description.nullable
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- isBillablebooleanoptionalWhether this request was charged: true if it was, false if not. Errors always show false. Flows that finish later (ITR Fetch, SHCIL eStamp, DigiLocker, eSign) show false here, because the charge is made when the result is ready. eSign charges each signer when they complete signing. DigiLocker deducts the credit when the link is created and refunds it automatically if the link expires before the user completes it.
400Bad Request
- dataobjectoptionalNo description.
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- successbooleanoptionalNo description.default false
- messagestringoptionalNo description.nullabledefault XXXXX
- isBillablebooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 400
401Unauthorized
- dataobjectoptionalNo description.
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- successbooleanoptionalNo description.default false
- messagestringoptionalNo description.nullabledefault XXXXX
- isBillablebooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 401
500Internal Server Error
- dataobjectoptionalNo description.
- messagesarray<string>optionalNo description.nullable
- request_idstringoptionalNo description.nullable
- successbooleanoptionalNo description.default false
- messagestringoptionalNo description.nullabledefault XXXXX
- isBillablebooleanoptionalNo description.
- statusCodeinteger (int32)optionalNo description.default 500