The Compare with Liveness Detection API is designed to perform liveness detection on an image provided in the "probe" parameter. Once liveness detection is performed, it proceeds to perform a 1:1 comparison with the image sent in the "gallery" parameter. This API helps verify the authenticity of a face by checking for signs of life, ensuring that the face in the "probe" image comes from a real person and not a static image or video.

Verifik has a guide on what compare services are and how to use them; we invite you to read it: Compare Guide.

You can use the liveness score to determine whether the face in the probe image is live (above a specified threshold) or not. This API is valuable for improving security and ensuring that only live faces are allowed access to systems or services.

Compare 1:1 Vs Face verify

If you have read all the guides in this documentation, you may have noticed that these services perform very similar processes, so what sets them apart?:

The differentiating factor between these services is how the comparison process is performed:

Implementation

Request

import axios from 'axios';

const options = {
  method: 'POST',
  url: '<https://api.verifik.co/v2/face-recognition/compare-live>',
  params: {
  },
  headers: {
    Accept: 'application/json',
    Authorization: 'jwt <tu_token>'
  },
  data: {
    os: 'DESKTOP',
    probe: 'base64_encoded_string',
    gallery: ['base64_encoded_string'],
    search_mode: 'FAST/ACCURATE choose one, default FAST',
    liveness_min_score: 0.5
  }
};

try {
 notFou const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}

Response 200 - (Successful response)

{
  "id": "N60Q4",
  "data": {
    "__v": 0,
    "_id": "65a6a2726cb7649867795954",
    "type": "compareLive",
    "probe": [
      "Image URL"
    ],
    "client": "64404b1f9856cc8cebd762e7",
    "result": {
      "score": 1,
      "liveness_score": "0.98"
    },
    "deleted": false,
    "gallery": [
      "Image URL"
    ],
    "createdAt": "2024-01-16T15:36:24.754Z",
    "updatedAt": "2024-01-16T15:36:24.754Z",
    "comparedAt": "2024-01-16T15:36:18.443Z",
    "search_mode": "FAST"
  },
  "signature": {
    "message": "Certified by Verifik.co",
    "dateTime": "January 16, 2024 3:36 PM"
  }
}