Face and Liveness
Match two faces
Compare a selfie with the photo on an ID document and get a 0 to 100 match score, a confidence band and a match decision.
POST
/
v2
/
verify
/
face_match
Compare two face images
curl --request POST \
--url https://prod.idto.ai/v2/verify/face_match \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--form image1=@example-file \
--form image2_url=https://example.com/id-photo.jpg \
--form image2=@example-fileconst form = new FormData();
form.append('image1', '(binary selfie image)');
form.append('image2_url', 'https://example.com/id-photo.jpg');
form.append('image2', '{
"fileName": "example-file"
}');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/face_match', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('image1', '(binary selfie image)');
form.append('image2_url', 'https://example.com/id-photo.jpg');
form.append('image2', '{
"fileName": "example-file"
}');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/face_match', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/face_match"
files = {
"image1": ("example-file", open("example-file", "rb")),
"image2": ("example-file", open("example-file", "rb"))
}
payload = { "image2_url": "https://example.com/id-photo.jpg" }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/face_match"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<api-key>")
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/face_match",
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=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"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/face_match")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/face_match")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();{
"status": "success",
"message": "Face match completed",
"error_code": null,
"data": {
"is_match": true,
"match_score": 92.4,
"confidence": "HIGH",
"extras": {}
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}Send two images as
A score between 60 and 70 is
On
Questions: Face and liveness FAQ.
Was this page helpful? Email us at tech@idto.ai with the page link.
multipart/form-data: the live selfie in image1 and the reference photo, usually the face on an ID card, in image2. If the reference is already hosted, pass image2_url instead of uploading it. idto compares the two faces and returns a score and a decision.
Every response has the same shape whichever source serves the call. Branch on error_code and data.is_match:
error_code: null,data.is_match: true: the faces match. Billed.error_code: null,data.is_match: false: the comparison ran and the faces do not match. Billed, because the check ran to a definitive answer.- 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 |
|---|---|
image1 | Required file. The selfie or live capture. At most 10 MB. |
image2 | File. The reference photo. At most 10 MB. Send this or image2_url. |
image2_url | A public https URL that returns the reference image. Send this or image2. |
workflow_session_token | Optional. Pass only when the call is part of an idto workflow session. |
How the decision is made
| Field | Meaning |
|---|---|
data.match_score | Similarity from 0 to 100. |
data.is_match | true when match_score is 70 or more. |
data.confidence | HIGH at 85 or more, MEDIUM from 60 to below 85, LOW below 60. |
data.extras | Supplementary image-quality signals. Keys can differ from call to call; do not build logic on them. |
billed | true when this call was charged. |
MEDIUM but not a match. Route those cases to manual review rather than rejecting them outright.
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: image1 is required. / Invalid input: either image2 or image2_url is required. | No |
IDTO_503 | 413 | The image could not be processed. Please try a clearer, smaller image. | No |
IDTO_509 | 500 | Face match could not be completed. 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, resize or re-capture the image. IDTO_509 means no score could be produced; ask the user for a clearer, front-facing photo and retry. Retry IDTO_004, IDTO_006 and IDTO_008 with backoff. Full taxonomy: v2 error codes.
Test scenarios
| Input | Expected result | HTTP | Billed |
|---|---|---|---|
| Two clear photos of the same person | error_code: null, is_match: true | 200 | Yes |
| Photos of two different people | error_code: null, is_match: false | 200 | Yes |
image2 and image2_url both missing | IDTO_001 | 400 | No |
image1 larger than 10 MB | IDTO_503 | 413 | No |
image1 missing from the form | 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
multipart/form-data
Response
The face comparison ran to completion. This product has no no-record outcome; every result is either a match score or a raised error.
Last modified on December 1, 2026
Compare two face images
curl --request POST \
--url https://prod.idto.ai/v2/verify/face_match \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--form image1=@example-file \
--form image2_url=https://example.com/id-photo.jpg \
--form image2=@example-fileconst form = new FormData();
form.append('image1', '(binary selfie image)');
form.append('image2_url', 'https://example.com/id-photo.jpg');
form.append('image2', '{
"fileName": "example-file"
}');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/face_match', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('image1', '(binary selfie image)');
form.append('image2_url', 'https://example.com/id-photo.jpg');
form.append('image2', '{
"fileName": "example-file"
}');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/face_match', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/face_match"
files = {
"image1": ("example-file", open("example-file", "rb")),
"image2": ("example-file", open("example-file", "rb"))
}
payload = { "image2_url": "https://example.com/id-photo.jpg" }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/face_match"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<api-key>")
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/face_match",
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=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"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/face_match")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/face_match")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image1\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary selfie image)\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2_url\"\r\n\r\nhttps://example.com/id-photo.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image2\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();{
"status": "success",
"message": "Face match completed",
"error_code": null,
"data": {
"is_match": true,
"match_score": 92.4,
"confidence": "HIGH",
"extras": {}
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}