tencent cloud

APIs

DetectAIFakeFaces

Unduh
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-11-17 17:04:48

1. API Description

Domain name for API request: faceid.intl.tencentcloudapi.com.

Based on multimodal AI large model algorithms, this API provides anti-attack detection capabilities for face images and videos. It can effectively identify highly realistic AIGC face swaps, high-definition recaptures, batch black-market attacks, watermarks, and other attack traces, enhancing the anti-counterfeiting security capabilities for images and videos.

A maximum of 5 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DetectAIFakeFaces.
Version Yes String Common Params. The value used for this API: 2018-03-01.
Region No String Common Params. This parameter is not required.
FaceInput No String

Pass in the face image or face video to be detected (currently only single-face detection is supported), encoded in Base64. If both video and image are available in your scenario, we recommend using video for detection. For better detection results, note the following restrictions and recommendations for input data:

  • Base64 value of the image:
    Recommended overall image resolution is 480x640, with the face size above 100X100, captured by the front camera of a mobile phone.
    The Base64-encoded image data is recommended to be no more than 3 MB, and must not exceed 10 MB. Only jpg and png formats are supported.
    Use the standard Base64 encoding method (with = padding). For encoding specifications, refer to RFC4648.

  • Base64 value of the video:
    The Base64-encoded size is recommended to be within 8 MB, and must not exceed 10 MB. mp4, avi, flv, and mov formats are supported, captured by the front camera of a mobile phone.
    Recommended video duration is 2 to 5 seconds, and must not exceed 20 seconds.
    Recommended video resolution is 480x640 (up to 720p supported), with a frame rate between 25 fps and 30 fps.
    Use the standard Base64 encoding method (with = padding). For encoding specifications, refer to RFC4648.

If you do not use Encryption for encrypted transmission, this field is required.

FaceInputType No Integer

Type of the input.

  • Valid values:
    1: image type.
    2: video type.
    Others: the error code InvalidParameter is returned.

If you do not use Encryption for encrypted transmission, this field is required.

Encryption No Encryption

Whether to encrypt the entire request body.

  • Supported encryption algorithms: AES-256-CBC and SM4-GCM.
  • Users with encryption requirements can use this parameter. For details, click the link on the left.
EncryptedBody No String

Encrypted ciphertext.

  • The data format before encryption is as follows: {"FaceInput":"AAAAA","FaceInputType":1}.
ExtraRiskInfo No ExtraRiskInfo

Carries the risk control context of this request at one time, that is, "who, where, and from which IP the request is initiated".

3. Output Parameters

Parameter Name Type Description
AttackRiskLevel String

Detection result for the input image/video, indicating whether a face attack exists.

  • Low: Low attack risk.
  • Mid: Moderate suspected attack.
  • High: High suspected attack.

It is recommended to block requests when the returned value is High, and allow requests when the value is Mid or Low, to better balance security and pass rate.

AttackRiskDetailList Array of AttackRiskDetail

List of detected suspected attack traces. Returned only when AttackRiskLevel is High or Mid.

  • Note: An empty array is returned when no attack trace is detected.
  • This output parameter is for reference only. It is recommended to use the result of AttackRiskLevel in actual applications.
ExtraInfo ExtraInfo

Returns additional information, including details of the matched template.

ExtraRiskResult ExtraRiskResult

Independent container for additional risk conclusions, indicating whether the additional risk check is trustworthy and whether any issues are found.

RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Unencrypted Request Example

Input Example

POST / HTTP/1.1
Host: faceid.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DetectAIFakeFaces
<Common request parameters>

{
    "FaceInputType": 1,
    "FaceInput": "VBORw0KGgoAAAANSUhEUgAAAkYAAAI9CAYAAADfOLduAAABQ2lDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSCwoyGFhYGDIzSspCnJ3UoiIjFJgf87AziDBwMcgwqCQmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsgsz5I1BWZcn/xff7Y4dPvimWmY6lEAV0pqcTKQ/gPEyckFRSUMDIwJQLZyeUkBiN0CZIsUAR0FZM8AsdMh7DUgdhKEfQCsJiTIGci+AmQLJGckpgDZT4BsnSQk8XQkNtReEOD0CFBwNTI3LiTgVpJBSWpFCYh2zi+oLMpMzyhRcASGUKqCZ16yno6CkYGRMQMDKLwhqj/fAIcjoxgHQqzwKgODhTyQ8RQhlniBgWH3OgYG4Z8IMWUDBgYeoGn7/AsSixLhDmD8xlKcZmwEYXNvZ2Bgnfb//+dwBgZ2TQaGv9f///+9/f//v8sYGJhvMTAc+AYADqxgzYM88zoAAAA4ZVhJZk1NACoAAAAIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAAkagAwAEAAAAAQAAAj0AAAAAi/M5dAAAQABJREFUeAHsvWd35EiSbYsIRlCkViW6pmq6Wry71vz/fzEf3n2fpufd"
}

