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

1) Initiate Session

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
}
{
  "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 Authorization 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,
    "digilockerId": "XXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "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"
}