DigiLocker

βœ…

New SSO DigiLocker Flow

Decentro is live with the new SSO DigiLocker Flow. Click here to access the new set of APIs

Digilocker is an initiative under Digital India Program which aims to remove the dependency on physical documents and power the sharing of verified electronic documents across authorised agencies.

Benefits of Digilocker

  1. Documents can be shared online, accessed anytime, anywhere.
  2. Documents can be authenticated by the users, legally on a par with originals.
  3. It's simple to use and very convenient.
  4. Documents are issued directly by the registered issuers such as Income Tax Department, CBSE, Registrar Office, etc.

Product Flow

Integrate Digilocker via Decentro to fetch multiple documents in a simple flow mentioned below -

  • Initiate Session: This API creates a session in which DigiLocker journey can be completed with other APIs in the flow.
  • Get User Access Token: This API allows the platform to get user access token from Digilocker by passing the authorisation code generated from Digilocker.
  • Get Issued Files: This API allows the platform to fetch a list of issued documents from Digilocker.
  • Download e-Aadhar: This API allows the platform to download the Aadhaar XML from Digilocker.
  • Download File: This API allows the platform to download the file from Digilocker by passing the URI for a particular document.

⚑

Want a faster DigiLocker flow?

If you don't want to bother with the highly flexible and comprehensive flow mentioned abovce, and just want a quicker way to onboard users, check out the One-Time eAadhaar API.

1) Initiate Session

βœ…

More keys in the SSO DigiLocker Flow

Decentro's SSO DigiLocker now has additional keys to help you reduce customer drop-offs such as: pinless_signin, pinless_signup and usernameless_signup.

To start the DigiLocker flow, a session has to be initiated first. A session can be initiated with Initiate Session API.

{
    "consent": true,
    "consent_purpose": "for banking purpose only",
    "reference_id": "ABCDEF12345",
    "redirect_url": "<Redirect URL for DigiLocker>",
    "redirect_to_signup": true,
    "pinless_signin": true,
    "pinless_signup": false,
    "usernameless_signup": false
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "Session created successfully.",
  "data": {
    "authorizationUrl": "<redirectUrl>"
  },
  "responseKey": "success_initiate_session"
}
{
    "consent": true,
    "consent_purpose": "for banking purpose only",
    "reference_id": "ABCDEF12345"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "Session created successfully.",
  "data": {
    "authorizationUrl": "<redirectUrl>"
  },
  "responseKey": "success_initiate_session"
}

πŸ˜ƒ

DigiLocker Sign Up / Sign In with Aadhaar

Yay! You can choose to redirect your customers to Aadhaar signup/login by passing an optional parameter redirect_to_signup in the request body as true. This will take the user to Aadhaar based Sign Up and Login to DigiLocker. By default, this parameter is false and it takes the user to Mobile Number based login screen, if not passed or false is passed.

Sign Up Flow

DigiLocker Aadhaar Sign Up and Sign In

Sign In Flow

DigiLocker Mobile Sign In

2) Get Authorisation Code

  • Step 1: Click on the link received in Initiate Session API Response parameter - authorizationUrl.
  • Step 2: You will be redirected to DigiLocker UI Screen. Enter either your mobile number or Aadhaar Number linked with your Digilocker on the screen.
  • Step 3: Enter your password and PIN for Digilocker.
  • Step 4: Digilocker will send an OTP on your mobile number.
  • Step 5: Enter the OTP on the UI to login successfully.
  • Step 6: Accept the terms and give consent to Decentro to access your documents from Digilocker.
  • Step 7: After giving consent, a DigiLocker code will be generated and redirected to the URL you mentioned (if not, to Decentro URL) which will be used in the Access Token API in request body.

3) Get User Access Token

This API is used to get access code from Digilocker by entering the authorization Code received on Digilocker UI. Get Access Token API to be accessed only after getting DigiLocker Code from UI.

Parameter Description

ParameterDescription
initial_decentro_transaction_idThe Decentro transaction ID received in Initiate Session API Response
digilocker_codeThe code generated in the URL on the final page of Digilocker UI
consenttrue/false based on if your customer has given you the consent for validating his KYC based on this. Mandatory as per regulation
consentThe purpose of taking this consent from your customer. Mandatory as per regulation
reference_idAny unique ID assigned by you for this API request
{
  	"initial_decentro_transaction_id":"DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "digilocker_code": "XXXXXXXXXXXXXXXXXX",
    "consent": true,
    "consent_purpose": "for banking purpose only",
    "reference_id": "ABCDEF12345"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00007",
  "message": "Access Token generated successfully from Digilocker",
  "data": {
    "expiresIn": 3600,
    "name": "Manish Gupta",
    "dob": "DD-MM-YYYY",
    "gender": "M",
    "eaadhaar": "Y"
  },
  "responseKey": "success_access_token"
}

