All Products
Search
Document Center

AI Guardrails:Image Moderation V2.0 API

Última atualização: Jul 03, 2026

API overview

The Image Moderation 2.0 API detects images that violate content regulations, disrupt platforms, or degrade user experience. It supports 40+ risk labels and 40+ risk controls. Image Moderation 2.0 returns risk labels and confidence scores for reviewing or moderating images per your platform policies. Image Moderation Pro 2.0: Overview and Billing.

Getting started

  1. Sign up for an Alibaba Cloud account: Register.

  2. Activate pay-as-you-go for Content Moderation: Activate the service. Activation is free, and usage is billed automatically (billing).

  3. Create an AccessKey: Use RAM to create an AccessKey. If you use a RAM user's AccessKey, grant the AliyunYundunGreenWebFullAccess permission to the RAM user from your Alibaba Cloud account. RAM authorization.

  4. Integrate using an SDK. Image Moderation - Enhanced (2.0) SDK and integration guide.

Usage notes

This API creates an image content moderation task. You can construct requests by following the HTTP Native Call guide, or use the pre-built examples in the Access Guide.

  • API operation: ImageModeration

  • Supported regions and endpoints:

    Region

    Public endpoint

    VPC endpoint

    Supported service codes

    Singapore

    green-cip.ap-southeast-1.aliyuncs.com

    green-cip-vpc.ap-southeast-1.aliyuncs.com

    postImageCheckByVL_global, baselineCheck_global, aigcDetector_global, faceDetect_global, faceDetect_pro_global

    China (Hong Kong)

    green-cip.cn-hongkong.aliyuncs.com

    green-cip-vpc.cn-hongkong.aliyuncs.com

    postImageCheckByVL_cb, postImageCheckByVL_global

    UK (London)

    green-cip.eu-west-1.aliyuncs.com

    None

    US (Virginia)

    green-cip.us-east-1.aliyuncs.com

    green-cip-vpc.us-east-1.aliyuncs.com

    baselineCheck_global, aigcDetector_global

    US (Silicon Valley)

    green-cip.us-west-1.aliyuncs.com

    None

    Germany (Frankfurt)

    green-cip.eu-central-1.aliyuncs.com

    green-cip-vpc.eu-central-1.aliyuncs.com

    Note

    The UK (London) region uses the same console configuration as the Singapore region. The US (Silicon Valley) region uses the same console configuration as the US (Virginia) region.

  • Billing:

    Billable. Only successful requests (HTTP 200) are charged; failed requests are not billed. Billing.

  • Image requirements:

    • Supported formats include PNG, JPG, JPEG, BMP, WEBP, TIFF, SVG, and AVIF. For HEIF images, the longest side cannot exceed 8,192 pixels. For GIFs, only the first frame is processed. For ICO files, only the last image is processed.

    • The image must not exceed 20 MB. The height or width cannot exceed 30,000 pixels, and the total number of pixels cannot exceed 250 million. For optimal performance, the image resolution should be at least 200 × 200 pixels. Lower resolutions may degrade algorithm performance.

    • The image must finish downloading within 3 seconds. Otherwise, the request will time out and return an error.

QPS limit

Default limit: 100 QPS per user. Exceeding this limit triggers throttling. To increase the limit, contact your account manager.

Debugging

Debug the Image Moderation API online through Alibaba Cloud OpenAPI before integrating into your application. The portal provides code examples, SDK dependencies, and parameter documentation.

Important

Debugging calls use your account and count toward billed usage.

Request parameters

Required common request parameters: common parameters.

The request body is a JSON object that contains the following fields:

Parameter

Type

Required

Example

Description

Service

String

Yes

baselineCheck_global

The image moderation 2.0 service to use. Valid values:

  • postImageCheckByVL_global: Image Moderation for Large and Small Model Integration

  • baselineCheck_global: Baseline Check

  • aigcDetector_global: AIGC image detection

Note

For more information about the differences between the services, see Service Description. For AIGC-specific services, see AIGC Scenario Detection Service. The Global Edition can be used only in international regions.

ServiceParameters

JSONString

Yes

Content moderation parameters as a JSON string. ServiceParameters.

Table 1. ServiceParameters

Parameter

Type

Required

Example

Description

imageUrl

String

