Initiate session
curl --request POST \
--url https://test-api.sandbox.co.in/kyc/entitylocker/sessions/init \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"@entity": "in.co.sandbox.kyc.entitylocker.session.request",
"flow": "signin",
"redirect_url": "https://sandbox.co.in/",
"consent_expiry": 1765887697411
}
'import requests
url = "https://test-api.sandbox.co.in/kyc/entitylocker/sessions/init"
payload = {
"@entity": "in.co.sandbox.kyc.entitylocker.session.request",
"flow": "signin",
"redirect_url": "https://sandbox.co.in/",
"consent_expiry": 1765887697411
}
headers = {
"Authorization": "<authorization>",
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<authorization>',
'x-api-key': '<x-api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'@entity': 'in.co.sandbox.kyc.entitylocker.session.request',
flow: 'signin',
redirect_url: 'https://sandbox.co.in/',
consent_expiry: 1765887697411
})
};
fetch('https://test-api.sandbox.co.in/kyc/entitylocker/sessions/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://test-api.sandbox.co.in/kyc/entitylocker/sessions/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([
'@entity' => 'in.co.sandbox.kyc.entitylocker.session.request',
'flow' => 'signin',
'redirect_url' => 'https://sandbox.co.in/',
'consent_expiry' => 1765887697411
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$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://test-api.sandbox.co.in/kyc/entitylocker/sessions/init"
payload := strings.NewReader("{\n \"@entity\": \"in.co.sandbox.kyc.entitylocker.session.request\",\n \"flow\": \"signin\",\n \"redirect_url\": \"https://sandbox.co.in/\",\n \"consent_expiry\": 1765887697411\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("x-api-key", "<x-api-key>")
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://test-api.sandbox.co.in/kyc/entitylocker/sessions/init")
.header("Authorization", "<authorization>")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"@entity\": \"in.co.sandbox.kyc.entitylocker.session.request\",\n \"flow\": \"signin\",\n \"redirect_url\": \"https://sandbox.co.in/\",\n \"consent_expiry\": 1765887697411\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.sandbox.co.in/kyc/entitylocker/sessions/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"@entity\": \"in.co.sandbox.kyc.entitylocker.session.request\",\n \"flow\": \"signin\",\n \"redirect_url\": \"https://sandbox.co.in/\",\n \"consent_expiry\": 1765887697411\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"timestamp": 1765534184274,
"data": {
"@entity": "in.co.sandbox.kyc.entitylocker.session.response",
"authorization_url": "https://entity.digilocker.gov.in/public/oauth2/1/authorize?response_type=code&client_id=VRF23C1E3B&redirect_uri=https%3A%2F%2Fdev-api.sandbox.co.in%2Fcallbacks%2Fkyc%2Fentitylocker%2Foauth&state=ZDgyMDM0NzItMTFiMC00ZGRhLWFlOWItY2U0YzI0OTRmMWRkfGQzZjg4OTdlLWYxZmYtNDQ0OS05NzA0LTcwNzNmNjkzMDI5NnxodHRwczovL3NhbmRib3guY28uaW4v&code_challenge=yxAtiqiBw2FrXmavMHn7bVnq7nW-sWRNI50JTMuYtAE&code_challenge_method=S256&consent_valid_till=1767205777",
"session_id": "d3f8897e-f1ff-4449-9704-7073f6930296"
},
"transaction_id": "02683ff9-2abc-42ab-a050-945f21068bce"
}Initiate Session
The Initiate Session API returns a EntityLocker link that the user is redirected to, where they can provide consent for the requested documents.
POST
/
kyc
/
entitylocker
/
sessions
/
init
Initiate session
curl --request POST \
--url https://test-api.sandbox.co.in/kyc/entitylocker/sessions/init \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"@entity": "in.co.sandbox.kyc.entitylocker.session.request",
"flow": "signin",
"redirect_url": "https://sandbox.co.in/",
"consent_expiry": 1765887697411
}
'import requests
url = "https://test-api.sandbox.co.in/kyc/entitylocker/sessions/init"
payload = {
"@entity": "in.co.sandbox.kyc.entitylocker.session.request",
"flow": "signin",
"redirect_url": "https://sandbox.co.in/",
"consent_expiry": 1765887697411
}
headers = {
"Authorization": "<authorization>",
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<authorization>',
'x-api-key': '<x-api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'@entity': 'in.co.sandbox.kyc.entitylocker.session.request',
flow: 'signin',
redirect_url: 'https://sandbox.co.in/',
consent_expiry: 1765887697411
})
};
fetch('https://test-api.sandbox.co.in/kyc/entitylocker/sessions/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://test-api.sandbox.co.in/kyc/entitylocker/sessions/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([
'@entity' => 'in.co.sandbox.kyc.entitylocker.session.request',
'flow' => 'signin',
'redirect_url' => 'https://sandbox.co.in/',
'consent_expiry' => 1765887697411
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$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://test-api.sandbox.co.in/kyc/entitylocker/sessions/init"
payload := strings.NewReader("{\n \"@entity\": \"in.co.sandbox.kyc.entitylocker.session.request\",\n \"flow\": \"signin\",\n \"redirect_url\": \"https://sandbox.co.in/\",\n \"consent_expiry\": 1765887697411\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("x-api-key", "<x-api-key>")
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://test-api.sandbox.co.in/kyc/entitylocker/sessions/init")
.header("Authorization", "<authorization>")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"@entity\": \"in.co.sandbox.kyc.entitylocker.session.request\",\n \"flow\": \"signin\",\n \"redirect_url\": \"https://sandbox.co.in/\",\n \"consent_expiry\": 1765887697411\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.sandbox.co.in/kyc/entitylocker/sessions/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"@entity\": \"in.co.sandbox.kyc.entitylocker.session.request\",\n \"flow\": \"signin\",\n \"redirect_url\": \"https://sandbox.co.in/\",\n \"consent_expiry\": 1765887697411\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"timestamp": 1765534184274,
"data": {
"@entity": "in.co.sandbox.kyc.entitylocker.session.response",
"authorization_url": "https://entity.digilocker.gov.in/public/oauth2/1/authorize?response_type=code&client_id=VRF23C1E3B&redirect_uri=https%3A%2F%2Fdev-api.sandbox.co.in%2Fcallbacks%2Fkyc%2Fentitylocker%2Foauth&state=ZDgyMDM0NzItMTFiMC00ZGRhLWFlOWItY2U0YzI0OTRmMWRkfGQzZjg4OTdlLWYxZmYtNDQ0OS05NzA0LTcwNzNmNjkzMDI5NnxodHRwczovL3NhbmRib3guY28uaW4v&code_challenge=yxAtiqiBw2FrXmavMHn7bVnq7nW-sWRNI50JTMuYtAE&code_challenge_method=S256&consent_valid_till=1767205777",
"session_id": "d3f8897e-f1ff-4449-9704-7073f6930296"
},
"transaction_id": "02683ff9-2abc-42ab-a050-945f21068bce"
}Run in Postman
Headers
JWT access token. For token-generation steps, refer to the Quickstart Guide.
Body
application/json
Response
200 - application/json