Aadhaar SDK Android

Aadhaar SDK provides the user to verify Aadhaar status and get relevant information. There are 3 flows listed that can be accomplished - Aadhaar XML through 2 different websites and Digilocker Flow.

Please test the flow by downloading the App APK.

Find a video on the successful flow here: Aadhaar SDK Flow Video.mp4

Find steps below to integrate the Application SDK

  1. Aadhaar SDK has to be integrated with mobile application. The code for the same can be found here: https://github.com/Bureau-Inc/prism-android-sdk-demo-app
  2. In the integration UserId and CredentialId are mandatory fields for integration. CredentialId is unique and provided by Bureau.
  3. UserId is a unique id that is generated per user and can be either the phone number/email/UUID etc that is used to represent every unique user.

Aadhaar Flow

  • User is guided to the UIDAI website to download the paperless e-KYC (Aadhaar .xml) Inputs for "Aadhaar Number" & Captcha are filled by the end user. Both the details will be validated by UIDAI on the screen and in case of error the message will be displayed accordingly.
  • On continuing, An OTP is received by the end user which is then auto read by the SDK.
  • The SDK only reads the then received OTP message through the screen.
  • Once the details entered are authenticated, the Aadhaar .xml is downloaded in a .zip which is password(share code) protected

Digilocker Flow

  • Users are guided to the Digilocker website to submit their Aadhaar details.
  • Input for "Aadhaar Number" is filled by the end user.
  • On continuing, An OTP is received by the end user which should be entered in the next page.
  • Once the details entered are authenticated, the Aadhaar details are received by bureau backend server.
  • App backend server will make an API call to bureau backend server and fetch the details of the user.

Minimum Requirements

  • minSdkVersion 21
  • AndroidX

Integrations Guide

Add following lines in your root build.gradle