Yes. Specify the image by using one of the following three methods:

  • Use an image URL by specifying the imageUrl parameter.

  • Use OSS authorization by specifying the ossBucketName, ossObjectName, and ossRegionId parameters.

  • Use a local image. When you upload a local image for detection, it does not use your OSS storage, and the file is stored for only 30 minutes. The SDK allows you to upload local images. For code samples, see SDK and integration guide for image moderation 2.0 (Enhanced Edition).

https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png

The URL of the image to be moderated. The URL must be publicly accessible and must not exceed 2,048 characters in length.

Note
  • The URL cannot contain Chinese characters. You can specify only one URL per request.

  • If a request using this method times out, use the OSS authorization method instead.

ossBucketName

String

bucket_01

The name of the authorized OSS Bucket.

Note

To use an internal OSS image URL, you must first grant the AliyunCIPScanOSSRole permission by using your Alibaba Cloud account (root account) on the Cloud Resource Access Authorization page.

ossObjectName

String

2022023/04/24/test.jpg

The name of the object in the authorized OSS Bucket.

Note

1. Specify the original OSS object name. Appending image processing parameters to the name is not supported. To add image processing parameters, use the imageUrl parameter.

2. If the object name contains Chinese characters or spaces, specify the name as is. Do not URL-encode it.

ossRegionId

String

cn-beijing

The region where the OSS Bucket is located.

dataId

String

No

img123****

A unique ID for the object being moderated.

Use this ID to track your business data. The ID can be up to 64 characters long and can contain uppercase and lowercase letters, digits, underscores (_), hyphens (-), and periods (.).

referer

String

No

www.aliyun.com

The Referer request header, used for scenarios such as hotlink protection. The value can be up to 256 characters in length.

infoType

String

Yes

customImage,textInImage

The supplementary information to retrieve. Valid values:

  • customImage: custom image library hit information

  • textInImage: text in image

  • publicFigure: public figure information

  • logoData: logo information

You can specify multiple values separated by commas (,). For example, customImage,textInImage returns both custom image library hit information and text from the image.

Note

Public figure and logo information are returned only for advanced image moderation services. Service Description.

Returned data

Parameter

Type

Example value

Description

RequestId

String

70ED13B0-BC22-576D-9CCF-1CC12FEAC477

Unique request identifier for troubleshooting.

Data

Object

Image content moderation result. Data.

Code

Integer

200

Status code. Code Description.

Msg

String

OK

The response message.

Table 2. Data

Parameter

Type

Example

Description

Result

Array

The image detection results, including risk labels and confidence scores. For more information, see result.

RiskLevel

String

high

The risk level of the image, which is determined by the label with the highest risk. Possible values are:

  • high: high risk

  • medium: medium risk

  • low: low risk

  • none: no risk detected

Note

Take immediate action on high-risk content. Manually review medium-risk content. For low-risk content, take action only if a high recall rate is required; otherwise, treat it as risk-free. You can configure risk thresholds in the Content Moderation console.

DataId

String

img123******

The unique ID of the data object specified in the request.

Note

If you provide a DataId in your request, the same value is returned in this field.

Ext

Object

Extra reference information for the image. For more information, see extra information.

Table 3. Result

Parameter

Type

Example value

Description

Label

String

violent_explosion

The label for the detected content. A single image can have multiple labels, each with a corresponding confidence score. For a list of supported labels, see the following:

Note

For labels related to the Content Moderation LLM service, see the Risk Label Glossary for Content Moderation LLM Service.

Confidence

Float

81.22

The confidence score for the label, on a scale of 0 to 100. The value is accurate to two decimal places. Some labels do not return a confidence score. For more information, see the Risk Label Glossary.

Description

String

Fireworks-related content

A human-readable explanation of the Label value.

Important

This description is for display purposes only and may change. For automation, rely on the Label field.

RiskLevel

String

high

The risk level associated with the label, based on your configured thresholds. Possible values:

  • high: High risk

  • medium: Medium risk

  • low: Low risk

  • none: No risk detected

Additional information

Table 4. Ext

Parameter

Type

Example value

Description

CustomImage

JSONArray

If a match is found in a custom image library, this parameter contains information about the matched library. For more information, see CustomImage.

TextInImage

Object

Returns information about the text recognized in the image. For more information, see TextInImage.

PublicFigure

JSONArray

If a public figure is detected in the image, this parameter returns information about that figure. For more information, see PublicFigure.

LogoData

JSONArray

