/face/v2/verify
1.API Specification
2.Request Params
3.Response Params
4.Error Codes
5.Sample
1.API Specification
This API is used to compare the two faces to validate whether they are the same person.
Image spec
1. Format: JPG(JPEG), PNG
2. Between 128*128 and 6000*6000 (pixels)
3. File size: no larger than 5 MB
Request Method
POST
Request URL
https://cloudapi.peru.accuauth.com/face/v2/verify
Debugging Tool
2.Request Params
2.1 Request Header
Parameter | Type | Required | Description |
---|---|---|---|
X-DF-API-ID | string | Yes | For API credentials,Please visit API Request |
X-DF-API-SECRET | string | Yes | For API credentials,Please visit API Request |
2.2 Request Body
Fields | Type | Required | Description |
---|---|---|---|
file_1 | file | See the note below | The first image file,binary data of the image |
image_base64_1 | string | See the note below | The first image with base64 encoded |
file_2 | file | See the note below | The second image file,binary data of the image |
image_base64_2 | string | See the note below | The second image with base64 encoded |
compare_mode | int | Optional | Compare mode, 0: Compare IDCard photo, 1: Compare two life photos, 2: Server-side automatic classification; The default value is 0 |
Either parameter
file_1
orimage_base64_1
must be provided as a request parameter.Either parameter
file_2
orimage_base64_2
must be provided as a request parameter.You MUST add image stream to multipart/form-data section of POST message when using
file_1
orfile_2
parameter.
3.Response Params
Normal Reponse (200
)
Fields | Type | Description |
---|---|---|
request_id | string | Unique id of each request |
status | string | Response status. OK means "request success", other means "request failure",see Error Codes |
identical | bool | Face match,true means identical,false means nonidentical. |
score | float | The similarity score of the two faces, 0-1 range. the higher the score the more likely that being the same person. |
Note:
If there are multiple faces in the target image, system will select the largest face to match. The identical field is the result of the face comparison at the default threshold of 0.8. when the score is above 0.8, it will return true. If use a custom threshold, compare the score field to a custom threshold to get the comparison results.
Reponse Syntax:
{
"request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e",
"status": "OK",
"identical": true,
"score": 0.928513,
}
4.Error Codes
Code | Status Field |
Description |
---|---|---|
400 |
INVALID_ARGUMENT | Request parameter is invalid |
400 |
DETECTION_FAILED | Detect image failed |
400 |
DOWNLOAD_ERROR | Image download failed |
401 |
UNAUTHORIZED | Anauthorized or access is denied |
401 |
KEY_EXPIRED | Your API ID has expired |
403 |
NO_PERMISSION | You are not authorized to use this API |
403 |
OUT_OF_QUOTA | API calls quota exceeded |
403 |
RATE_LIMIT_EXCEEDED | API request frequency exceeds the limit |
404 |
NOT_FOUND | Requested API cannot be found |
500 |
INTERNAL_ERROR | Internal server error |
Reponse Syntax:
{
"status": "DETECTION_FAILED",
"reason": "no face detected in first image",
"request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e"
}