4) Get Issued Files

Get issued files API will fetch the list of issued documents in Digilocker.

Parameter Description

ParameterDescription
initial_decentro_transaction_idA unique ID assigned by Decentro when the session was initiated in Get Access Token
consenttrue/false based on if your customer has given you the consent for validating his KYC based on this. Mandatory as per regulation
consentThe purpose of taking this consent from your customer. Mandatory as per regulation
reference_idAny unique ID assigned by you for this API request
{
    "initial_decentro_transaction_id": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "consent": true,
    "consent_purpose": "for banking purpose only",
    "reference_id": "ABCDEF12345"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "Issued files received successfully from Digilocker",
  "data": [
    {
      "name": "Aadhaar Card",
      "type": "file",
      "size": "",
      "date": "DD-MM-YYYY",
      "parent": "",
      "mime": [
        "application/pdf"
      ],
      "uri": "in.gov.uidai-XXXXXXXXXXXXXXXXXXXXXXX",
      "doctype": "ADHAR",
      "description": "Aadhaar Card",
      "issuerid": "in.gov.uidai",
      "issuer": "Aadhaar, Unique Identification Authority of India"
    }
  ],
  "responseKey": "success_issued_files"
}

5) Get e-Aadhaar

Get e-Aadhaar API will return e-Aadhaar data in XML format.

πŸ‘

Voila

Now you can get the below mentioned parameters in the response as well by passing the following params in the request body -

  • DigiLocker verified Aadhaar XML by passing the optional parameter generate_xml as true
  • eAadhaar PDF from DigiLocker verified XML by passing an optional parameter generate_pdf as true

Parameter Description

