Liveness Verify
1. Implement eKYC using user portraits at 3 angles
API:
| Method | URL | content-type | 
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v2/ekyc/verify_liveness | multipart/form-data | 
Body:
| Key | Type | Value | Description | 
|---|---|---|---|
| portrait_left | file | example_1.jpg | The user's left image file | 
| portrait_mid | file | example_2.jpg | File image of the user's front face | 
| portrait_right | file | example_3.jpg | The user's right image file | 
{"portrait_right": "iVBORw0KGgoAAAANSU...","portrait_mid": "iVBORw0KGgoAAAANSU...","portrait_left": "iVBORw0KGgoAAAANSU..."} // In the case of ?format_type=base64, the POST method.
Demo Python:
import requestsapi_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"img1_path = '/path/to/your/example_1.jpg'img2_path = '/path/to/your/example_2.jpg'img3_path = '/path/to/your/example_3.jpg'response = requests.post("https://demo.computervision.com.vn/api/v2/ekyc/verify_liveness",auth=(api_key, api_secret),files={ 'portrait_left': open(img1_path, 'rb'),'portrait_mid': open(img2_path, 'rb'),'portrait_right': open(img3_path, 'rb')})print(response.json())
2. Response
The response will be a JSON with the following format:
{"data": {"invalidCode": string,"invalidMessage": string,"matching_mid_left": string,"matching_mid_right": string,"valid": string // (True/False)},"errorCode": string,"errorMessage": string}
Error code table:
| Code | Message | 
|---|---|
| 0 | Success | 
| 1 | The photo does not contain content | 
| 2 | Url is unavailable | 
| 3 | Incorrect image format | 
| 4 | Out of requests | 
| 5 | Incorrect api_key or api_secret | 
| 6 | Incorrect format type | 
Warning error code table:
| Code | Message | 
|---|---|
| 0 | Successful | 
| 1 | The mid image does not contain face | 
| 2 | The left image does not contain face | 
| 3 | The right image does not contain face | 
| 4 | The mid image and the left image do not match | 
| 5 | The mid image and the right image do not match | 
| 6 | Invalid center image | 
| 7 | Invalid left image | 
| 8 | Invalid right image |