Returns the matched logo data. For more information, see LogoData.

Table 5. CustomImage

Parameter

Type

Example value

Description

LibId

String

lib0001

The ID of the matched custom image library.

LibName

String

custom image library A

The name of the matched custom image library.

ImageId

String

20240307

The ID of the matched custom image.

Table 6. TextInImage

Parameter

Type

Example value

Description

OcrResult

JSONArray

Information about each line of text recognized in the image. For more information, see OcrResult.

RiskWord

StringArray

[ "risk word 1",

"risk word 2"]

The risk words matched in the text. Returned when a tii label is matched.

CustomText

JSONArray

If a match is found in a custom text library, this parameter contains information about the matched library. For more information, see CustomText.

Table 7. OcrResult

Parameter

Type

Example value

Description

Text

String

Recognized text line 1

The content of a recognized line of text in the image.

Table 8. CustomText

Parameter

Type

Example value

Description

LibId

String

test20240307

The ID of the matched custom text library.

LibName

String

custom text library A

The name of the matched custom text library.

KeyWords

String

custom keyword 1

The matched custom keywords.

Table 9. PublicFigure

Parameter

Type

Example value

Description

FigureName

String

John Doe

The name of the recognized public figure.

FigureId

String

xxx001

The figure ID of the recognized public figure.

Note

Some public figures are identified by a FigureId, while others are identified by FigureName only. We recommend that you check the FigureName parameter first, then check the FigureId parameter if FigureName is empty.

Location

JSONArray

The location of the public figure. For more information, see Location.

Table 10. LogoData

Parameter

Type

Example value

Description

Logo

JSONArray

Information about the logo. For more information, see Logo.

Location

Object

The location of the logo. For more information, see Location.

Table 11. Logo

Parameter

Type

Example value

Description

Name

String

DingTalk

The name of the logo.

Label

String

logo_sns

The matched label.

Confidence

Float

88.18

The confidence score.

Table 12. Location

Parameter

Type

Example value

Description

X

Float

41

The x-coordinate, in pixels, of the upper-left corner of the bounding box relative to the left edge of the image.

Y

Float

84

The y-coordinate, in pixels, of the upper-left corner of the bounding box relative to the top edge of the image.

W

Float

83

The width of the bounding box, in pixels.

H

Float

26

The height of the bounding box, in pixels.

Examples

Request example

{
    "Service": "baselineCheck_global",
    "ServiceParameters": {
        "imageUrl": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png",
        "dataId": "img123****"
    }
}

