Skip to main content

Face Comparison

Endpoint

POST https://api.verifik.co/v2/face-recognition/compare

Compares a probe image against one or more gallery images and returns a similarity score. Use search_mode to balance speed and accuracy.

Headers

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Params

NameTypeRequiredDescription
probestring[]YesArray with at least one base64 image string.
gallerystring[]YesArray of base64 image strings to compare against.
search_modestringYesOne of FAST or ACCURATE.
compare_min_scorenumberNoPass threshold for the comparison score (0.670.95). Default: 0.85.

Image requirements

Match scores degrade when either face is small, cropped, heavily rotated or occluded. Comparison is more forgiving than liveness, but the same capture guidance still raises your match rates.

See Face Image Requirements for the capture rules and threshold reference shared by the comparison, liveness and search endpoints.

Request

const fetch = require("node-fetch");

async function run() {
const res = await fetch("https://api.verifik.co/v2/face-recognition/compare", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_TOKEN}`,
},
body: JSON.stringify({
probe: ["<base64>"];
gallery: ["<base64>", "<base64>"];
search_mode: "ACCURATE"
}),
});
console.log(await res.json());
}

run();

Response

{
"id": "AB12C",
"data": {
"score": 0.91
},
"signature": {
"message": "Certified by Verifik.co",
"dateTime": "January 16, 2024 3:44 PM"
}
}

Face-match thresholds

ContextTypical / allowed values
Hosted SmartEnroll / project flow default0.85 (compareMinScore)
Direct API (compare_min_score)0.670.95 (default 0.85 if omitted)

Printed document faces (for example a Colombian CC photo vs a live selfie) often score lower than live-vs-live matches. A score around 0.67–0.75 can still be a valid match for printed-document gallery images; lowering the threshold increases acceptance of genuine printed-doc matches and may raise false accepts. Prefer face-focused gallery/probe images; server-side cropFace is not supported on face-recognition compare endpoints (omit the field; prepare crops client-side if needed).

Notes

  • probe and gallery must be base64 strings; images shorter than ~100 characters are rejected with 412:only_images_in_base64.
  • search_mode must be FAST or ACCURATE (required by validation).
  • Response is wrapped with id, data, and signature per standard middleware.
  • There is no GET /v2/face-verifications/:id. To read a SmartEnroll face-compare result, use GET /v2/app-registrations/:id?populates[]=compareFaceVerification. FaceVerification records expire after about 90 days in production (shorter in development).