All Products
Search
Document Center

AI Guardrails:/green/image/asyncscan and /green/image/results

Last Updated:Mar 31, 2026

Submits asynchronous image moderation tasks and queries moderation results. Use /green/image/asyncscan to moderate images for pornography, terrorism and politically sensitive content, ad violations, QR codes, undesirable scenes, and logos. After submitting tasks, use /green/image/results to poll for results or configure a callback URL to receive results automatically.

/green/image/asyncscan

Submits one or more images for asynchronous moderation. Results are not returned immediately — retrieve them by polling /green/image/results or by configuring a callback URL.

For HTTP request construction, see Request structure and SDK overview.

Billing

Charged per call. For pricing details, see the Content Moderation billing documentation.

Response timeout

The maximum response time for a synchronous moderation request is 6 seconds. If moderation is not completed within 6 seconds, a timeout error is returned. If you do not require results in real time, use asynchronous moderation requests. When calling synchronous moderation operations, set the timeout period to 6 seconds.

Moderation scenarios

Scenarioscenes valueResult labels
Pornography detectionpornnormal, sexy, porn
Terrorism and politically sensitive content detectionterrorismnormal, bloody, explosion, outfit, logo, weapon, politics, violence, crowd, parade, carcrash, flag, location, drug, gamble, others
Ad violation detectionadnormal, ad, politics, porn, abuse, terrorism, contraband, spam, npx, qrcode, programCode
QR code detectionqrcodenormal, qrcode, programCode
Undesirable scene detectionlivenormal, meaningless, PIP, smoking, drivelive, drug, gamble
Logo detectionlogonormal, TV, Trademark

You can specify multiple scenarios in a single request. When you do, each scenario is billed separately.

Note For ad violation and QR code detection, configure the detection labels to match your use case. See Customize policies for machine-assisted moderation.

QPS limit

50 calls per second per account. Exceeding this limit triggers throttling.

Image requirements

  • URL format: HTTP or HTTPS

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

  • Maximum size: 20 MB

  • Download timeout: 3 seconds. Images that cannot be downloaded within 3 seconds return a timeout error.

  • Minimum resolution: 256 × 256 pixels (recommended for best moderation accuracy)

  • Storage: Use Object Storage Service (OSS) or Content Delivery Network (CDN) for reliable image availability.

Retrieving results

Moderation results are retained for up to 1 hour (or 24 hours if offline is set to true). Two retrieval options:

  • Callback notification: Set the callback parameter when submitting tasks. Content Moderation POSTs results to your URL as they complete.

  • Polling: Call /green/image/results after submitting tasks. Query at 30-second intervals.

Request parameters

ParameterTypeRequiredExampleDescription
bizTypeStringNodefaultThe business scenario. Create and manage scenarios in the Content Moderation console. See Customize policies for machine-assisted moderation.
scenesStringArrayYes["porn"]The moderation scenarios. Valid values: porn, terrorism, ad, qrcode, live, logo. Specify multiple scenarios as an array: ["porn","terrorism"].
callbackStringNohttp://www.example.com/callbackThe callback URL for receiving moderation results. Must support HTTP POST, UTF-8 encoding, and accept the checksum and content parameters. If not set, poll /green/image/results for results.
seedStringNoabc_123A random string used to generate the callback signature. Up to 64 characters: letters, digits, and underscores. Required when callback is set.
cryptTypeStringNoSHA256The encryption algorithm for callback notifications. Valid values: SHA256 (HMAC-SHA256, default), SM3 (HMAC-SM3, returns a lowercase hexadecimal string; for example, 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0 is returned after you encrypt abc using the HMAC-SM3 algorithm).
offlineBooleanNofalseThe moderation mode. true: nearline mode — tasks are queued and start within 24 hours. false: real-time mode (default) — requests beyond the concurrency limit are rejected.
tasksJSONArrayYesThe list of images to moderate. Up to 100 elements per request. To submit 100 objects at a time, you must raise the relevant concurrency limit to a number greater than 100. See task parameters.

Task parameters

Each element in tasks uses the following structure:

ParameterTypeRequiredExampleDescription
dataIdStringNoimg-001The ID of the moderation object. Up to 128 characters: letters, digits, hyphens (-), underscores (_), and periods (.). Echoed in the response to correlate results with your data.
urlStringYeshttps://example.com/image.pngThe image URL. Must be HTTP or HTTPS and publicly accessible. Up to 2,048 characters.
clientInfoJSONObjectNo{"userId":"123","userNick":"Alice"}Client information. Overrides the global clientInfo parameter when set. See Common parameters.
extrasJSONObjectNoAdditional parameters. Not required for image moderation.
intervalIntegerNo2The frame capture interval for GIF images and long images. One frame is captured for every interval frames. Must be used with maxFrames. By default, only the first frame is moderated.
maxFramesIntegerNo20The maximum number of frames to capture from a GIF image or long image. Default: 1. If interval × maxFrames is less than the total frame count, the interval is automatically adjusted.

GIF and long image frame logic:

All examples below use interval and maxFrames together — both parameters are required.

  • GIF images: Treated as a frame array. One frame is captured per interval frames.

  • Long portrait images (height > 400 px and height/width ratio > 2.5): Frame count = ⌈height ÷ width⌉.

  • Long horizontal images (width > 400 px and width/height ratio > 2.5): Frame count = ⌈width ÷ height⌉.

The fee is based on the actual number of frames moderated.

Response parameters

ParameterTypeExampleDescription
codeInteger200The HTTP status code. See Common error codes.
msgStringOKThe response message.
dataIdStringimg-001The ID of the moderation object, echoed from the request.
taskIdStringfdd25f95-4892-4d6b-aca9-7939bc6e9baa-1486198766695The moderation task ID. Use this to query results via /green/image/results.
urlStringhttps://example.com/image.pngThe image URL, echoed from the request. Up to 2,048 characters.

Callback notification format

When Content Moderation pushes results to your callback URL, it includes two parameters:

  • checksum: A SHA-256 hash of UID + Seed + Content, where UID is your Alibaba Cloud account ID. Verify this value on your server to detect tampering.

  • content: A JSON-encoded string. Parse it using the same format as the /green/image/results success response.

Note UID must be an Alibaba Cloud account ID, not a RAM user ID.

If your server returns HTTP 200, the notification is considered delivered. Otherwise, Content Moderation retries the push up to 16 times. After 16 failed attempts, the notification is dropped — check your callback URL if you stop receiving results.

Example

Request:

http(s)://[Endpoint]/green/image/asyncscan
&<Common request parameters>
{
    "scenes": ["porn"],
    "tasks": [
        {
            "dataId": "test4lNSMdggA0c56MMvfYoh4e-1mwxpx",
            "url": "https://www.aliyundoc.com/tfs/TB1urBOQFXXXXbMXFXXXXXXXXXX-1442-257.png"
        }
    ]
}

Response:

{
    "code": 200,
    "msg": "OK",
    "requestId": "95AD868A-F5D2-4AEA-96D4-E0273B8E074C",
    "data": [
        {
            "code": 200,
            "msg": "OK",
            "dataId": "test4lNSMdggA0c56MMvfYoh4e-1mwxpx",
            "taskId": "fdd25f95-4892-4d6b-aca9-7939bc6e9baa-1486198766695",
            "url": "https://www.aliyundoc.com/tfs/TB1urBOQFXXXXbMXFXXXXXXXXXX-1442-257.png"
        }
    ]
}

/green/image/results

Queries the results of asynchronous image moderation tasks submitted via /green/image/asyncscan.

For HTTP request construction, see Request structure and SDK overview.

Billing

Free of charge.

Usage notes

  • Query results 30 seconds after submitting a task.

  • Task IDs expire based on the offline setting:

    • offline=false (default): task ID valid for 1 hour

    • offline=true: task ID valid for 24 hours

QPS limit

50 calls per second per account. Exceeding this limit triggers throttling.

Request parameters

ParameterTypeRequiredExampleDescription
bodyJSONArrayYes["fdd25f95-4892-4d6b-aca9-7939bc6e9baa-1486198766695"]The list of task IDs to query. Up to 100 elements. Get task IDs from the /green/image/asyncscan response.

Response parameters

ParameterTypeExampleDescription
codeInteger200The HTTP status code. See Common error codes.
msgStringOKThe response message.
dataIdStringuuid-xxxx-xxx-1234The ID of the moderation object, echoed from the original request.
taskIdStringimg4wlJcb7p4wH4lAP3111111-123456The moderation task ID.
urlStringhttp://www.example.com/image.jpgThe image URL. Up to 2,048 characters.
storedUrlStringhttp://www.example.com/evidenceThe OSS URL of stored image evidence. Populated only when evidence storage is enabled and the image matches the storage rule.
extrasJSONObjectAdditional information. For ad moderation, contains hitLibInfo — details about custom text library matches. See hitLibInfo.
resultsJSONArrayModeration results. Contains one or more result objects when HTTP 200 is returned. See result.

result

ParameterTypeExampleDescription
sceneStringterrorismThe moderation scenario. Valid values: porn, terrorism, ad, qrcode, live, logo.
labelStringsexyThe result category. See Result labels for values per scenario.
sublabelStringThe subcategory. Returned only for porn and terrorism scenarios, and only when enabled.
suggestionStringblockThe recommended action. Valid values: pass (no action needed), review (manual review required), block (violation — delete or restrict content).
rateFloat91.54The confidence score, from 0 to 100. Use suggestion, label, and sublabel together to make moderation decisions — do not rely on rate alone.
framesJSONArrayTemporary frame URLs for truncated long images. Each URL is valid for 5 minutes. See frame.
hintWordsInfoJSONArrayRisk keywords matched in the image. Returned only for ad moderation. See hintWordsInfo.
qrcodeDataStringArray["http://www.example.com/01ZZOliO"]Text content extracted from detected QR codes. Returned only for qrcode moderation.
qrcodeLocationsJSONArrayCoordinates of detected QR codes. See qrcodeLocation.
programCodeDataJSONArrayLocation of detected mini program codes. Returned only when mini program code detection is enabled. See programCodeData.
logoDataJSONArrayDetails of detected logos. Returned only for logo moderation. See logoData.
sfaceDataJSONArrayDetails of detected faces in terrorism content. Returned only for terrorism moderation. See sfaceData.
ocrDataStringArrayFull text detected in the image. Not returned by default. Contact your sales manager to enable this.

Result labels

Pornography detection (`porn`):

LabelDescription
normalNo violation detected
sexySexy content
pornPornographic content

Terrorism and politically sensitive content detection (`terrorism`):

LabelDescription
normalNo violation detected
bloodyBloody content
explosionSmoke and light effects
outfitSpecial attire
logoSpecial logo
weaponWeapon
politicsPolitically sensitive
violenceFighting
crowdCrowd
paradeProtest
carcrashCar accident
flagFlag
locationLandmark
drugDrug-related
gambleGambling
othersOther

Ad violation detection (`ad`):

LabelDescription
normalNo violation detected
adOther ad
politicsText with politically sensitive content
pornText with pornographic content
abuseText with abusive content
terrorismText with terrorist content
contrabandText with prohibited content
spamText with spam content
npxSpam ad
qrcodeQR code
programCodeMini program code

QR code detection (`qrcode`):

LabelDescription
normalNo violation detected
qrcodeQR code
programCodeMini program code

Undesirable scene detection (`live`):

LabelDescription
normalNo violation detected
meaninglessNo content (black screen, white screen, etc.)
PIPPicture-in-Picture (PiP)
smokingSmoking
driveliveIn-car livestream
drugDrug-related
gambleGambling

Logo detection (`logo`):

LabelDescription
normalNo violation detected
TVControlled logo (TV station logo)
TrademarkTrademark

frame

ParameterTypeExampleDescription
rateFloat89.85The confidence score, from 0 to 100. Do not use this value in business logic.
urlStringhttp://www.example.com/image-0.jpgThe temporary URL of the frame. Valid for 5 minutes.

programCodeData

ParameterTypeExampleDescription
xFloat11.0The x-coordinate of the upper-left corner of the mini program code region. Origin is the upper-left corner of the image. Unit: pixel.
yFloat0.0The y-coordinate of the upper-left corner of the mini program code region. Origin is the upper-left corner of the image. Unit: pixel.
wFloat402.0The width of the mini program code region. Unit: pixel.
hFloat413.0The height of the mini program code region. Unit: pixel.

logoData

ParameterTypeExampleDescription
typeStringTVThe logo type. TV indicates a TV station logo.
nameStringExample TVThe name of the detected logo.
xFloat140The x-coordinate of the upper-left corner of the logo region. Unit: pixel.
yFloat68The y-coordinate of the upper-left corner of the logo region. Unit: pixel.
wFloat106The width of the logo region. Unit: pixel.
hFloat106The height of the logo region. Unit: pixel.

sfaceData