Response example

  • Response when risk content is detected

    {
        "Msg": "OK",
        "Code": 200,
        "Data": {
            "DataId": "img123****",
            "Result": [
                {
                    "Label": "pornographic_adultContent",
                    "Confidence": 81,
                    "Description": "Adult Content"
                },
                {
                    "Label": "sexual_partialNudity",
                    "Confidence": 98,
                    "Description": "Sexually Suggestive"
                },
                {
                    "Label": "violent_explosion",
                    "Confidence": 70,
                    "Description": "Explosion"
                },
                {
                    "Label": "violent_explosion_lib",
                    "Confidence": 81,
                    "Description": "Explosion (Custom Library)"
                }
            ],
            "RiskLevel": "high"
        },
        "RequestId": "ABCD1234-1234-1234-1234-1234XYZ"
    }
  • Response when no risk content is detected

    {
        "Msg": "OK",
        "Code": 200,
        "Data": {
            "DataId": "img123****",
            "Result": [
                {
                    "Label": "nonLabel",
                    "Description": "No Risk Detected"
                }
            ],
            "RiskLevel": "none"
        },
        "RequestId": "ABCD1234-1234-1234-1234-1234XYZ"
    }
  • Response when an image matches the image allowlist

    {
        "Msg": "OK",
        "Code": 200,
        "Data": {
            "DataId": "img123****",
            "Result": [
                {
                    "Label": "nonLabel_lib",
                    "Confidence": 83,
                    "Description": "Matched in Image Allowlist"
                }
            ],
            "RiskLevel": "none"
        },
        "RequestId": "ABCD1234-1234-1234-1234-1234XYZ"
    }
  • Responses with additional information

    • Match in a custom image library

    {
        "Code": 200,
        "Data": {
            "DataId": "",
            "Ext": {
                "CustomImage": [
                    {
                        "ImageId": "12345",
                        "LibId": "TEST20240307",
                        "LibName": "Risk Image Library A"
                    }
                ]
            },
            "Result": [
                {
                    "Confidence": 100.0,
                    "Label": "pornographic_adultContent_lib",
                    "Description": "Adult Content (Custom Library)"
                }
            ],
            "RiskLevel": "high"
        },
        "Msg": "success",
        "RequestId": "5F572704-4C03-51DF-8957-D77BF6E7444E"
    }
    • Match in a custom text library

    {
        "Code": 200,
        "Data": {
            "DataId": "",
            "Ext": {
                "TextInImage": {
                    "CustomText": [
                        {
                            "KeyWords": "custom keyword 1",
                            "LibId": "TEST20240307",
                            "LibName": "Text Blocklist A"
                        }
                    ],
                    "OcrResult": [
                        {
                            "Text": "Text line 1"
                        },
                        {
                            "Text": "Text line 2"
                        },
                        {
                            "Text": "Text line 3 containing a custom keyword"
                        }
                    ],
                    "RiskWord": null
                }
            },
            "Result": [
                {
                    "Confidence": 99.0,
                    "Label": "pornographic_adultContent_tii_lib",
                    "Description": "Text Contains Pornographic Content (Custom Library)"
                }
            ],
            "RiskLevel": "high"
        },
        "Msg": "success",
        "RequestId": "TESTZGL-0307-2024-0728-FOREVER"
    }
    • Text-in-image violation

    {
        "Code": 200,
        "Data": {
            "DataId": "",
            "Ext": {
                "TextInImage": {
                    "CustomText": null,
                    "OcrResult": [
                        {
                            "Text": "Text line 1"
                        },
                        {
                            "Text": "Text line 2"
                        },
                        {
                            "Text": "Text line 3 containing a risk word"
                        }
                    ],
                    "RiskWord": [
                        "risk word 1"
                    ]
                }
            },
            "Result": [
                {
                    "Confidence": 89.15,
                    "Label": "political_politicalFigure_name_tii",
                    "Description": "Text Contains the Name of a Political Figure"
                }
            ],
            "RiskLevel": "high"
        },
        "Msg": "success",
        "RequestId": "TESTZGL-0307-2024-0728-FOREVER"
    }
    • Logo information detected

    {
        "Code": 200,
        "Data": {
            "DataId": "",
            "Ext": {
                "LogoData": [
                    {
                        "Location": {
                            "H": 44,
                            "W": 100,
                            "X": 45,
                            "Y": 30
                        },
                        "Logo": [
                            {
                                "Confidence": 96.15,
                                "Label": "pt_logotoSocialNetwork",
                                "Name": "CCTV"
                            }
                        ]
                    }
                ]
            },
            "Result": [
                {
                    "Confidence": 96.15,
                    "Label": "pt_logotoSocialNetwork",
                    "Description": "Social Media Platform Logo"
                }
            ],
            "RiskLevel": "high"
        },
        "Msg": "success",
        "RequestId": "TESTZGL-0307-2024-0728-FOREVER"
    }
    • Public figure information detected

    {
        "Code": 200,
        "Data": {
            "DataId": "",
            "Ext": {
                "PublicFigure": [
                    {
                        "FigureId": null,
                        "FigureName": "Yang San",
                        "Location": [
                            {
                                "H": 520,
                                "W": 13,
                                "X": 14,
                                "Y": 999
                            }
                        ]
                    }
                ]
            },
            "Result": [
                {
                    "Confidence": 92.05,
                    "Label": "political_politicalFigure_3",
                    "Description": "Provincial or Municipal Government Personnel"
                }
            ],
            "RiskLevel": "high"
        },
        "Msg": "success",
        "RequestId": "TESTZGL-0307-2024-0728-FOREVER"
    }
Note

Examples are formatted for readability. Actual responses are single-line strings without line breaks or indentation.

Risk labels

The following tables list risk labels, their meanings, and confidence score ranges. You can toggle labels and configure detection scopes in the Console Operation Guide. Supported labels by service:

Scenario

Services and labels

General scenario

baseline check (baselineCheck_global)

AIGC scenario

AI-generated image detection (aigcDetector_global)

For labels returned when no risk is detected or an image matches the image whitelist, see Supported labels for no-risk or whitelisted images.

Note

We recommend storing the risk labels and confidence scores returned by the system for content governance. Use them to prioritize manual review, annotation, and implement tiered and categorized governance measures.

