InitFaceVerify - Initiate a verification request

Updated at:

This topic describes how to perform liveness detection and face verification by using the InitFaceVerify API.

Image requirements

Photos submitted by your end users for identity verification must meet the following requirements:

  • The photo must be recent. The end user must look directly at the camera with a neutral expression and minimal head tilt.

  • The photo is clear and has proper exposure. The face is not too dark, too bright, or affected by glare.

  • The photo resolution is no greater than 1920x1080 pixels (height x width) and no less than 640x480 pixels (height x width). The height must be greater than the width. Scale the shorter side to 720 pixels with a compression ratio greater than 0.9.

  • The photo size is less than 1 MB.

  • The service can process photos that are rotated clockwise by 90, 180, or 270 degrees.

  • The photo contains only one face.

    Note

    If a photo contains multiple faces, the service verifies the largest face by default.

Example of a valid image: 示例

Initiate a verification request

API operation: InitFaceVerify

Global endpoint: cloudauth.aliyuncs.com (IPv4) or cloudauth-dualstack.aliyuncs.com (IPv6)

Request method: POST and GET

Transport protocol: HTTPS

Description: Call this API before each verification to obtain a CertifyId, which links all API calls for a single authentication request.

QPS limit: Each API has a dedicated limit. See Server-side API QPS limits.

Important

The Financial-grade Real Person Authentication service does not currently support hard caps or automatic suspension based on the number of calls. To control costs and prevent unexpected charges, configure consumption alert rules immediately after integration:

  1. Configure consumption alerts: Set high-value consumption alerts to monitor your spending in real time.

  2. Monitor your resource plan balance: If you have purchased a resource plan, set a resource plan balance alert so you can top up the plan or adjust your call strategy promptly.

  3. Configure business monitoring: See Alert notification settings to monitor for business anomalies and request fluctuations.

Request parameters

Parameter

Type

Required

Description

Example value

SceneId

Long

Yes

The ID of the verification scenario. This ID is automatically generated after you create a verification scenario in the console. For more information about how to create a verification scenario, see Add a verification scenario.

100000****

OuterOrderNo

String

Yes

A unique business identifier that you define for tracking and troubleshooting purposes.

The value can be up to 32 characters long and consist of only letters and digits. Ensure that the value is unique for each request.

e0c34a77f5ac40a5aa5e6ed20c35****

ProductCode

String

Yes

The verification solution.

The only valid value is PV_FV.

PV_FV

Model

String

No

The type of liveness detection. The following values are supported:

Note

Only the following values are supported for the liveness detection type. Custom actions or combinations are not supported.

  • SILENT_LIVENESS: Silent (no action)

  • LIVENESS (default): Blink

  • PHOTINUS_LIVENESS: Blink + Color flash

  • MULTI_ACTION: Blink + Shake head (The order of actions is random)

  • MOVE_ACTION: Move closer and farther away + Blink

  • MULTI_PHOTINUS: Blink + Shake head (The order of actions is random) + Color flash

  • MOVE_PHOTINUS: Move closer and farther away + Color flash

Note
  • The default liveness detection type is supported by the following SDK versions:

    • Android SDK 1.2.6 and later

    • iOS SDK 1.2.4 and later

    • Harmony SDK 1.0.0 and later

  • Other types are supported by the latest SDK versions for Android, iOS, and Harmony. Use the latest SDK version.

MOVE_ACTION

UserId

String

Yes

A custom user ID. The ID must be unique and can contain up to 100 characters.

12345****

CertType

String

No

The document type.

Currently, only identity cards are supported. The only valid value is IDENTITY_CARD.

Note

This solution does not verify the authenticity or consistency of the name and document number. To perform this verification, choose an identity verification solution.

IDENTITY_CARD

CertName

String

No

The real name of your end user.

John Doe

CertNo

String

No

The document number of your end user.

33010312345678****

MetaInfo

String

Yes

The MetaInfo environment parameter. You must obtain this parameter by using the client-side SDK. For more information, see App (SDK) integration.