ParameterTypeExampleDescription
xFloat49The x-coordinate of the upper-left corner of the face region. Unit: pixel.
yFloat39The y-coordinate of the upper-left corner of the face region. Unit: pixel.
wFloat97The width of the face region. Unit: pixel.
hFloat131The height of the face region. Unit: pixel.
facesJSONArrayThe detected faces. Each element contains: name (String, matched person name), rate (Float, confidence score from 0–100), id (String, face ID).

hitLibInfo

ParameterTypeExampleDescription
contextStringHaokan VideoThe matched text from the custom library.
libCodeString123456The code of the custom library containing the matched text.
libNameStringMy text libraryThe name of the custom library containing the matched text.

hintWordsInfo

ParameterTypeExampleDescription
contextStringGood videoThe risk keyword matched in the image.

qrcodeLocation

ParameterTypeExampleDescription
xFloat11.0The x-coordinate of the upper-left corner of the QR code region. Unit: pixel.
yFloat0.0The y-coordinate of the upper-left corner of the QR code region. Unit: pixel.
wFloat402.0The width of the QR code region. Unit: pixel.
hFloat413.0The height of the QR code region. Unit: pixel.
qrcodeStringhttp://www.example.com/0.ZZOliOThe URL or content encoded in the detected QR code.

Example

Request:

http(s)://[Endpoint]/green/image/results
&<Common request parameters>
["fdd25f95-4892-4d6b-aca9-7939bc6e9baa-1486198766695"]

Response:

{
    "msg": "OK",
    "code": 200,
    "requestId": "69B41AE8-1234-1234-1234-12D395695D2D",
    "data": [
        {
            "msg": "OK",
            "code": 200,
            "dataId": "test4lNSMdggA0c56MMvfYoh4e-1mwxpx",
            "taskId": "fdd25f95-4892-4d6b-aca9-7939bc6e9baa-1486198766695",
            "url": "https://www.aliyundoc.com/tfs/TB1urBOQFXXXXbMXFXXXXXXXXXX-1442-257.png",
            "extras": {},
            "results": [
                {
                    "scene": "porn",
                    "label": "sexy",
                    "suggestion": "block",
                    "rate": 99.63
                },
                {
                    "scene": "terrorism",
                    "label": "politics",
                    "suggestion": "block",
                    "rate": 91.54,
                    "sfaceData": [
                        {
                            "x": 49,
                            "y": 39,
                            "w": 97,
                            "h": 131,
                            "faces": [
                                {
                                    "id": "AliFace_0001234",
                                    "name": "Hit name",
                                    "rate": 91.54
                                }
                            ]
                        }
                    ]
                },
                {
                    "scene": "ad",
                    "label": "ad",
                    "suggestion": "block",
                    "rate": 99.91,
                    "extras": {
                        "qrcodes": "http://www.aliyundoc.com/0.ZZOliO",
                        "npx": "72.01",
                        "hitCustomLibCode": "8012345000",
                        "hitCustomLibName": "Name of the custom image library",
                        "hitLibInfo": [
                            {
                                "context": "Hit text",
                                "libCode": "123456",
                                "libName": "Name of the custom text library"
                            }
                        ]
                    },
                    "programCodeData": [
                        {
                            "x": 11.0,
                            "y": 0.0,
                            "w": 402.0,
                            "h": 413.0
                        }
                    ],
                    "frames": [
                        {
                            "rate": 89.85,
                            "url": "http://www.aliyundoc.com/xxx-0.jpg"
                        },
                        {
                            "rate": 68.06,
                            "url": "http://www.aliyundoc.com/xxx-1.jpg"
                        }
                    ]
                },
                {
                    "scene": "live",
                    "label": "drug",
                    "suggestion": "block",
                    "rate": 99.91
                },
                {
                    "scene": "qrcode",
                    "label": "qrcode",
                    "suggestion": "review",
                    "rate": 99.91,
                    "qrcodeData": [
                        "http://www.aliyundoc.com/01ZZOliO"
                    ]
                },
                {
                    "scene": "logo",
                    "label": "TV",
                    "suggestion": "block",
                    "rate": 99.9,
                    "logoData": [
                        {
                            "name": "xxx TV",
                            "type": "TV",
                            "x": 140,
                            "y": 68,
                            "w": 106,
                            "h": 106
                        }
                    ]
                }
            ]
        }
    ]
}