Skip to main content

Compare with Liveness (Sequential)

Endpoint​

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

Performs comparison first and, if the comparison meets compare_min_score (or if not provided), proceeds to liveness on the probe with liveness_min_score.

Headers​

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Params​

NameTypeRequiredDescription
probestringYesBase64 image string for the live capture.
gallerystring[]YesArray of base64 image strings to compare against. URLs are supported and will be fetched and converted internally.
search_modestringYesOne of FAST or ACCURATE.
liveness_min_scorenumberNoLiveness threshold; default 0.6 if not provided.
compare_min_scorenumberNoOptional comparison threshold (0.67–0.95).
cropFacebooleanNoIf true, attempts to crop faces in gallery before comparison.

Request​

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

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

run();

Response​

{
"id": "CWL01",
"data": {
"comparison": {
"score": 0.88
},
"liveness": {
"liveness_score": 0.91,
"min_score": 0.6,
"passed": true
}
},
"signature": {
"message": "Certified by Verifik.co",
"dateTime": "January 16, 2024 3:44 PM"
}
}

Notes​

  • Comparison is executed first. Only if compare_min_score is not provided or met, liveness is executed on probe.
  • liveness_min_score defaults to 0.6 if not provided.
  • Gallery supports https URLs and will be downloaded and converted to base64 internally; cropFace optionally crops faces before comparison.