{
  "zimVer": "3.0.0",
  "appVersion": "1",
  "bioMetaInfo": "4.1.0:1150****,0",
  "appName": "com.aliyun.antcloudauth",
  "deviceType": "ios",
  "osVersion": "iOS 10.3.2",
  "apdidToken": "",
  "deviceModel": "iPhone9,1"
}
Important

This example is for reference only. Do not use it directly in your integration. For more information, see the SDK integration guide.

Mobile

String

No

The mobile phone number of your end user.

1304567****

Ip

String

No

The IP address of your end user.

114.112.xx.xx

FaceContrastPicture

String

No

Note

You can provide a face photo in one of three ways:

  • FaceContrastPicture

  • FaceContrastPictureUrl

  • OSS

If you choose the OSS method, you must specify the OssBucketName and OssObjectName parameters.

The OSS request parameters only support buckets and objects from the OSS service that you authorized when enabling Real Person Verification.

The Base64-encoded photo. If you use the FaceContrastPicture method, check the photo size to avoid submitting an oversized photo.

Note

If you need to upload a large face photo, use the OSS method.

/9j/4AAQSkZJRgABAQAASASBC****

FaceContrastPictureUrl

String

The URL of the face photo. The URL must be a publicly accessible HTTP or HTTPS link.

https://cn-shanghai-aliyun-cloudauth-****.oss-cn-shanghai.aliyuncs.com/verify/****.jpeg

OssBucketName

String

The name of the authorized Object Storage Service (OSS) bucket.

cn-shanghai-aliyun-cloudauth-****

OssObjectName

String

The name of the object in the authorized OSS bucket.

