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.
cropFacebooleanNoIf supported, attempts to crop faces before comparison.

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"
}
}

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.