DeepFake Liveness
FACIA's DeepFake Liveness Detection is an advanced biometric security feature that identifies and prevents sophisticated spoofing attempts, including deepfake images, AI-generated faces, and other digital manipulations. By leveraging cutting-edge AI algorithms and real-time analysis, our technology detects inconsistencies in facial texture and depth, ensuring reliable and secure authentication.
Create DeepFake Liveness Transaction
This endpoint initiates a liveness detection check with optional deepfake analysis. Submit a request with the required image and configuration parameters to begin the verification process.
Endpoint
POSThttps://api.facia.ai/liveness
Authorization:
Token Type: BearerDescription: This API utilizes Access token or Client-Secret key in header for authentication.
You can use your client_id and client_secret key when using the "/request-access-token" endpoint to obtain a Bearer token for authorization while connecting to this API. For additional details on Authorization, click Here
Request Body Sample
- HTTP
- Javascript
- Curl
- PHP
- Python
- Ruby
- Java
- C#
- Go
//POST /deepfake-liveness HTTP/1.1
//Host: https://api.facia.ai
//Content-Type: application/json
{
"type": "liveness",
"file": file.jpg, //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
"detect_deepfake": 1,
"offsite_liveness": 1
}
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer token");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"type": "liveness",
"file": "file.jpg", //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
"detect_deepfake": 1,
"offsite_liveness": 1
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.facia.ai/liveness", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location 'https://api.facia.ai/liveness' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer token' \
--data '{
"type": "liveness",
"file": "file.jpg", //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
"detect_deepfake": 1,
"offsite_liveness": 1
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.facia.ai/liveness',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
"type" => "liveness",
"file": "file.jpg", //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
"detect_deepfake" => 1,
"offsite_liveness" => 1
]),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.facia.ai/liveness"
headers = {
"Authorization": "Bearer token",
"Content-Type": "application/json"
}
payload = {
"type": "liveness",
"file": "file.jpg", //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
"detect_deepfake": 1,
"offsite_liveness": 1
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
require 'net/http'
require 'uri'
require 'json'
url = URI.parse('https://api.facia.ai/liveness')
token = 'your_token'
payload = {
type: "liveness",
file: "file.jpg", //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
detect_deepfake: 1,
offsite_liveness: 1
}.to_json
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url.path, {
"Content-Type" => "application/json",
"Authorization" => "Bearer #{token}"
})
request.body = payload
response = http.request(request)
puts "Response Code: #{response.code}"
puts "Response Body: #{response.body}"
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class DeepFakeLivenessRequest {
public static void main(String[] args) throws Exception {
String url = "https://api.facia.ai/liveness";
String token = "your_token";
String payload = """
{
"type": "liveness",
"file": "file.jpg", //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
"detect_deepfake": 1,
"offsite_liveness": 1
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(url))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Response Code: " + response.statusCode());
System.out.println("Response Body: " + response.body());
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string apiUrl = "https://api.facia.ai/liveness";
string token = "your_token";
var payload = "{\"type\":\"liveness\",\"file\":\"file.jpg\",\"detect_deepfake\":1,\"offsite_liveness\":1}";
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
var content = new StringContent(payload, Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync(apiUrl, content);
Console.WriteLine($"Response Code: {response.StatusCode}");
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Body: {responseBody}");
}
}
}
package main
import (
"bytes"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.facia.ai/liveness"
token := "your_token"
payload := `{
"type": "liveness",
"file": "file.jpg", //In raw JSON, it will be base64:path, or in form-data, it will be a .jpg/.png file.
"detect_deepfake": 1,
"offsite_liveness": 1
}`
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(payload)))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("Response Code:", resp.Status)
fmt.Println("Response Body:", string(body))
}
Request Parameter
Parameters | Description |
---|---|
type | Required: Yes Type: string Example: type=liveness The type must be "liveness". |
file | Required: Yes Type: file Example: file=file.jpg File must be of type .jpeg, .jpg or .png. |
offsite_liveness | Required: Yes Type: Boolean Example: offsite_liveness=true offsite_liveness must be true. or 1. |
detect_deepfake | Required: Yes Type: Boolean Example: detect_deepfake=true detect_deepfake must be true. or 1. |
Response Sample
{
"status": true,
"message": "Transaction Created",
"result": {
"data": {
"reference_id": "W4437KIWN0KDM13"
}
}
}
Response Parameter
Parameters | Description |
---|---|
reference_id | Type: string Example: reference_id=W4437KIWN0KDM13 The unique identifier associated with the created transaction. |
Retrieve DeepFake Liveness Result
After initiating a liveness check, use this endpoint to retrieve verification results. This includes liveness scores and deepfake detection insights.
Endpoint
POSThttps://api.facia.ai/result
Authorization:
Token Type: BearerDescription: This API utilizes Access token or Client-Secret key in header for authentication.
You can use your client_id and client_secret key when using the "/request-access-token" endpoint to obtain a Bearer token for authorization while connecting to this API. For additional details on Authorization, click Here
Request Body Sample
- HTTP
- Javascript
- Curl
- PHP
- Python
- Ruby
- Java
- C#
- Go
//POST /result HTTP/1.1
//Host: api.facia.ai
//Content-Type: application/json
//Authorization: Bearer <access-token-here>
{
"reference_id": "W4437KIWN0KDM13"
}
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <access-token-here>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"reference_id": "W4437KIWN0KDM13"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.facia.ai/result", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location 'https://api.facia.ai/result' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <access-token-here>' \
--data '{
"reference_id": "W4437KIWN0KDM13"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.facia.ai/result',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(["reference_id" => "W4437KIWN0KDM13"]),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <access-token-here>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.facia.ai/result"
headers = {
'Authorization': 'Bearer <access-token-here>',
'Content-Type': 'application/json'
}
payload = {"reference_id": "W4437KIWN0KDM13"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
require 'net/http'
require 'json'
url = URI("https://api.facia.ai/result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = "Bearer <access-token-here>"
request['Content-Type'] = "application/json"
request.body = {"reference_id" => "W4437KIWN0KDM13"}.to_json
response = http.request(request)
puts response.body
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class ApiRequest {
public static void main(String[] args) {
try {
URL url = new URL("https://api.facia.ai/result");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer <access-token-here>");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String jsonInput = "{\"reference_id\":\"W4437KIWN0KDM13\"}";
try (OutputStream os = conn.getOutputStream()) {
os.write(jsonInput.getBytes(StandardCharsets.UTF_8));
}
int responseCode = conn.getResponseCode();
System.out.println("Response Code: " + responseCode);
} catch (Exception e) {
e.printStackTrace();
}
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program {
static async Task Main() {
string url = "https://api.facia.ai/result";
string token = "<access-token-here>";
string jsonPayload = "{\"reference_id\":\"W4437KIWN0KDM13\"}";
using (HttpClient client = new HttpClient()) {
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
}
package main
import (
"bytes"
"fmt"
"net/http"
)
func main() {
url := "https://api.facia.ai/result"
jsonPayload := []byte(`{"reference_id": "W4437KIWN0KDM13"}`)
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Authorization", "Bearer <access-token-here>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
Request Parameter
Parameters | Description |
---|---|
reference_id | Required: Yes Type: string Example: reference_id=W4437KIWN0KDM13 The unique identifier associated with the created transaction. |
Response Sample
{
"status": true,
"message": "success",
"result": {
"data": {
"type": "liveness",
"reference_id": "6042D9CB4974EAB",
"client_reference": null,
"quick_liveness_response": 0,
"liveness_score": 0.2359273945279834,
"decline_code": "FADR25",
"decline_reason": "Deepfake Detected.",
"declined_proof": "https://api.facia.ai/api/image-url/67b1234567c7623feb123456?expires=1234567890&signature=3077f7405447fd12345678b7bb79d39ae5b495c0100f91e23feec336d8d4f2d0"
}
}
}
Response Parameter
Field | Type | Description |
---|---|---|
type | string | Specifies the type of request. Example: liveness . |
reference_id | string | The unique identifier for the liveness verification request. Example: 6042D9CB4974EAB |
client_reference | string | The reference ID provided by the client. If null , no reference was provided.Example: null |
quick_liveness_response | integer | A quick response indicator for liveness detection. Example: 0 |
liveness_score | float | The confidence score representing the probability of a live presence. Example: 0.2359273945279834 |
decline_code | string | A specific decline code indicating the reason for rejection. Example: FADR25 |
decline_reason | string | The reason for declining the request. Example: "Deepfake Detected." |
declined_proof | string | The URL of the declined proof image used for verification. The URL expires after a set time. Example: Declined Proof URL |
Summary
FACIA's DeepFake Liveness Detection provides an advanced security layer by detecting and preventing deepfake and AI-generated facial fraud. The API endpoints allow seamless integration for liveness verification, ensuring a secure and robust biometric authentication process.