verify/****.jpeg

CallbackUrl

String

No

This parameter specifies the callback URL for verification results. The callback method defaults to GET, and the URL must start with https. After verification is complete, the platform invokes this URL and automatically appends the certifyId and passed fields. The passed field returns the subcode value. Example: https://www.aliyun.com?callbackToken=1000004826&certifyId=shaxxxx&passed=200.

Important
  • A callback is triggered only when the verification process is complete, regardless of whether it passed or failed. The system does not send a notification if a user abandons the process, an exception occurs, or the verification is not started. After you receive the callback, call the query API to get detailed verification information.

  • When you make the API call, the system validates that the provided URL is publicly accessible. If the URL is not accessible, the system returns a 401 error.

  • Your callback endpoint must return an HTTP status code of 200. Otherwise, the system retries the callback twice within 3 seconds.

https://www.aliyun.com

CallbackToken

String

No

A security token that you generate to prevent replay attacks and tampering.

If you set this parameter, the CallbackToken field is included in the callback URL.

NMjvQanQgplBSaEI0sL86WnQplB

Crop

String

No

Specifies whether to allow the face photo to be cropped. Cropping is disallowed by default.

  • T: Allows cropping.

  • F: Disallows cropping.

Note

If the photo was not captured using the standard liveness detection SDK, enabling cropping is recommended.

If you enable this feature, the service first crops and aligns the face in the photo before processing the request.

T

AuthId

String

No

The user authorization ID. The value can be up to 64 characters long.

92d46b9e9e2d703f2897f350d5bd4149

SuitableType

String

No

This parameter configures the elderly-friendly mode for each verification request. You can set a different value for each request based on your app's business attributes, user demographics, and operational features. The default value is 0.

  • 0: Disable. The elderly-friendly mode is disabled for the current verification request.

  • 1: Enable. The elderly-friendly mode is enabled for the current verification request.

  • 2: User's Choice.

    The end user can select the verification mode. The product's landing page provides two options: "Start Authentication" and "Elderly Mode". If the user selects "Elderly Mode", the system enters the elderly-friendly mode.

Note
  • The elderly-friendly mode parameter takes effect only when the liveness detection type Model is set to LIVENESS or MULTI_ACTION.

  • The elderly-friendly mode enhances usability for elderly users or individuals with physical impairments through features like voice prompts, larger fonts, and an optimized UI.

  • The native SDK supports the elderly-friendly mode in version 2.2.5 and later.

    The web SDK supports the elderly-friendly mode. Use the latest SDK version.

  • Enabling the elderly-friendly mode increases the face verification time.

  • You cannot enable the elderly-friendly mode if the device's system-level accessibility mode is active.

0

AppQualityCheck

String

No

Specifies whether to enable the strict face quality check in the SDK.

  • Y: Enable

  • N: Disable (default)

This feature requires separate integration, and enabling it increases the package size. To use this feature, download the package from this link.

Note
  • If you enable this parameter, the SDK must integrate the strict face quality check module.

  • In common occlusion scenarios, such as wearing a hat, mask, or sunglasses, the client prompts the user to try again. This ensures that a high-quality face image is captured before verification. Enabling this check might reduce the face verification success rate.

  • Android SDK 2.3.24 or later is required.

N

NeedMultiFaceCheck

String

No

Specifies whether to block verification if the device detects multiple faces. Valid values:

  • Y: Blocks verification. The client prompts the user to verify again.

  • N (default): Does not block verification. The client sends the largest detected face to the server for a security check.

Y

EnableBeauty

String

No

Enable retouching during face verification.

  • Y: Enable

  • N (default): Disable

Important
  • The parameter takes effect only when the SDK has fully integrated the module version.

  • Enabling retouching does not affect the quality of stored face images.

  • This feature is currently supported only on Android and iOS SDKs.

N

Note

For the OSS input parameters, you can only use the URL, Bucket, and object name that are generated by the OSS instance that you authorized when you activated the identity verification service. For information about how to query the authorized OSS, see Integration process.

If you use the FaceContrastPicture parameter (Base64 encoding of the photo) to pass in a face photo, make sure that the photo is not too large. You can use OSS to upload larger face photos.

Response parameters

Parameter

Type

Required

Description

Example value

RequestId

String

Yes

The unique ID of the request.

130A2C10-B9EE-4D84-88E3-5384FF03****

Message

String

No

The response message.

success

Code

String

Yes

The response code. For more information about response codes, see Response codes and messages.

200

ResultObject.CertifyId

String

No

The unique identifier for the identity verification session.

Warning

Store this ID to simplify future bill reconciliation.

The CertifyId returned by the initialization operation is valid for 30 minutes and can be used for only one verification submission. Use the ID within its validity period and do not reuse it.

91707dc296d469ad38e4c5efa6a0****

Response codes and messages

Code

Message

Description

200

success

The request was successful.

400

Parameter cannot be empty

A required parameter is empty.

401

Invalid parameter

The parameter is invalid. For example, the name or document number might contain invalid characters or fail to meet format requirements.

402

Application configuration not found

The application configuration does not exist.

404

Verification scenario not found

The verification scenario configuration does not exist. Create a verification scenario in the console first.

410

Service not activated

Object Storage Service (OSS) is not activated, or read and write permissions are not granted for OSS. Log on to the CloudAuth console to grant the required permissions. For more information, see Activate and authorize OSS.

411

RAM permission denied

The RAM user does not have the required permissions. You must grant the AliyunAntCloudAuthFullAccess permission to the RAM user.

412

Overdue payment

Your CloudAuth or Object Storage Service (OSS) account has an overdue payment. Top up your account and try again.

414

Device not supported

The current mobile device does not support face verification. Try again with a different device.

415

SDK version not supported

The current SDK version does not support face verification. Upgrade the SDK and try again.

416

OS version not supported

The current operating system version does not support face verification. Upgrade the OS or try again with a different device.

417

Face verification service unavailable

Failed to extract facial features from the provided custom reference photo. Upload a different photo.

419

Image unavailable

The photo failed to download, is empty, or does not meet the resolution requirements.

420

Duplicate data

More than one method was used to submit the photo. You must use only one of the following methods:

  • FaceContrastPicture

  • FaceContrastPictureUrl

  • OSS

421

Image too large

The photo size exceeds 1 MB. Compress the photo or use a different upload method.

422

Download timeout

The photo download timed out after 3 seconds. Check your network connection and try again.

423

Invalid status

The provided CertifyId does not have a "passed" status.

500

System error

An internal system error occurred. Contact support for troubleshooting.