Face and Liveness
Check liveness of a face image
Check that a selfie shows a live person in front of the camera, not a printed photo, a screen or a mask, and get a liveness decision.
POST
/
v2
/
verify
/
liveness
Check liveness of a face image
curl --request POST \
--url https://prod.idto.ai/v2/verify/liveness \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--data '
{
"person": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk"
}
'const options = {
method: 'POST',
headers: {
'X-Client-ID': '<api-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
person: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk'
})
};
fetch('https://prod.idto.ai/v2/verify/liveness', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {
'X-Client-ID': '<api-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
person: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk'
})
};
fetch('https://prod.idto.ai/v2/verify/liveness', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/liveness"
payload = { "person": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk" }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/liveness"
payload := strings.NewReader("{\n \"person\": \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.idto.ai/v2/verify/liveness",
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([
'person' => '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"X-Client-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://prod.idto.ai/v2/verify/liveness")
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-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"person\": \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk\"\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/liveness")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"person\": \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk\"\n}")
.asString();{
"status": "success",
"message": "Liveness check completed",
"error_code": null,
"data": {
"is_live": true,
"liveness_score": 0.97,
"extras": {
"spoof_cues": [],
"spoof_cues_evaluated": true,
"failed_checks": [],
"liveness_confidence": 0.97
}
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}Send one selfie as base64 in
When
Questions: Face and liveness FAQ.
Was this page helpful? Email us at tech@idto.ai with the page link.
person. idto checks it for signs of a presentation attack, such as a photo of a screen or a printout, and for capture problems such as closed eyes, blur or low light. Run it before Face match so you only compare faces from a live capture.
Every response has the same shape whichever source serves the call. Branch on error_code and data.is_live:
error_code: null,data.is_live: true: the capture looks live. Billed.error_code: null,data.is_live: false: the check ran and the capture failed it. Billed.- Any non-2xx response: the check did not complete. Never billed.
Environments
| Environment | Base URL | Notes |
|---|---|---|
| Production | https://prod.idto.ai | Keys from the dashboard after go-live. Billed. |
| Staging | https://dev.idto.ai | Keys on request from your idto account manager. Calls reach live sources, so use identities you are authorised to verify. Staging credits are deducted from your staging account. |
Input rules
| Field | Rule |
|---|---|
person | Required. Base64 of a JPEG or PNG selfie, at most 10 MB. A data:image/jpeg;base64, prefix is accepted. |
user_id | Optional. Your own reference for the end user. |
workflow_session_token | Optional. Pass only when the call is part of an idto workflow session. |
Response fields
| Field | Meaning |
|---|---|
data.is_live | The decision. |
data.liveness_score | Score behind the decision. |
data.extras | Supplementary signals behind the decision. Keys can differ from call to call; do not build logic on them. |
billed | true when this call was charged. |
is_live is false, ask the user to retake the selfie in good light, facing the camera, with nothing covering the face.
Retries and duplicate protection
Send anIdempotency-Key header (at most 255 characters) to make retries safe. Replaying the same key with the same body within 48 hours returns the stored first response without a new check or a new charge. The same key with a different body returns IDTO_010 (422). A replay while the first call is still running returns IDTO_004 (409). If the first call returned an error, nothing is stored, so a retry runs the check again.
Errors
| Code | HTTP | Message | Billed |
|---|---|---|---|
IDTO_001 | 400 | Invalid input: person must be base64-encoded image data. | No |
IDTO_503 | 413 | Invalid input: the image could not be read. Please upload a clear JPEG or PNG. | No |
IDTO_609 | 500 | Liveness could not be determined. Please try again. | No |
IDTO_001 | 422 | Invalid input. Please check the request and try again. (a required field is missing or has the wrong type) | No |
IDTO_009 | 402 | Insufficient credits or balance. Recharge, or ask your account owner to add credits. | No |
IDTO_004 | 409 | An identical request is already in progress; retry shortly. | No |
IDTO_010 | 422 | Idempotency-Key was already used with a different request body. | No |
IDTO_006 | 429 | Too many requests. Please wait a moment and retry. | No |
IDTO_007 | 500 | Verification could not be completed due to a service configuration issue. Please contact support at tech@idto.ai. | No |
IDTO_008 | 503 | The verification service is facing downtime due to issues from the source. Please drop a mail to tech@idto.ai, and try again later. | No |
IDTO_008 | 503 | The verification service is momentarily busy. Please retry shortly. (image processing is at capacity; retry with backoff) | No |
IDTO_503 is also returned, with the standard image message, when person is larger than 10 MB. Retry IDTO_609, IDTO_004, IDTO_006 and IDTO_008 with backoff. Full taxonomy: v2 error codes.
Test scenarios
| Input | Expected result | HTTP | Billed |
|---|---|---|---|
| Clear, well lit selfie of a live person | error_code: null, is_live: true | 200 | Yes |
| Photo of a face shown on a phone screen | error_code: null, is_live: false | 200 | Yes |
person is an empty string | IDTO_001 | 400 | No |
person is valid base64 but not an image | IDTO_503 | 413 | No |
Body without person | IDTO_001 | 422 | No |
Was this page helpful? Email us at tech@idto.ai with the page link.
Authorizations
Headers
Make retries of this exact request safe. If the same key is replayed with an identical request body, the original result is returned without re-running the verification or billing again. If the same key is replayed with a different body, the request is rejected with IDTO_010 (422). Omitting this header runs every request as new.
Maximum string length:
255Body
application/json
Response
The liveness check ran to completion. This product has no no-record outcome.
Last modified on December 1, 2026
Check liveness of a face image
curl --request POST \
--url https://prod.idto.ai/v2/verify/liveness \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--data '
{
"person": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk"
}
'const options = {
method: 'POST',
headers: {
'X-Client-ID': '<api-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
person: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk'
})
};
fetch('https://prod.idto.ai/v2/verify/liveness', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {
'X-Client-ID': '<api-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
person: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk'
})
};
fetch('https://prod.idto.ai/v2/verify/liveness', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/liveness"
payload = { "person": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk" }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/liveness"
payload := strings.NewReader("{\n \"person\": \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.idto.ai/v2/verify/liveness",
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([
'person' => '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"X-Client-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://prod.idto.ai/v2/verify/liveness")
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-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"person\": \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk\"\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/liveness")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"person\": \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHRocHCAkLicgIiwjHBwoNyk\"\n}")
.asString();{
"status": "success",
"message": "Liveness check completed",
"error_code": null,
"data": {
"is_live": true,
"liveness_score": 0.97,
"extras": {
"spoof_cues": [],
"spoof_cues_evaluated": true,
"failed_checks": [],
"liveness_confidence": 0.97
}
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}