Skip to main content

Aadhaar Verification

Aadhaar is a 12-digit individual identification number which serves as proof of identity and proof of address for residents of India. Aadhaar is a valid Proof of Identity and Proof of Address.

This document covers two methods for Aadhaar verification:

  1. Direct Method: OTP-based verification using mobile number
  2. DigiLocker Method: Seamless verification through DigiLocker integration

Aadhaar Structure

The following data structure is returned upon successful verification:

KeyDescription
Aadhaar IDMasked Aadhaar Number
Date of BirthDate of birth in DD-MM-YYYY format
GenderGender (Male/Female)
NameFirst name from Aadhaar
Last NameLast name from Aadhaar (DigiLocker only)
Care OfCare of field from Aadhaar
CountryCountry (India)
DistrictDistrict
LocalityLocality information
Pin CodePIN code
StateState
VTCVillage/Town/City
HouseHouse number
StreetStreet information
LandmarkLandmark (Direct method only)
Post OfficePost Office (Direct method only)
Sub-DistrictSub-District (Direct method only)
AddressComplete address
PhotoBase64 encoded image of the Aadhaar holder

API Integration

Direct Method

Step 1 - Send OTP to registered mobile number linked to Aadhaar Number

To generate OTP use Generate OTP Api

Request
{
"number": 732255662234
}
Response
{
"code": 0,
"message": "Success",
"data": {
"ref_id": "9183621",
"message": "OTP sent to *******8011"
}
}

The ref_id in the response is to be used in Step 2.

Step 2 - Verify OTP and get details linked to Aadhaar Number

To verify with OTP, use this Verify Aadhaar API

Request
{
"ekycOtp": "299508",
"refId": "9183621",
"digiLocker": false
}
Response
{
"code": 0,
"message": "Success",
"data": {
"aadhaarId": "2XXXXXXXXXX8",
"dateOfBirth": "DD-MM-YYYY",
"gender": "Male",
"name": "KXXXXXj MXXXXXa",
"careOf": "UXXXXl SXXXXh",
"country": "India",
"district": "Gurgaon",
"locality": "Sector 55",
"pinCode": "122004",
"state": "Haryana",
"vtc": "Gurgaon",
"house": "238",
"street": "Sector 55",
"landmark": "Sector 54 Metro",
"postOffice": "Gurugram",
"subDistrict": "Gurugram",
"address": "Sector 55 Gurgaon Haryana",
"photo": "Base-64 encoded image"
}
}

DigiLocker Method

The DigiLocker method provides a secure and seamless verification process without requiring OTP. This method leverages the government-backed DigiLocker infrastructure for authentication.

DigiLocker Integration Flow

The DigiLocker-based Aadhaar verification follows a two-step process:

  1. Pre-Verification: Initialize the DigiLocker authentication process
  2. Verification: Retrieve the Aadhaar details after user authentication

Step 1: Pre-Verify Aadhaar (Initialize DigiLocker)

Use the Pre-Verify Aadhaar API to initialize the DigiLocker authentication process.

Request
{
"digiLocker": true,
"redirectUrl": "https://your-redirect-url.com"
}
Response
{
"code": 0,
"message": "Success",
"data": {
"transactionId": "90074f18-cb8c-4405-ae7d-e801afa19534",
"authUrl": "https://digilocker-auth-url.example"
}
}

Important:

  • Save the transactionId for Step 2
  • Redirect the user to the authUrl to complete DigiLocker authentication

Step 2: Complete Aadhaar Verification

After the user completes DigiLocker authentication and returns to your redirectUrl, use the Aadhaar Verification (Self) API to retrieve the verification results.

Request
{
"digiLocker": true,
"transactionId": "90074f18-cb8c-4405-ae7d-e801afa19534"
}
Response
{
"code": 0,
"message": "Success",
"data": {
"aadhaarId": "XXXXXXXXXXXX",
"dateOfBirth": "DD-MM-YYYY",
"gender": "Male/Female",
"name": "XXXXXXXXXXXX",
"lname": "XXXXXXXXXXXX",
"careOf": "XXXXXXXXXXXX",
"country": "India",
"district": "XXXX",
"locality": "XXXX 55",
"pinCode": "XXXXXX",
"state": "XXXXX",
"vtc": "XXXXXXX",
"house": "XXXX",
"street": "XXXXX",
"address": "Complete address",
"photo": "Base 64 encoded image"
}
}

Implementation Steps

  1. Call Pre-Verify API: Make a request to initialize DigiLocker authentication
  2. Redirect User: Direct the user to the authUrl received in the response
  3. Handle Callback: When the user returns to your redirectUrl, capture the callback
  4. Call Verification API: Use the saved transactionId to retrieve Aadhaar details
  5. Process Results: Handle the returned Aadhaar information in your application

Error Handling

400 Bad Request

{
"code": 1,
"message": "Invalid transaction ID",
"data": {}
}

404 Not Found

{
"code": 1,
"message": "Transaction not found or expired",
"data": {}
}

422 Unprocessable Entity

{
"message": "Invalid redirectUrl"
}

Best Practices

  • Secure Storage: Store the transactionId securely and associate it with the user session
  • Timeout Handling: Implement appropriate timeout mechanisms for the DigiLocker authentication process
  • Error Handling: Properly handle all error responses and provide meaningful feedback to users
  • URL Validation: Ensure your redirectUrl is valid and publicly accessible
  • Data Privacy: Handle the returned Aadhaar data according to data protection regulations