• Console

›Identity Verification Basic

FaceID service introduction

  • FaceID
  • FaceID-Pro

Identity Verification Basic

  • App-GetBizToken
  • App-Verify
  • App-Authentication
  • H5-Raw-UploadVideo
  • H5-Raw-Verify

Identity Verification Premium

  • APP_Pro-Access-Guide
  • APP_Pro-Authentication
  • APP_Pro-Encrption-Guide
  • APP_Pro-GetBiztoken
  • APP_Pro-Liveness
  • APP_Pro-Verify
  • H5-Lite_Pro-Access-Guide
  • H5-Lite_Pro-GetToken
  • H5-Lite_Pro-Redirect-To-Liveness-URL
  • H5-Lite_Pro-Callbacks
  • H5-Lite_Pro-GetResult
  • H5-Lite_Pro-UsinginAnApp
  • H5-Lite_Pro-UI-Customization
  • H5-Lite_Pro-RTC-Compatibility

OCR

  • Indonesian_ID_Card
H5-Raw-UploadVideo

Describe

This API uploads a video selfie for liveness detection. After the video is successfully uploaded, you can use the returned token_still to call the Raw-Verify API to obtain the comparison and liveness detection results. You can call this API if the apikey has passive liveness detection permissions of the API service. Otherwise, the API returns the error code 403 (AUTHORIZATION_ERROR:Denied).

Call URL

Singapore region :https://api-sgp.megvii.com/faceid/lite/raw/validate_still

Note : Please use HTTPS in production environments. HTTP communication is not secure, poses risks, and is not recommended for production environments. If you use HTTP in production environments, service reliability cannot be guaranteed.

Call method

POST Note: Use form-data format to request

Permissions

Only when the user accesses the FaceID product can the FaceID Web APIs be called. Please consult FaceID business personnel for the process of accessing FaceID.

Parameter

Required/optionalparametertypeParameter Description
Requiredapi_keyStringThe api_key used to call this API.
Requiredapi_secretStringThe secret of the api_key used to call this API.
RequiredvideoFileThe video that the user uploads. The format and bitrate of the video must be supported by FFmpeg. The recommended video duration is 1 to 3 seconds. The video size cannot exceed 20 MB.
Optionalbiz_noStringThe string used to identify a verification process. The maximum length is 128 characters. If you want to use this parameter, we recommend that you use the same biz_no for the API calls (such as Raw-ValidateStill and Raw-Verify) in the same verification process and use different biz_no for different verification processes.
Optionalliveness_preferenceStringThis parameter specifies the preferences that are applied to the liveness detection to make it less or more strict.
  • "none": No preference. This is the default value.
  •"still_strict": Perform strict liveness detection on the uploaded video. This setting increases the security level but may affect the pass rate.
If you use other values, the error code 400 (BAD_ARGUMENTS) is returned. Note: This parameter applies to passive liveness detection. The strictness configurations for video liveness detection are in the verify API.
Optionalreturn_imageStringThis parameter specifies whether to return the best-quality image of the video. Valid values:
  •0: Do not return image (default).
  • 1: Return 1 best-quality image (only if the API call is successful).
  •2: Return 2 best-quality images (only if the API call is successful).
Optionalreturn_multifaces_tagStringThis parameter specifies whether to return the multiple faces tag.
  0: Do not return (default)
  1: Return
Optionalface_occlusion_detectionStringThis parameter specifies whether to enable face occlusion detection. Valid values: 0: Disable (default). 1: Enable; if the user's face is obstructed during the entire process, the verification fails.
Optionaleye_close_detectionStringThis parameter specifies whether to enable closed eye detection. Valid values:
  0: Disable .
  1: Enable(default).

Return value description

Fieldtypeillustrate
request_idStringThe unique string to identify each request. This field is always returned.
time_usedIntThe time taken by the entire request in milliseconds. This field is always returned.
biz_noStringThis is returned only if the biz_no parameter is specified when you call this API, regardless of whether the request fails. The value is the same as the one you specify.
token_stillStringThis field is returned only if the call is successful. The returned token is used to call the Raw-Verify API. The length of the value cannot exceed 1024 bytes. Note: The token is valid for 24 hours.
image_bestStringThe field is returned if the call is successful and return_image is 1 or 2. The value of this field is the base64 string of the best-quality JPEG image that will be used for face comparison. In abnormal circumstances, the value of this field might be null.
image_best_2StringThis field is returned if the call is successful and return_image is 2. The value of this field is the base64 string of the other best-quality JPEG image. In abnormal circumstances (for example, if there is only one image that meets the quality requirements), the value of this field might be null.
error_messageStringThis string is returned if the request fails. For the details of this field, see the "Error codes" section below. If the request is successful, this field is not returned.

Return value example

Correct request return example

{
    "time_used": 6206,
    "biz_no": "12345",
    "token_still": "68d32116d9ba2d2662812df30705dcb5",
    "request_id": "1491803871,dc23ec02-5ab5-48a4-8fe9-95f4eeb37699",
    "image_best": "data:image/jpeg;base64,..."
}

Failed request return example

{
    "time_used": 1,
    "error_message": "MISSING_ARGUMENTS: video",
    "request_id": "1491803987,5c52c7c6-e974-4c83-9f22-9d268d6e35b0"
}

Error code list

HTTP status codeerror messageillustrate
400VIDEO_FACE_NOT_FOUNDNo face is detected in the uploaded video.
400VIDEO_LOW_FACE_QUALITYThe image quality of the face in the uploaded video is low.
400VIDEO_INVALID_DURATIONThe video duration is invalid.
400VIDEO_UNSUPPORTED_FORMATThe video cannot be parsed. FFmpeg does not support the video format or the video is corrupted.
400VIDEO_FACE_OCCLUDEThe face in the uploaded video is obstructed.

General ERROR_MESSAGE

HTTP status codeerror messageillustrate
403AUTHENTICATION_ERRORapi_key and api_secret do not match.
403AUTHORIZATION_ERROR:<reason>The api_key is disabled, call limit is reached, no permission to call this API, or no permission to call this API with the current method. Valid values for <reason> include "Denied." (no permission to call this API).
403CONCURRENCY_LIMIT_EXCEEDEDThe concurrency limit is exceeded.
400MISSING_ARGUMENTS:<key>A required parameter is missing.
400BAD_ARGUMENTS:<key>An error occurred while parsing a parameter (for example, a parameter is a number but a non-numeric string is used, the value is too long, or the value is invalid).
404API_NOT_FOUNDThe API does not exist.
500INTERNAL_ERRORInternal server error. If this error occurs, send the request again. If this persists, contact FaceID customer service or business support.

© 2012-2021 北京旷视科技有限公司 版权所有 | 京ICP备12036813号-6

京公网安备 11010802025957号