Liveness Check v3
Input image requirement
For video
- The input video does not exceed 10MB
 - The video has at least 25fps and the minimum resolution of 720p (HD) to ensure accuracy
 - There must be only 1 face in video
 - The face area must take up at least 30% the total video frame
 - The face must not out of frame during video
 - The face must not contain spotlight or be covered or in backlit condition or out of focus
 - The video must have frontal face
 - The video is 5-6 seconds long.
 
For attached image (to compare the face)
- 
The image to be compared with video does not exceed 5MB and has the minimum resolution of 800x600.
 - 
The face area must take up at least 40% the total image
 
Standard image

Poor-quality image/video
- Image with low quality or covered face
 - Video is blurry, made with low-quality camera
 
API Information
Request Url
POST https://api.fpt.ai/vision/ekyc/liveness
Request Headers
| Parameter | Required | Default | Description | 
|---|---|---|---|
| api_key | Yes | your api_key (from console.fpt.ai) | 
Request Body
FormData containing the video and image to be checked
| Parameter | Required | Value | Description | 
|---|---|---|---|
| video | Yes | path-to-video.mp4 | Video of customer’s face naturally moving | 
| cmnd | No | path-to-id.png | Image to be compared with the straightest face in video | 
Sample Request
curl --location --request POST 'https://api.fpt.ai/vision/ekyc/liveness' \
--header 'api-key: xxxxxxxx' \
--form 'video=@"/video.mp4"' \
--form 'cmnd=@"/face.jpg"'
Response
JSON
{
    "code": "200",
    "message": "request successful",
    "liveness": {
        "code": "200",
        "message": "liveness check successful",
        "is_live": "true",
        "spoof_prob": "0.0015",
        "need_to_review": "false",
        "is_deepfake": "false",
        "deepfake_prob": "0.0",
        "warning": "Resolution of video is too low. Please upload video with at least HD resolution to ensure accuracy"
    },
    "face_match": {
        "code": "200",
        "message": "face matching successful",
        "isMatch": "false",
        "similarity": "18.45",
        "warning": "N/A"
    }
}
Returned Information
| Fields | Description | 
|---|---|
| code | Code/Error | 
| is_live | Liveness detection result. True if prob < 0.5, otherwise False | 
| spoof_prob | Probability of spoof | 
| is_deepfake | Deepfake detection result (deepfake result is returned incase low resolution input). True if deepfake_prob >= 0.5, otherwise False | 
| deepfake_prob | Probability of deepfake | 
| face_match | Face matching result | 
| warning | Warning when input quality may harm the accuracy | 
Code
| Code | Meaning | 
|---|---|
| 200 | No error, see more results in the above fields | 
| 301 | Face in video is spoof | 
| 302 | Video seems like deepfake | 
| 303 | Face is not matching with document | 
| 406 | Face quality is not good enough (covered, too dark/bright..) | 
| 408 | More than 1 face in the video | 
| 409 | No video uploaded/Wrong extension/Video is too short/Invalid input | 
| 410 | No face/Lost face in the video | 
| 411 | The face is too small | 
| 412 | The face is too blurry | 
| 413 | Video is still image | 
| 422 | No frontal face in video | 
| 423 | Face is out of frame during video | 
Sample Response: Success
{
    "code": "200",
    "message": "request successful",
    "liveness": {
        "code": "200",
        "message": "liveness check successful",
        "is_live": "true",
        "spoof_prob": "0.3587",
        "need_to_review": "false",
        "is_deepfake": "N/A",
        "deepfake_prob": "N/A",
        "warning": ""
    },
    "face_match": {
        "code": "200",
        "message": "face matching successful",
        "isMatch": "true",
        "similarity": "99.97",
        "warning": "N/A"
    }
}
Sample Response: Error
{
    "code": "303",
    "message": "face is not matching with document",
    "liveness": {
        "code": "200",
        "message": "liveness check successful",
        "is_live": "true",
        "spoof_prob": "0.3433",
        "need_to_review": "false",
        "is_deepfake": "N/A",
        "deepfake_prob": "N/A",
        "warning": ""
    },
    "face_match": {
        "code": "303",
        "message": "face is not matching with document",
        "isMatch": "false",
        "similarity": "0.7",
        "warning": "N/A"
    }
}
{
    "code": "407",
    "message": "No faces detected in document",
    "liveness": {
        "code": "200",
        "message": "liveness request successful",
        "is_live": "true",
        "spoof_prob": "0.3805",
        "need_to_review": "false",
        "is_deepfake": "N/A",
        "deepfake_prob": "N/A",
        "warning": ""
    },
    "face_match": {
        "code": "407",
        "message": "No faces detected in document",
        "isMatch": "N/A",
        "similarity": "N/A",
        "warning": "N/A"
    }
}
{
    "code": "413",
    "message": "Video may seem like image",
    "liveness": {
        "code": "413",
        "message": "Video may seem like image",
        "is_live": "false",
        "spoof_prob": "N/A",
        "need_to_review": "false",
        "is_deepfake": "N/A",
        "deepfake_prob": "N/A",
        "warning": ""
    },
    "face_match": {
        "code": "N/A",
        "message": "N/A",
        "isMatch": "N/A",
        "similarity": "N/A",
        "warning": "N/A"
    }
}
{
    "code": "409",
    "message": "Invalid upload image",
    "liveness": {
        "code": "409",
        "message": "Invalid upload image",
        "is_live": "N/A",
        "spoof_prob": "N/A",
        "need_to_review": "N/A",
        "is_deepfake": "N/A",
        "deepfake_prob": "N/A",
        "warning": "N/A"
    },
    "face_match": {
        "code": "409",
        "message": "Invalid upload image",
        "isMatch": "N/A",
        "similarity": "N/A",
        "warning": "N/A"
    }
}
Format response like liveness version 2
Response of liveness version 3 is different from liveness version 2. In order to format response like version 2, add parameter URL v2_format=1.
https://api.fpt.ai/vision/ekyc/liveness?v2_format=1
More information about liveness version 2 check this site