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
| Scenario | scenes value | Result labels |
|---|---|---|
| Pornography detection | porn | normal, sexy, porn |
| Terrorism and politically sensitive content detection | terrorism | normal, bloody, explosion, outfit, logo, weapon, politics, violence, crowd, parade, carcrash, flag, location, drug, gamble, others |
| Ad violation detection | ad | normal, ad, politics, porn, abuse, terrorism, contraband, spam, npx, qrcode, programCode |
| QR code detection | qrcode | normal, qrcode, programCode |
| Undesirable scene detection | live | normal, meaningless, PIP, smoking, drivelive, drug, gamble |
| Logo detection | logo | normal, TV, Trademark |
You can specify multiple scenarios in a single request. When you do, each scenario is billed separately.
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
callbackparameter when submitting tasks. Content Moderation POSTs results to your URL as they complete.Polling: Call
/green/image/resultsafter submitting tasks. Query at 30-second intervals.
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
bizType | String | No | default | The business scenario. Create and manage scenarios in the Content Moderation console. See Customize policies for machine-assisted moderation. |
scenes | StringArray | Yes | ["porn"] | The moderation scenarios. Valid values: porn, terrorism, ad, qrcode, live, logo. Specify multiple scenarios as an array: ["porn","terrorism"]. |
callback | String | No | http://www.example.com/callback | The 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. |
seed | String | No | abc_123 | A random string used to generate the callback signature. Up to 64 characters: letters, digits, and underscores. Required when callback is set. |
cryptType | String | No | SHA256 | The 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). |
offline | Boolean | No | false | The 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. |
tasks | JSONArray | Yes | — | The 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:
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
dataId | String | No | img-001 | The 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. |
url | String | Yes | https://example.com/image.png | The image URL. Must be HTTP or HTTPS and publicly accessible. Up to 2,048 characters. |
clientInfo | JSONObject | No | {"userId":"123","userNick":"Alice"} | Client information. Overrides the global clientInfo parameter when set. See Common parameters. |
extras | JSONObject | No | — | Additional parameters. Not required for image moderation. |
interval | Integer | No | 2 | The 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. |
maxFrames | Integer | No | 20 | The 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
intervalframes.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
| Parameter | Type | Example | Description |
|---|---|---|---|
code | Integer | 200 | The HTTP status code. See Common error codes. |
msg | String | OK | The response message. |
dataId | String | img-001 | The ID of the moderation object, echoed from the request. |
taskId | String | fdd25f95-4892-4d6b-aca9-7939bc6e9baa-1486198766695 | The moderation task ID. Use this to query results via /green/image/results. |
url | String | https://example.com/image.png | The 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 ofUID + Seed + Content, whereUIDis 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/resultssuccess response.
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
offlinesetting:offline=false(default): task ID valid for 1 houroffline=true: task ID valid for 24 hours
QPS limit
50 calls per second per account. Exceeding this limit triggers throttling.
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
body | JSONArray | Yes | ["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
| Parameter | Type | Example | Description |
|---|---|---|---|
code | Integer | 200 | The HTTP status code. See Common error codes. |
msg | String | OK | The response message. |
dataId | String | uuid-xxxx-xxx-1234 | The ID of the moderation object, echoed from the original request. |
taskId | String | img4wlJcb7p4wH4lAP3111111-123456 | The moderation task ID. |
url | String | http://www.example.com/image.jpg | The image URL. Up to 2,048 characters. |
storedUrl | String | http://www.example.com/evidence | The OSS URL of stored image evidence. Populated only when evidence storage is enabled and the image matches the storage rule. |
extras | JSONObject | — | Additional information. For ad moderation, contains hitLibInfo — details about custom text library matches. See hitLibInfo. |
results | JSONArray | — | Moderation results. Contains one or more result objects when HTTP 200 is returned. See result. |
result
| Parameter | Type | Example | Description |
|---|---|---|---|
scene | String | terrorism | The moderation scenario. Valid values: porn, terrorism, ad, qrcode, live, logo. |
label | String | sexy | The result category. See Result labels for values per scenario. |
sublabel | String | — | The subcategory. Returned only for porn and terrorism scenarios, and only when enabled. |
suggestion | String | block | The recommended action. Valid values: pass (no action needed), review (manual review required), block (violation — delete or restrict content). |
rate | Float | 91.54 | The confidence score, from 0 to 100. Use suggestion, label, and sublabel together to make moderation decisions — do not rely on rate alone. |
frames | JSONArray | — | Temporary frame URLs for truncated long images. Each URL is valid for 5 minutes. See frame. |
hintWordsInfo | JSONArray | — | Risk keywords matched in the image. Returned only for ad moderation. See hintWordsInfo. |
qrcodeData | StringArray | ["http://www.example.com/01ZZOliO"] | Text content extracted from detected QR codes. Returned only for qrcode moderation. |
qrcodeLocations | JSONArray | — | Coordinates of detected QR codes. See qrcodeLocation. |
programCodeData | JSONArray | — | Location of detected mini program codes. Returned only when mini program code detection is enabled. See programCodeData. |
logoData | JSONArray | — | Details of detected logos. Returned only for logo moderation. See logoData. |
sfaceData | JSONArray | — | Details of detected faces in terrorism content. Returned only for terrorism moderation. See sfaceData. |
ocrData | StringArray | — | Full text detected in the image. Not returned by default. Contact your sales manager to enable this. |
Result labels
Pornography detection (`porn`):
| Label | Description |
|---|---|
normal | No violation detected |
sexy | Sexy content |
porn | Pornographic content |
Terrorism and politically sensitive content detection (`terrorism`):
| Label | Description |
|---|---|
normal | No violation detected |
bloody | Bloody content |
explosion | Smoke and light effects |
outfit | Special attire |
logo | Special logo |
weapon | Weapon |
politics | Politically sensitive |
violence | Fighting |
crowd | Crowd |
parade | Protest |
carcrash | Car accident |
flag | Flag |
location | Landmark |
drug | Drug-related |
gamble | Gambling |
others | Other |
Ad violation detection (`ad`):
| Label | Description |
|---|---|
normal | No violation detected |
ad | Other ad |
politics | Text with politically sensitive content |
porn | Text with pornographic content |
abuse | Text with abusive content |
terrorism | Text with terrorist content |
contraband | Text with prohibited content |
spam | Text with spam content |
npx | Spam ad |
qrcode | QR code |
programCode | Mini program code |
QR code detection (`qrcode`):
| Label | Description |
|---|---|
normal | No violation detected |
qrcode | QR code |
programCode | Mini program code |
Undesirable scene detection (`live`):
| Label | Description |
|---|---|
normal | No violation detected |
meaningless | No content (black screen, white screen, etc.) |
PIP | Picture-in-Picture (PiP) |
smoking | Smoking |
drivelive | In-car livestream |
drug | Drug-related |
gamble | Gambling |
Logo detection (`logo`):
| Label | Description |
|---|---|
normal | No violation detected |
TV | Controlled logo (TV station logo) |
Trademark | Trademark |
frame
| Parameter | Type | Example | Description |
|---|---|---|---|
rate | Float | 89.85 | The confidence score, from 0 to 100. Do not use this value in business logic. |
url | String | http://www.example.com/image-0.jpg | The temporary URL of the frame. Valid for 5 minutes. |
programCodeData
| Parameter | Type | Example | Description |
|---|---|---|---|
x | Float | 11.0 | The x-coordinate of the upper-left corner of the mini program code region. Origin is the upper-left corner of the image. Unit: pixel. |
y | Float | 0.0 | The y-coordinate of the upper-left corner of the mini program code region. Origin is the upper-left corner of the image. Unit: pixel. |
w | Float | 402.0 | The width of the mini program code region. Unit: pixel. |
h | Float | 413.0 | The height of the mini program code region. Unit: pixel. |
logoData
| Parameter | Type | Example | Description |
|---|---|---|---|
type | String | TV | The logo type. TV indicates a TV station logo. |
name | String | Example TV | The name of the detected logo. |
x | Float | 140 | The x-coordinate of the upper-left corner of the logo region. Unit: pixel. |
y | Float | 68 | The y-coordinate of the upper-left corner of the logo region. Unit: pixel. |
w | Float | 106 | The width of the logo region. Unit: pixel. |
h | Float | 106 | The height of the logo region. Unit: pixel. |
sfaceData
| Parameter | Type | Example | Description |
|---|---|---|---|
x | Float | 49 | The x-coordinate of the upper-left corner of the face region. Unit: pixel. |
y | Float | 39 | The y-coordinate of the upper-left corner of the face region. Unit: pixel. |
w | Float | 97 | The width of the face region. Unit: pixel. |
h | Float | 131 | The height of the face region. Unit: pixel. |
faces | JSONArray | — | The detected faces. Each element contains: name (String, matched person name), rate (Float, confidence score from 0–100), id (String, face ID). |
hitLibInfo
| Parameter | Type | Example | Description |
|---|---|---|---|
context | String | Haokan Video | The matched text from the custom library. |
libCode | String | 123456 | The code of the custom library containing the matched text. |
libName | String | My text library | The name of the custom library containing the matched text. |
hintWordsInfo
| Parameter | Type | Example | Description |
|---|---|---|---|
context | String | Good video | The risk keyword matched in the image. |
qrcodeLocation
| Parameter | Type | Example | Description |
|---|---|---|---|
x | Float | 11.0 | The x-coordinate of the upper-left corner of the QR code region. Unit: pixel. |
y | Float | 0.0 | The y-coordinate of the upper-left corner of the QR code region. Unit: pixel. |
w | Float | 402.0 | The width of the QR code region. Unit: pixel. |
h | Float | 413.0 | The height of the QR code region. Unit: pixel. |
qrcode | String | http://www.example.com/0.ZZOliO | The 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
}
]
}
]
}
]
}