Compare two faces
Content type multipart/form-data
Compares the faces in two images and tells you whether they're the same person, with a similarity score. The call is synchronous: you get back the finished run, already charged.
Request
curl -X POST "https://studioapi.kriyam.ai/models/facex/1-1/v1" \ -H "X-API-Key: $KRIYAM_API_KEY" \ -F "file1=@reference.jpg" \ -F "file2=@candidate.jpg" \ -F "threshold=70.0" \ -F "advanced_analysis=True"
Response
Authentication
Send your key in the X-API-Key header. See Authentication.
Request
Body
| Name | Type | Required | Description |
|---|---|---|---|
file1 | file | Required | The reference image. PNG or JPEG, up to 2 MB. |
file2 | file | Required | The image to compare against it. PNG or JPEG, up to 2 MB. |
threshold | number | Optional | Similarity percentage, 0-100, above which a face counts as a match. Default |
advanced_analysis | boolean | Optional | Advanced analysis and AI summary: adds Default |
Response
200 OK
Returns the run envelope. The fields below are what this tool puts inside it.
| Field | Type | Description |
|---|---|---|
result.matched_count | integer | How many compared images matched the reference at the threshold you sent. |
result.results[] | object[] | One entry per compared image, in the order you sent them. |
result.results[].filename | string | Which image this entry is for. |
result.results[].error | string | null | Why this image couldn't be compared — no face found, too blurry. Every other image still returns its own verdict. |
result.results[].is_match | boolean | null | Whether this image is the same person. Null means no verdict (see |
result.results[].similarity | number | null | How alike the two faces are, 0-100 — reported whether or not it clears your threshold. Null only when no face could be scored or the comparison errored. |
result.results[].source_face_confidence | number | null | How sure the detector is that it found a face in the reference image, 0-100. About detection, not about the match. |
result.results[].target_face_confidence | number | null | The same, for this compared image. |
result.results[].source_bounding_box | object | null | Where the face sits in the reference image — |
result.results[].target_bounding_box | object | null | The same, for this compared image. |
result.results[].target_quality | object | null |
|
result.results[].face_details.reference | object | null | What face detection read from the reference photo's face. Null if it couldn't read one — the comparison itself is unaffected. |
result.results[].face_details.target | object | null | The same, for the compared image. |
result.results[].face_details.*.confidence | number | How sure detection is that this is a face, 0-100. |
result.results[].face_details.*.age_range | object | null | Estimated age range, |
result.results[].face_details.*.gender | object | null |
|
result.results[].face_details.*.face_occluded | object | null |
|
result.results[].face_details.*.sunglasses | object | null | Whether sunglasses are worn, with |
result.results[].face_details.*.eyeglasses | object | null | Whether ordinary glasses are worn, with |
result.results[].face_details.*.eyes_open | object | null | Whether both eyes are open, with |
result.results[].face_details.*.beard | object | null | Whether there is a beard, with |
result.results[].face_details.*.mustache | object | null | Whether there is a mustache, with |
result.results[].face_details.*.quality | object | null |
|
result.results[].face_details.*.pose | object | null | Head angle in degrees: |
result.results[].face_details.*.face_size_percent | number | null | How much of the photo the face's box covers, as a percentage. Larger faces compare more reliably. |
result.results[].quality_warnings.reference[] | object[] | Problems with the reference photo that make the score less certain. Empty when there are none. Warnings never change |
result.results[].quality_warnings.target[] | object[] | The same, for the compared image. |
result.results[].quality_warnings.target[].code | string | Stable — branch on this: |
result.results[].quality_warnings.target[].message | string | The problem in words, with its figure — e.g. |
result.human_review.required | boolean | Whether a person should confirm this result before you rely on it. Always present. True when a photo has a quality warning, the score is within 5 of your threshold, there is no verdict, or the AI analysis recommends it. |
result.human_review.reasons[] | string[] | Why, one entry per reason, e.g. |
result.advanced_analysis | object | Present only when you sent |
result.advanced_analysis.human_review | object | null | The AI's own call — |
result.advanced_analysis.summary | string | null | A plain-language read of the result, written from the score, the face details and the quality warnings. Points a reviewer should act on are in bold. It never overrides |
result.advanced_analysis.available | boolean | Whether the AI summary was written. False means it couldn't be — see |
result.advanced_analysis.summary_format | string |
|
result.advanced_analysis.error | string | null | Why the summary couldn't be written, when |
Errors
| Status | Code | When |
|---|---|---|
| 400 | — | An image is empty, over 2 MB, or can't be decoded. The message names which. |
Every keyed call can also get401402403404429— see Errors.
