DigiLocker is a document wallet from Government of India. Citizens can use it
to store digital versions of various documents which include Aadhaar card,
driving license, marks sheets, ration card and lot more.
Documents are fetched into DigiLocker directly from source of the issuer and
are deemed to be at par with original physical documents as per Rule 9A of
the Information Technology Rules, 2016. Documents can also be uploaded by
citizens, for storage on DigiLocker.
Read more about DigiLocker and the various documents supported here.
Fetch documents of your users instantly and directly from the issuing
authority, with user consent. Use the fetched documents to perform KYC
without any delay.
DigiLocker has a wide variety of documents—covering a large number of
government organisations, educational institutions, banks etc. that can be
leveraged to ease the onboarding and verification journeys for your
customers.
(website name) DigiLocker APIs can be used to fetch documents of your users
instantly—with their consent.
Here’s a quick run through of the APIs—
Create a DigiLocker request—Create a request to start
the user journey, with which you can get user consent and then fetch the
document from user’s digilocker. You get an id in response,
which you can use to track this request throughout the journey.
Get DigiLocker request status—Check status of a request
that was created by passing the request id, at any point in
the journey.
Get list of all docs available—Get a global list of all
documents that DigiLocker lets you fetch and the identifiers required to
fetch a particular document.
Fetch a document—Get the document that the user has
consented to share with you, made available as a file URL to download.
All docs other than Aadhaar, can be fetched with this API.
Fetch Aadhaar data—Fetch Aadhaar document data in JSON
format as well as an XML file. The API response is consistent with our
OKYC APIs, which aids
in replacing OKYC with DigiLocker, for carrying out Aadhaar KYC.
Revoke access token—Revoke the OAuth user token, once
necessary user documents are fetched.
Additionally, here are the URLs you would need for these APIs—
Sandbox—https://dg-sandbox.(website name).co
Production—https://dg.(website name).co
Headers—Contact (website name) for providing the credentials required to
successfully call (website name) APIs. This contains:
Call this API to create a new DigiLocker request. Pass the
redirectUrl in the request body.
A DigiLocker account is not mandatory for a
user to start this flow. If the user does not have a DigiLocker account,
DigiLocker will automatically create an account during the consent
journey. User has to sign up by providing their Aadhaar number and
authenticate with the OTP sent to Aadhaar registered mobile number.
To sign up for DigiLocker, user should have
linked their mobile number with Aadhaar.
Usage of the redirect URL
You have to provide a redirectUrl in the request, which has to
be a valid publicly hosted URL—the user gets redirected to this URL after
going through DigiLocker Sign in / Sign up and consent screens.
It will also be used by (website name) to send back relevant information about a
request. By default (website name) includes the success flag of the user
consent and DigiLocker request id.
For a failed user consent, we will send
back—<redirectUrl>?success={false}&id={Digilocker_request.id}&errCode={code}&errMessage={message}
For a successful
signature—<redirect_url>?success={true}&id={Digilocker_request.id}
You can also add custom query params such as
session id from your end. You would append this to the
provided URL, like so—(redirectUrl)?sessionId=XYZ
(website name) has processed your request successfully.
Request
POST /api/digilocker/
{
"redirectUrl":"https://(website name).co"
}
Response
You will get the following details—
Unique DigiLocker request id which can be
used to manage this request.
The status will be unauthenticated for
requests that do not have user consent yet and will
change to authenticated once the user has
provided their consent. You can check the status of a
request at any point of time, using the Get
DigiLocker request status API.
The url from the response should be used to
redirect your user to Sign in / Sign up and provide
consent to access their DigiLocker.
Validity of this request in ISO 8601 format
timestamp, after which the request is expired and
deleted.
Call this API to get status of a DigiLocker request.
(website name) has processed your request successfully.
Request
Pass the DigiLocker request id as a URL
parameter
GET /api/digilocker/:id/status
Response
You will get the following details—
DigiLocker request id
The status will be unauthenticated for
requests that do not have user consent yet and will
change to authenticated once the user
has provided their consent.
The url from the response should be used
to redirect your user to Sign in / Sign up and
provide consent to access their DigiLocker.
Validity of this request in ISO 8601
format timestamp, after which the request
is expired and deleted.
Call this API to get a global list of all documents that DigiLocker lets you
fetch and the corresponding meta data for each document.
This list can be very huge and the response
can take a few minutes. It is recommended that you store this list on
your end for usage in your application.
Consider updating this list of documents only
once every month or as needed, as it does not change very often.
(website name) has processed your request successfully.
Request
GET /api/digilocker/documents
Response
Each document in the response has the following details—
availableFormats is an array that specifies
the formats in which the document is made available
through DigiLocker.
description specifies the name of the
document, as given by the document issuer.
docType is a short code that identifies the
type of the document.
orgId is the code of the document issuer.
orgName is the name of the document issuer
To uniquely identify a
document, both docType and
orgId are necessary. Multiple issuers, with
their unique orgId, can issue documents
which can be of the same docType. A quick
example would be driving license being issued by
different states—the docType is same
whereas the orgId differs.
parameters is an array that contains
key-value pairs, which specifies the user-specific
identifiers required to fetch the document. You can use
the description to aid your user, to input information
on your UI.
A document can require more
than one parameter, as specified by the document issuer.
description
key-value pair in parameters array, is only for your
information and should not to be passed as an identifier
to fetch that document
Call this API to fetch document of a user from DigiLocker.
(website name) has processed your request successfully and the
document was fetched.
Request
Provide the following details in the request—
DigiLocker request id as a URL parameter
Refer to the response of Get list of all docs
available API for obtaining document
specific values explained here—
docType of the document
orgId of the document issuer
The format in which you require the
document. This should be one of the formats that
the document is actually available in.
User consent should be
Y to attempt a document fetch
parameters is an array that
contains key-value pairs, which specifies the
identifiers required to fetch the document.
Refer to the sample response of Get list
of all docs available API for a
detailed explanation of parameters
array.
Note that for each
parameter specified by the document issuer—
The first element has to be the key-value pair
specified by the document issuer, like so— "name":
"MemberName". The second element should
be the key-value pair with the actual value of the
parameter specified, like so—
"value":"Ramesh".
POST /api/digilocker/:id/document
{
"docType":"PRFND",
"orgId":"002317",
"format":"pdf",
"consent":"Y",
"parameters":[{
"name":"AC_NO",
"value":"98432234234"
},
{
"name":"MemberName",
"value":"Ramesh"
}]
}
Response
You will get the following details—
fileUrl to download fetched document
Validity of the fileUrl in ISO
8601 format timestamp
DigiLocker is a document wallet approved by Government of India, that
citizens can use to store digital versions of documents like Aadhaar,
driving license, marks sheets, ration card and more. This API works best to
get Aadhaar details of your user. Check how to get started here