Output Example

{
    "Response": {
        "AttackRiskDetailList": [
            {
                "Type": "SuspectedWatermark"
            }
        ],
        "AttackRiskLevel": "High",
        "RequestId": "2dd93e6f-5121-4bac-8c64-d6ad646663d2"
    }
}

Example2 Full Body Encrypted Request Example

Example of a full-body encrypted request

Input Example

POST / HTTP/1.1
Host: faceid.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DetectAIFakeFaces
<Common request parameters>

{
    "Encryption": {
        "Algorithm": "AES-256-CBC",
        "EncryptList": [
            "EncryptionBody"
        ],
        "CiphertextBlob": "qwRTgn+52FAvnfrGL1oPBsXG4FLBd42YRw",
        "Iv": "vqfsaEOpGJESA=="
    },
    "EncryptedBody": "v32onREKL6bk6WHOGFEjE2M6kvqybGCVTjlm"
}

Output Example

{
    "Response": {
        "AttackRiskDetailList": [
            {
                "Type": "SuspectedWatermark"
            }
        ],
        "AttackRiskLevel": "High",
        "RequestId": "2dd93e6f-5121-4bac-8c64-d6ad646663d2"
    }
}

Example3 Error Example

Image decoding failed

Input Example

POST / HTTP/1.1
Host: faceid.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DetectAIFakeFaces
<Common request parameters>

{
    "FaceInputType": 2,
    "FaceInput": "AAAAHGZ0eXBtcDQyAAAAAWlzb21tcDQxbXA0MgAADXNtb292AAAAbG12aGQAAAAA2qNvttqjb7cAAB9AAACYFgABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAJ/XRyYWsAAABcdGtoZAAAAAHao2+22qNvtwAAAAEAAAAAAACYFgAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAADwAAAAtAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAmBYAAAAUAAEAAAAACXVtZGlhAAAAIG1kaGQAAAAA2qNvttqjb7cAAAJYAAALaFXEAAAAAAAxaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAENvcmUgTWVkaWEgVmlkZW8AAAAJHG1pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQ"
}

Output Example

{
    "Response": {
        "Error": {
            "Code": "FailedOperation.ImageDecodeFailed",
            "Message": "Image decoding failed."
        },
        "RequestId": "0e77ad29-ad65-4901-9efc-b49a6e0a357b"
    }
}

Example4 Checking the IP

Input Example

POST / HTTP/1.1
Host: faceid.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DetectAIFakeFaces
<Common request parameters>

{
    "FaceInputType": 1,
    "FaceInput": "data:image/*peg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aH*wgJC4n**Is**wcKDcpLDAxNDQ0Hyc5PTgy*C******2wBDAQkJCQwLDBgN*Rg*I**h*jI**jIyMjIyMjIyMjIyMjIyMjI*Mj*yM*IyMjIyMjIy*jIy*jI*M***MjI*MjIyMjL/wAARCAMAAwAD**IAAhEBAxEB/8*AHw*A*QU*AQ*BAQEA**A*AAAAAAECAwQFBgcICQoL/8QA*RA*Ag*DAwIE*wUF*AQAAA*9AQI*AA***R*hMU**E1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQ",
    "ExtraRiskInfo": {
        "Latitude": "1.3048",
        "Longitude": "103.8318",
        "Ip": "106.55.202.186"
    }
}

Output Example

{
    "Response": {
        "AttackRiskDetailList": [],
        "AttackRiskLevel": "Mid",
        "ExtraInfo": {},
        "ExtraRiskResult": {
            "BlackListResult": [],
            "RiskDetailList": [
                {
                    "Type": "IpLocationMismatch"
                }
            ],
            "RiskLevel": "High",
            "Status": "Completed"
        },
        "RequestId": "5738fb6b-da7d-417f-af4d-947914e7bdc2"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.CoveredFace The face in the image is occluded. Upload an image with an unobstructed face.
FailedOperation.DetectEngineSystemError Service engine call failed. Try again.
FailedOperation.ImageDecodeFailed Image decoding failed.
FailedOperation.IncompleteFace Full face not detected. Upload an image with a full face.
FailedOperation.PoorImageQuality The image quality is too poor. Check the image quality.
FailedOperation.UnKnown Internal unknown error.
FailedOperation.VideoDecodeFailed Video decoding error.
FailedOperation.VideoDurationExceeded The video duration is too long. The maximum supported video duration for this API is 20 seconds.
InvalidParameter Parameter error.
InvalidParameterValue Parameter value error.
RequestLimitExceeded The number of requests exceeds the frequency limit.
UnauthorizedOperation.Arrears The account is in arrears.
UnauthorizedOperation.ChargeStatusException The billing status is abnormal.
UnauthorizedOperation.Nonactivated The service is not activated.

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan