All Products
Search
Document Center

AI Guardrails:Image face retrieval

Last Updated:Mar 31, 2026

Searches a specified individual group for the top 5 individuals whose faces most closely match a submitted face image, sorted by descending similarity score.

Key concepts

TermDescriptionRelated operations
personAn individual representing a natural personCreate an individual, Update an individual, Get individual details, Delete an individual
faceA face image associated with an individual. One individual can have multiple face images.Add a face, Delete a face
groupA collection of individuals. An individual can belong to multiple groups, and a group can contain multiple individuals.Add individuals to a group, List groups, List individuals in a group, Remove an individual from a group

Operation description

Call imageScan to submit a synchronous image moderation task for Custom Face Retrieval. For details on constructing HTTP requests, see Request structure. Alternatively, use an SDK — see SDK overview.

Billing

You are charged for calling this operation. For more information about the billing methods, see the billing documentation.

Response timeout

The maximum response time for a synchronous moderation request is 6 seconds. If moderation does not complete within 6 seconds, a timeout error is returned. If you do not require moderation results in real time, you can send asynchronous moderation requests. In most cases, results are returned within 1 second. We recommend that you set the timeout period to 6 seconds for calling synchronous moderation operations. Response time may increase when the system is under heavy load, images are large, or images contain a large number of words.

Image requirements

  • Image URL must use HTTP or HTTPS.

  • Supported formats: PNG, JPG, JPEG, BMP, GIF, WEBP.

  • Maximum image size: 20 MB (applies to both synchronous and asynchronous requests).

  • Image download timeout: 3 seconds. If the image cannot be downloaded within 3 seconds, a timeout error is returned.

  • Minimum recommended resolution: 256 × 256 pixels.

  • Use a stable storage service such as Object Storage Service (OSS) or Content Delivery Network (CDN) to host images, to avoid download failures that affect response time.

QPS limits

50 calls per second per account. Exceeding this limit triggers throttling, which may affect your service.

Request syntax

POST /green/image/scan HTTPS|HTTP

Request headers

This operation uses only common request headers. For more information, see Common request headers.

Request parameters

ParameterTypeRequiredExampleDescription
clientInfoJSONObjectNo{"userId":"120234234","userNick":"Mike","userType":"others"}Client information serialized from the ClientInfo structure in JSON format. Includes the unique machine identifier (UMID) and International Mobile Equipment Identity (IMEI). For details, see ClientInfo.

Request body

ParameterTypeRequiredExampleDescription
bizTypeStringNoeduThe business scenario type. Not required for Custom Face Retrieval.
scenesStringArrayYes["sface-n"]The detection scenario. Set to sface-n for Custom Face Retrieval.
tasksJSONArrayYesThe face images to analyze. See the task structure below.

Table 1. task

ParameterTypeRequiredExampleDescription
dataIdStringNotest2NInmOtAON6qYUrtCRgLo-1mwxdiThe ID of the moderation object. Accepts letters, digits, underscores (_), hyphens (-), and periods (.). Maximum length: 128 characters. Use this field to correlate the result with your business data.
urlStringYeshttps://example.com/tfs/TB1urBOQFXXXXbMXFXXXXXXXXXX-1442-257.pngThe URL of the face image to analyze.
extrasJSONObjectYes{"groupId":"group"}Additional parameters. Specify the groupId of the individual group to search. To get all group IDs, call the /green/sface/groups operation.

Response elements

All responses return JSON. For common response parameters, see Common response parameters. The data field contains business-specific results.

The data field may be empty if an error occurs.
ParameterTypeExampleDescription
codeInteger200The HTTP status code. For details, see Common error codes.
resultsJSONArrayThe moderation results. When code is 200, contains one or more result elements.

Table 2. result

ParameterTypeExampleDescription
sceneStringsface-nThe detection scenario. Value: sface-n.
labelStringsface-nThe result category. Valid values: sface-n (similar faces found), normal (no similar faces found).
suggestionStringreviewThe moderation suggestion. Valid values: pass (no action required), review (manual review recommended).
rateFloat0.999The confidence score of the result. Range: 0.00–1.00. A higher value indicates higher confidence.
topPersonDataJSONArrayThe top 5 individuals most similar to the submitted face image. Returns null if no similar individuals are found.

Table 3. topPersonData

ParameterTypeDescription
personsJSONArrayThe top 5 matched individuals. See the person structure below.
faceItemJSONObjectThe detected face location and dimensions in the image. See the faceItem structure below.

Table 4. person

ParameterTypeExampleDescription
personIdStringperson1The ID of the matched individual.
faceIdString14736649593638The ID of the matched face image.
rateFloat0.999The similarity score. The table below shows the relationship between similarity scores and false recognition rates. Use results with a score of 0.9 or higher for reliable matching.

Similarity score and false recognition rate

Similarity score (rate)False recognition rate
0.500.05
0.600.01
0.700.005
0.800.001
0.900.0001
0.920.00001
0.940.000001
0.960.0000001

Table 5. faceItem

ParameterTypeExampleDescription
xFloat467The x-coordinate of the detected face. Unit: pixels.
yFloat199The y-coordinate of the detected face. Unit: pixels.
widthFloat422The width of the detected face. Unit: pixels.
heightFloat422The height of the detected face. Unit: pixels.

Examples

Sample request

POST /green/image/scan HTTP/1.1
Common request headers
{
    "scenes": [
        "sface-n"
    ],
    "tasks": [
        {
            "dataId": "test2NInmOtAON6qYUrtCRgLo-1mwxdi",
            "url": "https://example.com/tfs/TB1urBOQFXXXXbMXFXXXXXXXXXX-1442-257.png",
            "extras": {
                "groupId": "group"
            }
        }
    ]
}

Sample success response

{
    "code": 200,
    "data": [
        {
            "code": 200,
            "dataId": "test2NInmOtAON6qYUrtCRgLo-1mwxdi",
            "msg": "The call is successful.",
            "results": [
                {
                    "topPersonData": [
                        {
                            "faceItem": {
                                "height": 422,
                                "width": 422,
                                "x": 467,
                                "y": 199
                            },
                            "persons": [
                                {
                                    "faceId": "14736649593638",
                                    "personId": "person1",
                                    "rate": "0.999"
                                },
                                {
                                    "faceId": "14736649593637",
                                    "personId": "person2",
                                    "rate": "0.998"
                                }
                            ]
                        }
                    ],
                    "label": "sface-n",
                    "rate": 0.999,
                    "scene": "sface-n",
                    "suggestion": "review"
                }
            ],
            "taskId": "img2MVcKPU1QGD64LoAb4cK6w-1mwxdi",
            "url": "https://example.com/tfs/TB1urBOQFXXXXbMXFXXXXXXXXXX-1442-257.png"
        }
    ],
    "msg": "OK",
    "requestId": "36D384DA-8023-4E84-BCFD-0C5581352C16"
}