Compare Faces
curl --request POST \
--url https://api.deepidv.com/v1/face/compareimport requests
url = "https://api.deepidv.com/v1/face/compare"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.deepidv.com/v1/face/compare', 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://api.deepidv.com/v1/face/compare",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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://api.deepidv.com/v1/face/compare"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.deepidv.com/v1/face/compare")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepidv.com/v1/face/compare")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"isMatch": true,
"confidence": 96.4,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 62.1,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 0,
"threshold": 80,
"sourceFaceDetected": false,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 0,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": false
}
Server-to-Server
Compare Faces
Compare two faces and return a similarity score
POST
/
v1
/
face
/
compare
Compare Faces
curl --request POST \
--url https://api.deepidv.com/v1/face/compareimport requests
url = "https://api.deepidv.com/v1/face/compare"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.deepidv.com/v1/face/compare', 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://api.deepidv.com/v1/face/compare",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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://api.deepidv.com/v1/face/compare"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.deepidv.com/v1/face/compare")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepidv.com/v1/face/compare")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"isMatch": true,
"confidence": 96.4,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 62.1,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 0,
"threshold": 80,
"sourceFaceDetected": false,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 0,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": false
}
POST /v1/face/compare
isMatch decision. Typical use: comparing a selfie to the photo on a scanned ID.
Request
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your API key |
Content-Type | Yes | multipart/form-data or application/json |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
source | binary | string | Yes | The first image. For multipart, the file part. For JSON, a base64, base64url, or S3-key string. |
target | binary | string | Yes | The second image. Same input rules as source. |
source as raw multipart bytes and target as a JSON S3 key in a multipart body. See the overview for the shared image rules.
Example request
curl -X POST https://api.deepidv.com/v1/face/compare \
-H "x-api-key: YOUR_API_KEY" \
-F "source=@id-photo.jpg" \
-F "target=@selfie.jpg"
curl -X POST https://api.deepidv.com/v1/face/compare \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "uploads/id-photo-abc.jpg",
"target": "uploads/selfie-xyz.jpg"
}'
import fs from "node:fs";
const form = new FormData();
form.append("source", new Blob([fs.readFileSync("id-photo.jpg")]), "source.jpg");
form.append("target", new Blob([fs.readFileSync("selfie.jpg")]), "target.jpg");
const response = await fetch("https://api.deepidv.com/v1/face/compare", {
method: "POST",
headers: { "x-api-key": "YOUR_API_KEY" },
body: form,
});
const data = await response.json();
import requests
with open("id-photo.jpg", "rb") as src, open("selfie.jpg", "rb") as tgt:
response = requests.post(
"https://api.deepidv.com/v1/face/compare",
headers={"x-api-key": "YOUR_API_KEY"},
files={"source": src, "target": tgt},
)
Response
200 — Success
| Field | Type | Description |
|---|---|---|
isMatch | boolean | True when confidence >= threshold |
confidence | number | Raw similarity score from AWS Rekognition, 0–100 (not normalized) |
threshold | number | Server-side similarity threshold used for isMatch, 0–100 |
sourceFaceDetected | boolean | True when a face was detected in source |
targetFaceDetected | boolean | True when a face was detected in target |
Error responses
| Status | Description |
|---|---|
400 | Invalid body, unsupported image format, or image larger than 15 MB |
401 | Missing or invalid x-api-key |
402 | Insufficient token balance |
403 | A supplied source/target S3 key is not readable by this organization |
429 | Rate limit exceeded |
500 | Unexpected server error — safe to retry with backoff |
{
"isMatch": true,
"confidence": 96.4,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 62.1,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 0,
"threshold": 80,
"sourceFaceDetected": false,
"targetFaceDetected": true
}
{
"isMatch": false,
"confidence": 0,
"threshold": 80,
"sourceFaceDetected": true,
"targetFaceDetected": false
}
Telling failure modes apart
The response shape lets you distinguish three distinctisMatch: false outcomes without a second API call:
| Outcome | confidence | sourceFaceDetected | targetFaceDetected |
|---|---|---|---|
| Both faces found, similarity too low | > 0 | true | true |
| No face in source | 0 | false | true/false |
| No face in target | 0 | true | false |
| No face in either image | 0 | false | false |
sourceFaceDetected is false, a “retake the ID photo” prompt when targetFaceDetected is false, and a “doesn’t match” outcome when both booleans are true but isMatch is false.⌘I