Fetch User Details From Access Token
curl --request GET \
--url https://sandbox.cashfree.com/verification/oauth2/user-details \
--header 'Authorization: Bearer <token>' \
--header 'x-api-version: <x-api-version>'import requests
url = "https://sandbox.cashfree.com/verification/oauth2/user-details"
headers = {
"x-api-version": "<x-api-version>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-version': '<x-api-version>', Authorization: 'Bearer <token>'}
};
fetch('https://sandbox.cashfree.com/verification/oauth2/user-details', 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://sandbox.cashfree.com/verification/oauth2/user-details",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"x-api-version: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/verification/oauth2/user-details"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-version", "<x-api-version>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.cashfree.com/verification/oauth2/user-details")
.header("x-api-version", "<x-api-version>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/verification/oauth2/user-details")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-version"] = '<x-api-version>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"reference_id": 123456,
"verification_id": "test_verification_id",
"scopes": [
{
"scope": "MOBILE",
"records": [
{
"confidence_score": null,
"metadata": {
"mobile": "9988123456"
}
}
]
},
{
"scope": "EMAIL",
"records": [
{
"confidence_score": null,
"metadata": {
"email": "example@example.com"
}
}
]
},
{
"scope": "ADDRESS",
"records": [
{
"confidence_score": null,
"metadata": {
"complete_address": "123 Main St, Bangalore",
"state": "KARNATAKA",
"type": "Permanent",
"pincode": "123456"
}
}
]
},
{
"scope": "GENDER",
"records": [
{
"confidence_score": null,
"metadata": {
"gender": "MALE"
}
}
]
},
{
"scope": "DOB",
"records": [
{
"confidence_score": null,
"metadata": {
"dob": "1990-01-01"
}
}
]
},
{
"scope": "AADHAAR",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"aadhaar": "xxxxxxxx9012",
"care_of": "S/O: Fakkirappa Dollin",
"address": "Shri Kanaka Nilaya,,Umashankar Nagar 1st Main 5th Cross,Ranebennur,Haveri-Karnataka,India",
"dob": "02-02-1995",
"email": "example@example.com",
"gender": "M",
"name": "Mallesh Fakkirappa Dollin",
"split_address": {
"country": "India",
"dist": "Haveri",
"house": "Shri Kanaka Nilaya",
"landmark": "Shell petrol pump",
"pincode": "123456",
"po": "Ranebennur",
"state": "Karnataka",
"street": "Umashankar Nagar 1st Main 5th Cross",
"subdist": "Ranibennur",
"vtc": "Ranibennur"
},
"year_of_birth": "1995",
"mobile_hash": "abc123hash",
"photo_link": "<base64 encoded image>"
}
}
]
},
{
"scope": "PAN",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"pan": "ABCDE1234F",
"type": "Individual",
"registered_name": "John Doe",
"aadhaar_seeding_status": "Y",
"last_updated_at": "2023-09-01",
"name_pan_card": "John Doe",
"aadhaar_seeding_status_desc": "Aadhaar is linked to PAN"
}
}
]
},
{
"scope": "BANK_ACCOUNT",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"bank_account": "1234567890",
"name_at_bank": "John Doe",
"bank_name": "YES BANK",
"city": "BANGALORE",
"branch": "BANGALORE",
"micr": "123456789"
}
}
]
},
{
"scope": "NAME",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"name": "John Doe"
}
}
]
},
{
"scope": "OCCUPATION",
"records": [
{
"confidence_score": null,
"metadata": {
"occupation": "Salaried"
}
}
]
},
{
"scope": "INCOME",
"records": [
{
"confidence_score": null,
"metadata": {
"income": "BELOW_ONE_LAKH"
}
}
]
}
]
}
1-Click Onboarding(SDK)
Fetch User Details From Access Token
Use this API to retrieve user details by passing a valid access token fetched from the OAuth Access Token Generation API.
This endpoint fetches the information associated with the authenticated user.
GET
/
oauth2
/
user-details
Fetch User Details From Access Token
curl --request GET \
--url https://sandbox.cashfree.com/verification/oauth2/user-details \
--header 'Authorization: Bearer <token>' \
--header 'x-api-version: <x-api-version>'import requests
url = "https://sandbox.cashfree.com/verification/oauth2/user-details"
headers = {
"x-api-version": "<x-api-version>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-version': '<x-api-version>', Authorization: 'Bearer <token>'}
};
fetch('https://sandbox.cashfree.com/verification/oauth2/user-details', 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://sandbox.cashfree.com/verification/oauth2/user-details",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"x-api-version: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/verification/oauth2/user-details"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-version", "<x-api-version>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.cashfree.com/verification/oauth2/user-details")
.header("x-api-version", "<x-api-version>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/verification/oauth2/user-details")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-version"] = '<x-api-version>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"reference_id": 123456,
"verification_id": "test_verification_id",
"scopes": [
{
"scope": "MOBILE",
"records": [
{
"confidence_score": null,
"metadata": {
"mobile": "9988123456"
}
}
]
},
{
"scope": "EMAIL",
"records": [
{
"confidence_score": null,
"metadata": {
"email": "example@example.com"
}
}
]
},
{
"scope": "ADDRESS",
"records": [
{
"confidence_score": null,
"metadata": {
"complete_address": "123 Main St, Bangalore",
"state": "KARNATAKA",
"type": "Permanent",
"pincode": "123456"
}
}
]
},
{
"scope": "GENDER",
"records": [
{
"confidence_score": null,
"metadata": {
"gender": "MALE"
}
}
]
},
{
"scope": "DOB",
"records": [
{
"confidence_score": null,
"metadata": {
"dob": "1990-01-01"
}
}
]
},
{
"scope": "AADHAAR",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"aadhaar": "xxxxxxxx9012",
"care_of": "S/O: Fakkirappa Dollin",
"address": "Shri Kanaka Nilaya,,Umashankar Nagar 1st Main 5th Cross,Ranebennur,Haveri-Karnataka,India",
"dob": "02-02-1995",
"email": "example@example.com",
"gender": "M",
"name": "Mallesh Fakkirappa Dollin",
"split_address": {
"country": "India",
"dist": "Haveri",
"house": "Shri Kanaka Nilaya",
"landmark": "Shell petrol pump",
"pincode": "123456",
"po": "Ranebennur",
"state": "Karnataka",
"street": "Umashankar Nagar 1st Main 5th Cross",
"subdist": "Ranibennur",
"vtc": "Ranibennur"
},
"year_of_birth": "1995",
"mobile_hash": "abc123hash",
"photo_link": "<base64 encoded image>"
}
}
]
},
{
"scope": "PAN",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"pan": "ABCDE1234F",
"type": "Individual",
"registered_name": "John Doe",
"aadhaar_seeding_status": "Y",
"last_updated_at": "2023-09-01",
"name_pan_card": "John Doe",
"aadhaar_seeding_status_desc": "Aadhaar is linked to PAN"
}
}
]
},
{
"scope": "BANK_ACCOUNT",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"bank_account": "1234567890",
"name_at_bank": "John Doe",
"bank_name": "YES BANK",
"city": "BANGALORE",
"branch": "BANGALORE",
"micr": "123456789"
}
}
]
},
{
"scope": "NAME",
"records": [
{
"confidence_score": 0.85,
"metadata": {
"name": "John Doe"
}
}
]
},
{
"scope": "OCCUPATION",
"records": [
{
"confidence_score": null,
"metadata": {
"occupation": "Salaried"
}
}
]
},
{
"scope": "INCOME",
"records": [
{
"confidence_score": null,
"metadata": {
"income": "BELOW_ONE_LAKH"
}
}
]
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
API version to be used. Format is in YYYY-MM-DD.
Example:
"2024-12-01"
Response
Fetch User Details from access token Response Body.
A unique ID created by Cashfree Payments for reference purposes.
Example:
"ref123"
It is the unique ID you create to identify the verification request.
Example:
"verif123"
A list of scopes associated with the verification, each representing a specific type of user data that can be accessed.
Show child attributes
Show child attributes
Was this page helpful?
āI