Table 4. Supported tags for general baseline detection (baselineCheck_global)

Label

Confidence score

Description

pornographic_adultContent

A score from 0 to 100. A higher score means greater confidence.

The image may contain adult pornographic content.

pornographic_cartoon

A score from 0 to 100. A higher score means greater confidence.

The image may contain pornographic cartoon content.

pornographic_adultToys

A score from 0 to 100. A higher score means greater confidence.

The image may contain adult toys.

pornographic_art

A score from 0 to 100. A higher score means greater confidence.

The image may contain pornographic art.

pornographic_adultContent_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains pornographic content.

pornographic_suggestive_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains suggestive content.

pornographic_o_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains special category content. For more information, see the Content Moderation console.

pornographic_organs_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains descriptions of sexual organs.

pornographic_adultToys_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains content related to adult toys.

sexual_suggestiveContent

A score from 0 to 100. A higher score means greater confidence.

The image may contain vulgar or sexually suggestive content.

sexual_femaleUnderwear

A score from 0 to 100. A higher score means greater confidence.

The image may contain underwear or swimwear.

sexual_cleavage

A score from 0 to 100. A higher score means greater confidence.

The image may feature female cleavage.

sexual_maleTopless

A score from 0 to 100. A higher score means greater confidence.

The image may contain topless men.

sexual_cartoon

A score from 0 to 100. A higher score means greater confidence.

The image may contain sexually suggestive cartoon content.

sexual_shoulder

A score from 0 to 100. A higher score means greater confidence.

The image may contain sexually suggestive content involving shoulders.

sexual_femaleLeg

A score from 0 to 100. A higher score means greater confidence.

The image may contain sexually suggestive content involving legs.

sexual_pregnancy

A score from 0 to 100. A higher score means greater confidence.

The image may contain content related to pregnancy or breastfeeding.

sexual_feet

A score from 0 to 100. A higher score means greater confidence.

The image may contain sexually suggestive content involving feet.

sexual_kiss

A score from 0 to 100. A higher score means greater confidence.

The image may contain kissing.

sexual_intimacy

A score from 0 to 100. A higher score means greater confidence.

The image may contain intimate behavior.

sexual_intimacyCartoon

A score from 0 to 100. A higher score means greater confidence.

The image may contain intimate behavior in cartoons or animation.

violent_explosion

A score from 0 to 100. A higher score means greater confidence.

The image may contain elements related to fireworks or explosions. For more information, see the Content Moderation console.

violent_burning

A score from 0 to 100. A higher score means greater confidence.

The image may contain burning content.

violent_armedForces

A score from 0 to 100. A higher score means greater confidence.

The image may contain armed forces.

violent_weapon

A score from 0 to 100. A higher score means greater confidence.

The image may contain weapons.

violent_crowding

A score from 0 to 100. A higher score means greater confidence.

The image may contain crowds.

violent_gun

A score from 0 to 100. A higher score means greater confidence.

The image may contain firearms.

violent_knives

A score from 0 to 100. A higher score means greater confidence.

The image may contain knives.

violent_horrific

A score from 0 to 100. A higher score means greater confidence.

The image may contain horrific content.

violent_nazi

A score from 0 to 100. A higher score means greater confidence.

The image may contain Nazi-related content.

violent_bloody

A score from 0 to 100. A higher score means greater confidence.

The image may contain bloody content.

violent_extremistGroups_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains content related to terrorist organizations.

violent_extremistIncident_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains content related to terrorist incidents.

violence_weapons_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains descriptions of firearms or knives.

violent_ACU

A score from 0 to 100. A higher score means greater confidence.

The image may contain a combat uniform.

contraband_drug

A score from 0 to 100. A higher score means greater confidence.

The image may contain drug-related content.

contraband_drug_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains content related to illicit drugs.

contraband_gamble

A score from 0 to 100. A higher score means greater confidence.

The image may contain gambling-related content.

contraband_gamble_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains content related to gambling.

inappropriate_smoking

A score from 0 to 100. A higher score means greater confidence.

The image may contain smoking-related content.

inappropriate_drinking

A score from 0 to 100. A higher score means greater confidence.

The image may contain alcohol-related content.

inappropriate_tattoo

A score from 0 to 100. A higher score means greater confidence.

The image may contain tattoos.

