Verify DigiLocker
curl --request POST \
--url https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"redirectUrl": "<string>",
"deviceId": "<string>"
}
'import requests
url = "https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init"
payload = {
"redirectUrl": "<string>",
"deviceId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({redirectUrl: '<string>', deviceId: '<string>'})
};
fetch('https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redirectUrl' => '<string>',
'deviceId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init"
payload := strings.NewReader("{\n \"redirectUrl\": \"<string>\",\n \"deviceId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"redirectUrl\": \"<string>\",\n \"deviceId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"redirectUrl\": \"<string>\",\n \"deviceId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyKYC
Verify DigiLocker
DigiLocker-based Aadhaar verification
POST
/
v2
/
users
/
{userId}
/
kyc
/
digilocker
/
init
Verify DigiLocker
curl --request POST \
--url https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"redirectUrl": "<string>",
"deviceId": "<string>"
}
'import requests
url = "https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init"
payload = {
"redirectUrl": "<string>",
"deviceId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({redirectUrl: '<string>', deviceId: '<string>'})
};
fetch('https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redirectUrl' => '<string>',
'deviceId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init"
payload := strings.NewReader("{\n \"redirectUrl\": \"<string>\",\n \"deviceId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"redirectUrl\": \"<string>\",\n \"deviceId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.global/v2/users/{userId}/kyc/digilocker/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"redirectUrl\": \"<string>\",\n \"deviceId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyDigiLocker Verification
DigiLocker verification allows users to share their Aadhaar and PAN documents directly from the government DigiLocker service. This is a more user-friendly alternative to Aadhaar OTP verification.Flow Overview
- Initialize - Get a DigiLocker consent URL
- User Consent - User opens URL and grants consent in DigiLocker app
- Check Status - Poll status until verification completes
Initialize DigiLocker Session
Optional URL to redirect user after DigiLocker consent
Device fingerprint/ID for FIU compliance. Must be captured from the client device.
Request
curl -X POST https://api.stablepay.global/v2/users/usr_abc123/kyc/digilocker/init \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"redirectUrl": "https://yourapp.com/kyc/callback",
"deviceId": "device-fingerprint-12345"
}'
Response
{
"success": true,
"data": {
"clientId": "digilocker_abc123xyz",
"url": "https://digilocker-sdk.notbot.in/?gateway=production&type=digilocker&token=...",
"expiresIn": 600,
"message": "DigiLocker URL generated. Open this URL for user to complete verification."
}
}
Direct the user to the
url to complete DigiLocker consent. The session expires in 10 minutes.Check DigiLocker Status
Poll this endpoint to check if the user has completed DigiLocker consent.Request
curl -X GET https://api.stablepay.global/v2/users/usr_abc123/kyc/digilocker/status?clientId=digilocker_abc123xyz \
-H "Authorization: Bearer YOUR_API_KEY"
Response (Verified)
{
"success": true,
"data": {
"status": "VERIFIED",
"verified": true,
"aadhaar": {
"name": "RAHUL SHARMA",
"dob": "1990-05-15",
"gender": "M",
"address": "123 Main Street, Mumbai, Maharashtra",
"maskedAadhaar": "XXXX-XXXX-1234",
"pincode": "400001",
"state": "Maharashtra",
"district": "Mumbai"
},
"pan": {
"number": "ABCDE1234F",
"name": "RAHUL SHARMA"
}
}
}
Response (Pending)
{
"success": true,
"data": {
"status": "PENDING",
"verified": false,
"message": "Waiting for user to complete DigiLocker verification"
}
}
Response (Expired)
{
"success": false,
"data": {
"status": "EXPIRED",
"verified": false,
"error": "DigiLocker session has expired. Please generate a new token."
}
}
Status Values
| Status | Description |
|---|---|
PENDING | User has not completed DigiLocker consent yet |
VERIFIED | Verification complete, Aadhaar data available |
FAILED | User cancelled or verification failed |
EXPIRED | Session expired before completion |
Benefits Over Aadhaar OTP
| Feature | DigiLocker | Aadhaar OTP |
|---|---|---|
| User Experience | Single consent flow | Enter OTP manually |
| Document Access | Aadhaar + PAN in one flow | Aadhaar only |
| Security | OAuth 2.0 based | SMS OTP |
| Consent Record | Government maintained | None |
Errors
| Code | Description |
|---|---|
SESSION_NOT_FOUND | Invalid clientId or session expired |
ALREADY_VERIFIED | DigiLocker already verified for this user |
SERVICE_UNAVAILABLE | DigiLocker service temporarily unavailable |
⌘I
