Liveliness Check
curl --request POST \
--url https://sandbox.cashfree.com/verification/liveliness \
--header 'Content-Type: multipart/form-data' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>' \
--form verification_id=test_verification_id \
--form image=@example-file \
--form strict_check=trueimport requests
url = "https://sandbox.cashfree.com/verification/liveliness"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"verification_id": "test_verification_id",
"strict_check": "true"
}
headers = {
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('verification_id', 'test_verification_id');
form.append('image', '<image_file>');
form.append('strict_check', 'true');
const options = {
method: 'POST',
headers: {'x-client-id': '<api-key>', 'x-client-secret': '<api-key>'}
};
options.body = form;
fetch('https://sandbox.cashfree.com/verification/liveliness', 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/liveliness",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-client-id: <api-key>",
"x-client-secret: <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://sandbox.cashfree.com/verification/liveliness"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.cashfree.com/verification/liveliness")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/verification/liveliness")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"reference_id": 1357,
"verification_id": "123456",
"status": "SUCCESS",
"liveliness": true,
"score": 0.95
}Liveliness Check
Use this API to verify if the customer is genuine and not a bot. We analyse the facial features of your customer in the picture or a selfie for identification. View the test data and use the information to trigger the validations. The test data are usable only in the test environment sandbox.
POST
/
liveliness
Liveliness Check
curl --request POST \
--url https://sandbox.cashfree.com/verification/liveliness \
--header 'Content-Type: multipart/form-data' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>' \
--form verification_id=test_verification_id \
--form image=@example-file \
--form strict_check=trueimport requests
url = "https://sandbox.cashfree.com/verification/liveliness"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"verification_id": "test_verification_id",
"strict_check": "true"
}
headers = {
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('verification_id', 'test_verification_id');
form.append('image', '<image_file>');
form.append('strict_check', 'true');
const options = {
method: 'POST',
headers: {'x-client-id': '<api-key>', 'x-client-secret': '<api-key>'}
};
options.body = form;
fetch('https://sandbox.cashfree.com/verification/liveliness', 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/liveliness",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-client-id: <api-key>",
"x-client-secret: <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://sandbox.cashfree.com/verification/liveliness"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.cashfree.com/verification/liveliness")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/verification/liveliness")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"verification_id\"\r\n\r\ntest_verification_id\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<image_file>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strict_check\"\r\n\r\ntrue\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"reference_id": 1357,
"verification_id": "123456",
"status": "SUCCESS",
"liveliness": true,
"score": 0.95
}Authorizations
Client ID. You can find your ID in the Merchant Dashboard.
Client secret key. You can find your secret key in the Merchant Dashboard.
Body
multipart/form-data
Find the request parameters to verify if the customer is genuine and not a bot
Response
Success response for checking the liveliness of your customer