inappropriate_middleFinger

A score from 0 to 100. A higher score means greater confidence.

The image may contain the middle finger gesture.

inappropriate_foodWasting

A score from 0 to 100. A higher score means greater confidence.

The image may contain food waste.

profanity_Offensive_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains severe profanity, verbal attacks, or offensive content.

profanity_Oral_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains colloquial profanity.

religion_clothing

A score from 0 to 100. A higher score means greater confidence.

The image may contain special symbols and elements. For more information, see the Content Moderation console.

religion_logo

A score from 0 to 100. A higher score means greater confidence.

religion_flag

A score from 0 to 100. A higher score means greater confidence.

religion_taboo1_tii

A score from 0 to 100. A higher score means greater confidence.

The text in the image contains taboo content. For more information, see the Content Moderation console.

religion_taboo2_tii

A score from 0 to 100. A higher score means greater confidence.

flag_country

A score from 0 to 100. A higher score means greater confidence.

The image may contain flag-related content.

political_historicalNihility

A score from 0 to 100. A higher score means greater confidence.

The image may contain specific content. For more information, see the Content Moderation console.

political_historicalNihility_tii

A score from 0 to 100. A higher score means greater confidence.

political_politicalFigure_1

A score from 0 to 100. A higher score means greater confidence.

political_politicalFigure_2

A score from 0 to 100. A higher score means greater confidence.

political_politicalFigure_3

A score from 0 to 100. A higher score means greater confidence.

political_politicalFigure_4

A score from 0 to 100. A higher score means greater confidence.

political_politicalFigure_name_tii

A score from 0 to 100. A higher score means greater confidence.

political_prohibitedPerson_1

A score from 0 to 100. A higher score means greater confidence.

political_prohibitedPerson_2

A score from 0 to 100. A higher score means greater confidence.

political_prohibitedPerson_tii

A score from 0 to 100. A higher score means greater confidence.

political_taintedCelebrity

A score from 0 to 100. A higher score means greater confidence.

political_taintedCelebrity_tii

A score from 0 to 100. A higher score means greater confidence.

political_CNFlag

A score from 0 to 100. A higher score means greater confidence.

political_CNMap

A score from 0 to 100. A higher score means greater confidence.

political_logo

A score from 0 to 100. A higher score means greater confidence.

political_outfit

A score from 0 to 100. A higher score means greater confidence.

political_badge

A score from 0 to 100. A higher score means greater confidence.

pt_logo

A score from 0 to 100. A higher score means greater confidence.

The image may contain a logo.

QR code

A score from 0 to 100. A higher score means greater confidence.

The image may contain a QR code.

pt_custom_01

A score from 0 to 100. A higher score means greater confidence.

Custom label 01.

pt_custom_02

A score from 0 to 100. A higher score means greater confidence.

Custom label 02.

Note

tii is an abbreviation for text in image. A label ending in tii flags non-compliant text.

You can also configure a custom image library for each risk label. If a detected image is a close match to an image in the custom image library, the system returns the corresponding risk label formatted as _lib. For example, if you configure a custom image library for the violent_explosion risk label and a detected image is a close match, the label parameter returns violent_explosion_lib. The corresponding confidence parameter represents the similarity score.

If the system detects no risks in an input image, or if the image is highly similar to an image on your exemption list, the returned label and confidence score are described in the following table.

Label

Confidence score

Description

nonLabel

This field is not returned.

No risk is detected in the image, or you have disabled all detection items. For more information, see the Content Moderation console.

nonLabel_lib

A score from 0 to 100. A higher score indicates greater confidence.

The image is highly similar to an image on your exemption list. For more information, see the Content Moderation console.

Response codes

API response codes. Only requests returning code 200 are billed.

Code

Description

200

The request was successful.

400

The request parameters are empty.

401

The request parameters are invalid.

402

A request parameter has an invalid length. Check the parameter and retry the request.

403

The request rate exceeds the QPS limit. Check and adjust your concurrency.

404

Failed to download the image due to an error or timeout. Verify the image URL and try again.

405

The image download timed out, possibly because the image is inaccessible. Check its access settings and try again.

406

The input image is too large. Reduce the image size and try again.

407

The input image format is not supported. Convert the image and try again.

408

Permission to call this API was denied. This can occur if the service is not activated, the account has an overdue payment, or the account lacks authorization.

500

A system error occurred.