ParameterDescription
initial_decentro_transaction_idA unique ID assigned by Decentro when the session was initiated in Get Access Token
consenttrue/false based on if your customer has given you the consent for validating his KYC based on this. Mandatory as per regulation
consent_purposeThe purpose of taking this consent from your customer. Mandatory as per regulation
reference_idAny unique ID assigned by you for this API request
generate_xmlIf you want the xml file of eAadhaar from DigiLocker
generate_pdfIf you want to generate a PDF based on DigiLocker verified eAadhaar
{
    "initial_decentro_transaction_id": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "consent": true,
    "consent_purpose": "for banking purpose only",
    "reference_id": "ABCDEF12345"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "E-Aadhaar information received successfully from Digilocker",
  "data": {
    "aadhaarReferenceNumber": "",
    "aadhaarUid": "xxxxxxxx1234",
    "proofOfIdentity": {
      "dob": "DD-MM-YYYY",
      "hashedEmail": "",
      "gender": "M",
      "hashedMobileNumber": "",
      "name": "MANISH GUPTA"
    },
    "proofOfAddress": {
      "careOf": "",
      "country": "India",
      "district": "Bengaluru",
      "house": "XXX",
      "landmark": "",
      "locality": "",
      "pincode": "XXXXXX",
      "postOffice": "",
      "state": "Karnataka",
      "street": "",
      "subDistrict": "",
      "vtc": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
    "image": "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "responseKey": "success_eaadhaar_download"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "E-Aadhaar information received successfully from Digilocker",
  "data": {
    "aadhaarReferenceNumber": "",
    "aadhaarUid": "xxxxxxxx1234",
    "proofOfIdentity": {
      "dob": "DD-MM-YYYY",
      "hashedEmail": "",
      "gender": "M",
      "hashedMobileNumber": "",
      "name": "MANISH GUPTA"
    },
    "proofOfAddress": {
      "careOf": "",
      "country": "India",
      "district": "Bengaluru",
      "house": "XXX",
      "landmark": "",
      "locality": "",
      "pincode": "XXXXXX",
      "postOffice": "",
      "state": "Karnataka",
      "street": "",
      "subDistrict": "",
      "vtc": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
    "image": "<Base64 of Image>",
    "xml": "<Base64 of XML File>"
  },
  "responseKey": "success_eaadhaar_download"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "E-Aadhaar information received successfully from Digilocker",
  "data": {
    "aadhaarReferenceNumber": "",
    "aadhaarUid": "xxxxxxxx1234",
    "proofOfIdentity": {
      "dob": "DD-MM-YYYY",
      "hashedEmail": "",
      "gender": "M",
      "hashedMobileNumber": "",
      "name": "MANISH GUPTA"
    },
    "proofOfAddress": {
      "careOf": "",
      "country": "India",
      "district": "Bengaluru",
      "house": "XXX",
      "landmark": "",
      "locality": "",
      "pincode": "XXXXXX",
      "postOffice": "",
      "state": "Karnataka",
      "street": "",
      "subDistrict": "",
      "vtc": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
    "image": "<Base64 of Image>",
    "pdf": "<Base64 of DigiLocker Verified eAadaar PDF File>"
  },
  "responseKey": "success_eaadhaar_download"
}

6) Download File

Download file API will download a file from Digilocker from issued documents.

Parameter Description

ParameterDescription
initial_decentro_transaction_idA unique ID assigned by Decentro when the session was initiated in Get Access Token
file_urnThe uri of the file you want to dowload which can be found in Get Issued Files API
consenttrue/false based on if your customer has given you the consent for validating his KYC based on this. Mandatory as per regulation
consent_purposeThe purpose of taking this consent from your customer. Mandatory as per regulation
reference_idAny unique ID assigned by you for this API request

πŸ“˜

Note

This API will not download e-Aadhaar. e-Aadhaar can be downloaded only via Get e-Aadhaar API.

{
    "initial_decentro_transaction_id": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "file_urn": "in.gov.uidai-XXXXXXXXXXXXXXXXXXXXXXXXX",
    "consent": true,
    "consent_purpose": "for banking purpose only",
    "reference_id": "ABCDEF12345"
}
{
    "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "status": "SUCCESS",
    "responseCode": "S00000",
    "message": "File fetched successfully from Digilocker",
    "data": {
        "file": <base 64>
    },
    "responseKey": "success_file_download"
}

Other Utilities

🏦 Get List of Issuers

This API retrieves the list of all issuers who are currently available with DigiLocker. The API also provides the organisation IDs of the issuers so that you can later fetch the document types and the related parameters in the subsequent APIs of the cycle.

{
    "consent": true,
    "purpose": "for bank account verification",
    "reference_id": "DEC001"
}

πŸ“‘ Get List of Document Types

This API retrieves the list of document types available at a specific organisation ID. The API accepts the organisation ID of the issuer and returns all the documents that the organisation issues. Using these document "codes", you can pull any document from any organisation in the DigiLocker repository if your access token has the right priveleges.

{
    "consent": true,
    "purpose": "for bank account verification",
    "reference_id": "DEC001",
    "organisation_id": "XXXX"
}
{
    "decentroTxnId": "XXXX",
    "status": "SUCCESS",
    "responseCode": "S00000",
    "message": "Document types received successfully from MeriPehchaan",
    "data": {
        "documentTypes": [
            {
                "documentType": "HLIPC",
                "description": "Insurance - Health",
                "logo": "XXXX"
            },
            {
                "documentType": "CRIPC",
                "description": "Insurance Policy - Car",
                "logo": "XXXX"
            },
            {
                "documentType": "TWIPC",
                "description": "Insurance Policy - Two Wheeler",
                "logo": "XXXX"
            }
        ]
    },
    "responseKey": "success_file_issuers_fetched"
}

πŸ—’οΈ Get List of Parameters

This API is the next step in the cycle of pulling documents. Albeit hitting these APIs in this cycle is not mandatory, i.e., you can straightaway pull files if you know the organisation ID, the document type and the list of parameters, these APIs serve as a utility when fetching some documents that are not very common.

{
    "consent": true,
    "purpose": "for bank account verification",
    "reference_id": "DEC001",
    "organisation_id": "XXXX",
    "document_type": "XXXX"
}
{
    "decentroTxnId": "XXXX",
    "status": "SUCCESS",
    "responseCode": "S00000",
    "message": "Document types received successfully from MeriPehchaan",
    "data": {
        "parameters": [
            {
                "label": "Policy Number",
                "parameterName": "policyno",
                "example": "DXXXXXXXXXXXXX/XX OR AROGXXXXXXXXXX"
            },
            {
                "label": "Phone Number",
                "parameterName": "phoneno",
                "example": "10 Digits without any prefix"
            }
        ]
    },
    "responseKey": "success_file_issuers_fetched"
}

↙️ Pull File

The Pull File API accepts the following in order to pull any document from any issuers in DigiLocker:

  1. organisation_id: The Organisation ID of the issuer.
  2. document_type: The document type of the specific document being pulled.
  3. document_type_related_parameters: An array of key-value pairs that denotes all the parameters required to pull a document from the issuer.
{
    "consent": true,
    "purpose": "for bank account purpose",
    "reference_id": "XXXX",
    "organisation_id": "XXXX",
    "document_type": "XXXX",
    "document_type_related_parameters": [
        {
            "key": "Name of the key",
            "value": "Value of the key"
        },
        {
            "key": "Name of the key",
            "value": "Value of the key"
        }
    ]
}
{
  "decentroTxnId": "DXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "Document pulled successfully from Issuer",
  "responseKey": "success_file_pull"
}

⚑ One-Time eAadhaar

One-Time eAadhaar API will return e-Aadhaar data without hitting access token API, with XML or PDF format.

Parameter Description

ParameterDescription
initial_decentro_transaction_idA unique ID assigned by Decentro when the session was initiated in Initiate Session API
digilocker_codeA digilocker code received in the response of the Initiate Session API
consenttrue/false based on if your customer has given you the consent for validating his KYC based on this. Mandatory as per regulation
consent_purposeThe purpose of taking this consent from your customer. Mandatory as per regulation
reference_idAny unique ID assigned by you for this API request
generate_xmlIf you want the xml file of eAadhaar from DigiLocker
generate_pdfIf you want to generate a PDF based on DigiLocker verified eAadhaar
{
    "initial_decentro_transaction_id": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "digilocker_code": "XXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "consent": true,
    "consent_purpose": "For bank account purpose only",
    "reference_id": "ABCDEF12345",
    "generate_xml": true
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "E-Aadhaar information received successfully from Digilocker",
  "data": {
    "aadhaarReferenceNumber": "",
    "aadhaarUid": "xxxxxxxx1234",
    "proofOfIdentity": {
      "dob": "DD-MM-YYYY",
      "hashedEmail": "",
      "gender": "M",
      "hashedMobileNumber": "",
      "name": "MANISH GUPTA"
    },
    "proofOfAddress": {
      "careOf": "",
      "country": "India",
      "district": "Bengaluru",
      "house": "XXX",
      "landmark": "",
      "locality": "",
      "pincode": "XXXXXX",
      "postOffice": "",
      "state": "Karnataka",
      "street": "",
      "subDistrict": "",
      "vtc": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
    "image": "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "responseKey": "success_eaadhaar_download"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "E-Aadhaar information received successfully from Digilocker",
  "data": {
    "aadhaarReferenceNumber": "",
    "aadhaarUid": "xxxxxxxx1234",
    "proofOfIdentity": {
      "dob": "DD-MM-YYYY",
      "hashedEmail": "",
      "gender": "M",
      "hashedMobileNumber": "",
      "name": "MANISH GUPTA"
    },
    "proofOfAddress": {
      "careOf": "",
      "country": "India",
      "district": "Bengaluru",
      "house": "XXX",
      "landmark": "",
      "locality": "",
      "pincode": "XXXXXX",
      "postOffice": "",
      "state": "Karnataka",
      "street": "",
      "subDistrict": "",
      "vtc": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
    "image": "<Base64 of Image>",
    "xml": "<Base64 of XML File>"
  },
  "responseKey": "success_eaadhaar_download"
}
{
  "decentroTxnId": "DECXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "SUCCESS",
  "responseCode": "S00000",
  "message": "E-Aadhaar information received successfully from Digilocker",
  "data": {
    "aadhaarReferenceNumber": "",
    "aadhaarUid": "xxxxxxxx1234",
    "proofOfIdentity": {
      "dob": "DD-MM-YYYY",
      "hashedEmail": "",
      "gender": "M",
      "hashedMobileNumber": "",
      "name": "MANISH GUPTA"
    },
    "proofOfAddress": {
      "careOf": "",
      "country": "India",
      "district": "Bengaluru",
      "house": "XXX",
      "landmark": "",
      "locality": "",
      "pincode": "XXXXXX",
      "postOffice": "",
      "state": "Karnataka",
      "street": "",
      "subDistrict": "",
      "vtc": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
    "image": "<Base64 of Image>",
    "pdf": "<Base64 of DigiLocker Verified eAadaar PDF File>"
  },
  "responseKey": "success_eaadhaar_download"
}