allprojects {
    repositories {
        maven { url "https://jitpack.io" 
        //add credentials here
        credentials { username authToken }

Add following lines in your module level build.gradle

android {
    compileOptions {
       sourceCompatibility = 1.8
       targetCompatibility = 1.8
dependencies {
       implementation 'com.github.Bureau-Inc:prism-android-native-sdk:0.53.0'

Add the following line in your gradle.properties


Common Android Libraries

This library also uses some common android libraries. So if you are not already using them then make sure you add these libraries to your module level build.gradle

  • androidx.appcompat:appcompat:1.2.0

You might need to add the following code to the application tag in Android Manifest file if Mixpanel View Crawler error shows up


Initialise SDK

 PrismEntryPoint prism;
        yourinitbutton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            //instantiate your prism 
            prism = PrismInstanceProvider.getInstance(context,activity);
            //InitialiseInitialize your prism only once
               prism.initialize(your credentialId,your user id,
                new PrismCallBack(){

                    public void onKYCFinished(ClientAadhaarData aadhaarData, String methodName, Boolean isSuccess,String errorType) {
                               Log.w("Aadhaar Data",aadhaarData.getJsonString.toString())
               ,your success redirection url,your failure redirection url,a boolean to indicate whether flow should be run on production configuration,
               //You can Add customisation to SDK's UI by adding values to PrismCustomisation Builder
            //Adding config to prioritisepriortize the flows by which Aadhaar data is to be taken can be added multiple times    
                prism.addConfig(new Config(residentUidaiAadhaarFlow, myAadhaarUidaiFlow,digilockerFlow));
                //The above order of methods can be rearranged based on priority
           //KYC initiate call


When Aadhaar fetch is successful the callback returns the isSuccess boolean as true and when a failure happens the callback returns the isSuccess boolean as false along with the methodName. By monitoring the method name we can identify which method was used to fetch the Aadhaar details.

new PrismCallBack(){

                    public void onKYCFinished(ClientAadhaarData aadhaarData, String methodName, Boolean isSuccess,String errorType) {
                                    //Write your success logic here
                                    //the object aadhaar data contains the details
                                    //errorType will be empty here
                                    //Make the backend API call to get digilocker data
                                    Log.d("Aadhaar Data", aadhaarData.getJsonString.ToString());
                                    Log.d("XML File Uri", aadhaarData.getXmlFileUri().toString());
                                    Log.d("Aadhaar Data", aadhaarData.getZipFileUri().toString());
                                    Log.d("Aadhaar Data", aadhaarData.getShareCode.toString());
                               {     //Check errorType here
                                      if(errorType== ENDPOINTS_DOWN)
                                        Log.w("Aadhaar Error","No endpoints Available")
                                      else if(errorType== INVOID_AUTH_ERROR)
                                        Log.w("Aadhaar Error","Not authorized")
                                      else if(errorType== DIGILOCKER_ERROR)
                                        Log.w("Aadhaar Error","Digilocker Site error")
                                      else if(errorType== UIDAI_ERROR)
                                        Log.w("Aadhaar Error","UIDAI Site Error")
                                      else if(errorType== INTERNET_ERROR)
                                        Log.w("Aadhaar Error","InternetIntenet Error")
                                      else if(errorType== SDK_ERROR)
                                        Log.w("Aadhaar Error","SDK Error")
                                      else if(errorType== USER_CANCELLED)
                                         Log.w("Aadhaar Error","Cancelled by user")
                                     //Write your failure logic here
                                     //You can call another method by reinitializing config and calling beginKYCFlow() as shown below
                                   prism.addConfig(new Config(myAadhaarUidaiFlow,residentUidaiAadhaarFlow,digilockerFlow));
                                 	//Please note `residentUidaiAadhaarFlow` has been discontinued by UIDAI, this has to be removed from your config


For using the application without digilocker flow, please add the following:

prism.addConfig(Config(residentUidaiAadhaarFlow, myAadhaarUidaiFlow))

Please note residentUidaiAadhaarFlow has been discontinued by UIDAI, this has to be removed from your config

Aadhaar Fetching Methods

SDK Errors

SDK CodeDescription
UIDAI_ERRORAadhaar services down
INTERNET_ERRORUser Device network issue
USER_CANCELLEDUser manual cancelled
SDK_ERRORBureau SDK error
ENDPOINTS_DOWNAll endpoints are down failure in health check api
DIGILOCKER_ERRORDigilocker failure error

Serverside Base URL's

Serverside code to get the details

curl --location --request GET 'https://api.sandbox.bureau.id/v1/id/<UserId>/suppliers/offline-aadhaar' \
--header 'Authorization: Basic AuthHeader'
curl --location --request GET 'https://api.bureau.id/v1/id/<UserId>/suppliers/offline-aadhaar' \
--header 'Authorization: Basic AuthHeader'


    "aadhaarPDFUrl": "https://orch-prd-mb-s3-docum-objects.s3.ap-south-1.amonaws.com/a",
    "city": "xxxxxi",
    "district": "xxxxx",
    "dob": "DDMMYYYY",
    "gender": "M",
    "merchantId": "org_UlEqmxxxxxX5Y",
    "name": "Gxxxh Pxxxd",
    "pincode": "5xxxx1",
    "requestId": "8828238d-xxxx-4984-xxxx-1f03861bd2ec",
    "state": "Kxxxxxa",
    "statusCode": 200,
    "street": "Nxxxxanumaxxxxxmp",
    "timestamp": 1653951944417
    "aadhaarXMLUrl": "https://xxx-prd-mb-xxx-documents-/91feeafe-1111-1111-1111-8e9fe0400920.xml?",
    "city": "User City",
    "district": "User District",
    "dob": "DD-MM-YYYY",
    "gender": "M",
    "merchantId": "auth0|61d11111114e7021",
    "name": "User Name",
    "pincode": "pin code",
    "requestId": "57e7b43d-1111-4e4c-1111-a096e7400a5f",
    "state": "Karnataka",
    "statusCode": 200,
    "street": "addresss",
    "timestamp": 1674201457708
  "errors": {
    "code": 400,
    "description": "Request contains an invalid param in request body which does not exist",
    "message": "BAD_REQUEST",
    "metadata": " ",
    "referenceId": "b090f2a1-ebf4-4fdc-bcdc-296cfc7e4ea1",
    "type": "BAD_REQUEST"
  "merchantId": "auth0|61df1111107111021",
  "requestId": "d46ff15d-1111-4568-1111-b21bbdd3962f",
  "statusCode": 400,
  "timestamp": 1657794502770
  "errors": {
    "code": 422,
    "description": " ",
    "message": "NO_RECORD_FOUND",
    "metadata": " ",
    "referenceId": "b090f2a1-ebf4-4fdc-bcdc-296cfc7e4ea1",
    "type": "NO_RECORD_FOUND"
  "merchantId": "auth0|61df1111107111021",
  "requestId": "d46ff15d-1111-4568-1111-b21bbdd3962f",
  "statusCode": 422,
  "timestamp": 1657794502770
  "errors": {
    "code": 503,
    "description": " ",a
    "metadata": " ",
    "referenceId": "b090f2a1-ebf4-4fdc-bcdc-296cfc7e4ea1",
    "type": ""
  "merchantId": "auth0|61df1111107111021",
  "requestId": "d46ff15d-1111-4568-1111-b21bbdd3962f",
  "statusCode": 503,
  "timestamp": 1657794502770

SDK Customisations

To customise the theme of the activity use the following theme in your styles.xml file.

<style name="PrismAppTheme">
    <!--Add Theme Customisation here-->

<!--To add customisation to toolbar in SDK's activity add the following style-->
<style name="PrismToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar" >
    <item name="android:background">@drawable/invoid_button_bg</item>

<!--To add customisation to buttons in SDK add the following style-->
<style name="PrismButtonTheme" parent="@android:style/Widget.Button">
    <item name="android:textColor">@android:color/white</item>
    <item name="android:shadowColor">#FF000000</item>
    <item name="android:shadowDx">0</item>
    <item name="android:shadowDy">-1</item>
    <item name="android:shadowRadius">0.2</item>
    <item name="android:background">@color/black</item>
    <item name="android:textSize">14sp</item>
    <item name="android:textStyle">bold</item>

Error message show to the user can be customised by defining following strings in your strings.xml file

<!--Error message shown in case of OfflineAadhaarHelper.UIDAI_ERROR-->
<string name="invoid_uidai_error">Server down, please try after some time</string>

<!--Error message shown in case of OfflineAadhaarHelper.INVOID_AUTH_ERROR-->
<string name="invoid_auth_error">Not authorized</string>

<!--Error message shown in case of OfflineAadhaarHelper.INTERNET_ERROR-->
<string name="invoid_check_internet_error">Please check your internet connection</string>

Code Customisations

//Add Prism Customisation values to builder and add it to initialise function
new PrismCustomisation.Builder()
.toolBarTitle(YOUR_CUSTOM_TEXT) // adds a custom title to toolbar
.hideToolbar(true) // TO show or hide toolbar in SDK's UI(The default is show)