POST
Compare two face images (/api/v1/face/compareface_a and face_b) and get a match result. Images can be URLs or Base64. Optionally attach a reference_id to correlate the call on your side.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your app’s secret key, sent as-is — not Bearer. |
AppId | Yes | The App ID from your dashboard. |
Content-Type | Yes | application/json |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
face_a.image | string | Yes | First face image as a URL or a Base64 string. |
face_a.image_type | string | Yes | How face_a.image is encoded: url or base64. |
face_b.image | string | Yes | Second face image as a URL or a Base64 string. |
face_b.image_type | string | Yes | How face_b.image is encoded: url or base64. |
reference_id | string | No | Your own reference for this comparison. |
Response
Returns anentity with a boolean match, a similarity score, the confidence_band, the threshold used, per-image quality, and a correlation_id (echoes the reference_id you sent, if any).
| Field | Type | Description |
|---|---|---|
correlation_id | string | Correlation ID for this comparison. Echoes the reference_id you sent. |
match | boolean | true when similarity is at or above threshold. |
similarity | number | Face-match score from 0 to 1. |
confidence_band | string | Confidence in the match, e.g. low, medium, or high. |
threshold | number | Similarity cutoff used to decide match. Defaults to 0.5. |
quality.face_a | string | Image-quality rating for face_a, e.g. good. |
quality.face_b | string | Image-quality rating for face_b, e.g. good. |
Errors
| Code | Meaning |
|---|---|
400 | Bad request — a required field is missing or an image is malformed. |
401 | Unauthorized — check your key and AppId (no Bearer prefix). |
402 | Insufficient wallet balance. Fund your wallet. |
429 | Too many requests — back off and retry. |
curl -X POST "https://api.dojah.io/api/v1/face/compare" \
-H "Authorization: {{secret_key}}" \
-H "AppId: {{app_id}}" \
-H "Content-Type: application/json" \
-d '{
"face_a": {
"image": "https://images.dojah.io/face-a.jpg",
"image_type": "url"
},
"face_b": {
"image": "https://images.dojah.io/face-b.jpg",
"image_type": "url"
},
"reference_id": "2345"
}'
const res = await fetch("https://api.dojah.io/api/v1/face/compare", {
method: "POST",
headers: {
Authorization: process.env.DOJAH_SECRET_KEY,
AppId: process.env.DOJAH_APP_ID,
"Content-Type": "application/json",
},
body: JSON.stringify({
face_a: {
image: "https://images.dojah.io/face-a.jpg",
image_type: "url"
},
face_b: {
image: "https://images.dojah.io/face-b.jpg",
image_type: "url"
},
reference_id: "2345"
}),
});
const data = await res.json();
import os, requests
res = requests.post(
"https://api.dojah.io/api/v1/face/compare",
headers={
"Authorization": os.environ["DOJAH_SECRET_KEY"],
"AppId": os.environ["DOJAH_APP_ID"],
},
json={
"face_a": {
"image": "https://images.dojah.io/face-a.jpg",
"image_type": "url"
},
"face_b": {
"image": "https://images.dojah.io/face-b.jpg",
"image_type": "url"
},
"reference_id": "2345"
},
)
data = res.json()
{
"entity": {
"correlation_id": "2345",
"match": true,
"similarity": 0.54,
"confidence_band": "low",
"threshold": 0.5,
"quality": {
"face_a": "good",
"face_b": "good"
}
}
}