This topic describes the face deepfake detection API.
API information
Before calling this API, read the integration process and activate the service.
API Name: DeepfakeDetect
API Description: Analyzes a face image or video for deepfake risks. It identifies risks such as AI-generated faces, deepfake face swaps, template attacks, and recaptured faces. The API returns risk tags and confidence scores.
QPS limit: This API has a dedicated QPS limit. For more information, see QPS limits for information verification APIs.
Endpoints:
Region
IPv4
IPv6
common
cloudauth.aliyuncs.com
cloudauth-dualstack.aliyuncs.com
China (Beijing)
cloudauth.cn-beijing.aliyuncs.com
cloudauth-dualstack.cn-beijing.aliyuncs.com
China (Shanghai)
cloudauth.cn-shanghai.aliyuncs.com
cloudauth-dualstack.cn-shanghai.aliyuncs.com
NoteTo reduce latency, select an endpoint that is geographically close to your servers.
You can also create a list of endpoints and poll them in rotation to improve availability.
The Information Verification Service does not support a hard cap on call volume or automatic deactivation. To control costs and prevent high bills, configure spending alert rules after you integrate the service:
Configure spending alerts: Set a spending alert rule (Set high-spending alerts) to monitor your bills in real time.
Monitor data transfer plan balance: If you purchased a data transfer plan, also monitor its balance (Configure remaining quota alerts) to add resources or adjust your call policy promptly.
The face deepfake detection API is a commercial service. The free public beta will end at 23:59:59 on August 30, 2024. After the public beta ends, successful requests will be metered. For more information, see Billing for face deepfake detection.
Image and video requirements
The deepfake detection algorithm is typically used with multi-dimensional data from your business, devices, and user behavior. It is suitable for scenarios where you want to enhance an existing face detection SDK with forged face detection. To ensure stable model performance, you must provide face images or videos captured by a front-facing camera, and ensure the face is at a normal angle. In addition, the following requirements must be met:
Image
Image format: JPG, JPEG.
Image size: 50 KB to 100 KB recommended. Maximum 10 MB. For images larger than 1 MB, we recommend uploading them via URL.
Image resolution: 640×480 (height×width) recommended. Maximum 1920×1080 (height×width). The image height must be greater than its width. We recommend scaling the shorter side to 720 pixels and using a compression ratio of 0.8.
Image quality: The image must be clear and properly exposed. The face must not be too dark or too bright, and must not have any flare or halos.
Multiple faces in an image: If an image contains multiple faces, the system detects the largest face by default.
Video
Video format: MP4, MOV.
Video size: Greater than 100 KB. Maximum 10 MB. For videos larger than 1 MB, we recommend uploading them via URL.
Video duration: 1 to 3 seconds.
Video resolution: 640×480 (height×width) is recommended.
Video frame rate: 8 fps or higher.
For video-based detection, the system uses Qwen to extract 8 frames from the video for processing by default. To ensure detection accuracy, avoid submitting invalid videos.
Request parameters
Parameter | Type | Required | Description | Example |
OuterOrderNo | String | Yes | A 32-character alphanumeric string that uniquely identifies the merchant request. You can structure it with a custom prefix, a timestamp, and a random or incremental suffix. | e0c34a77f5ac40a5aa5e6ed20c****** |
FaceInputType | String | No | The type of face input.
Note Video processing takes longer. We recommend that you set the timeout period to more than 3 seconds. | IMAGE |
FaceUrl | String | Yes Note You must specify either FaceUrl or FaceBase64. | The URL of the face image or video. | https://cn-shanghai-aliyun-cloudauth-xxxxxx.oss-cn-shanghai.aliyuncs.com/verify/xxxxx/xxxxx.jpeg |
FaceBase64 | String | The Base64-encoded string of the face image. For videos, we recommend that you use the URL method. | /9j/4AAQSkZJRgABAQAASxxxxxxx |
Response parameters
Because the detection model was upgraded to a large model for classification, the response has changed as follows:
The Result field no longer returns the value
2(suspicious).The RiskTag field no longer includes
SuspectPSFace.When the RiskScore field indicates a risk, it returns a fixed value of
0.96.
Parameter | Type | Description | Example | |
RequestId | String | The request ID. | 8FC3D6AC-9FED-4311-8DA7-C4BF47D9F260 | |
Code | String | The return code. A value of 200 indicates success, while other values indicate failure. Important
| 200 | |
Message | String | The returned message. | success | |
ResultObject | Result | String | The risk result:
| 1 |
RiskTag | String | The risk tag. Multiple tags are separated by commas (,). Valid values:
| SuspectDeepForgery | |
RiskScore | Map | A map of risk scores. | | |
SDK examples
Before you integrate, read the integration process, activate the service, and get an AccessKey and configure the environment variables.
OpenAPI Explorer: Debug the API online and generate SDK examples.
Code Sample Project: Contains sample projects for calling the SDK in various programming languages, which can be used as an integration reference.

