Text Moderation 2.0 moderates user-generated text across 38 languages without requiring you to specify the language — the service detects it automatically. Compared to Text Moderation 1.0 (which supports 18 languages, requires manual language specification, and uses a single moderation model), Text Moderation 2.0 uses multiple models tuned for language and regional characteristics. It applies separate moderation policies tuned for international business, returns a translated English version of flagged content to support manual review, and supports multiple risk labels per request.
How it works
Submit text to the comment_multilingual_global service. Text Moderation 2.0 automatically identifies the language, applies the appropriate moderation model, and returns:
One or more risk labels (e.g.,
violence,profanity)A subcategory label (
riskTips) for precise classificationA risk level (
high,medium, orlow) with a handling recommendationThe detected language code
An English translation of the content for manual review
Supported languages
You do not need to specify a language code when submitting text. Text Moderation 2.0 automatically detects the language and applies the appropriate moderation model.
Text Moderation 2.0 supports 38 languages.
| Language type | Name | Language code |
|---|---|---|
| English | English | en |
| Simplified Chinese | Chinese | zh |
| Traditional Chinese | Traditional Chinese | zh-tw |
| Indonesian | Indonesian | id |
| Malay | Malay | ms |
| Thai | Thai | th |
| Vietnamese | Vietnamese | vi |
| Tagalog | Tagalog | tl |
| Hindi | Hindi | hi |
| Arabic | Arabic | ar |
| Turkish | Turkish | tr |
| French | French | fr |
| German | German | de |
| Russian | Russian | ru |
| Portuguese | Portuguese | pt |
| Spanish | Spanish | es |
| Italian | Italian | it |
| Dutch | Dutch | nl |
| Polish | Polish | pl |
| Japanese | Japanese | ja |
| Korean | Korean | ko |
| Urdu | Urdu | ur |
| Uighur | Uighur | ug |
| Bengali | Bengali | bn |
| Persian | Persian | fa |
| Swedish | Swedish | sv |
| Danish | Danish | da |
| Norwegian | Norwegian | no |
| Icelandic | Icelandic | is |
| Finnish | Finnish | fi |
| Belarusian | Belarusian | be |
| Lithuanian | Lithuanian | lt |
| Czech | Czech | cs |
| Slovak | Slovak | sk |
| Hungarian | Hungarian | hu |
| Greek | Modern Greek | el |
| Romanian | Romanian | ro |
| Irish | Irish | ga |
Internationalization labels
Text Moderation 2.0 uses an internationalization labeling system designed for global business. If content contains multiple risk types, the service returns multiple labels simultaneously.2.0
Level-1 labels
| Label | Description |
|---|---|
violence | Violence |
contraband | Contraband |
sexuality | Pornography |
profanity | Profanity and abuse |
pullinTraffic | Advertising content |
regional | Regional hostility |
C_customized | Custom library match |
Subcategory labels
Subcategory labels (riskTips) provide finer-grained classification in xxx_yyy format. For example, contraband_Drugs indicates that the contraband content relates specifically to drugs.
Risk levels
The riskLevel field indicates the severity of detected content and the recommended action.
| Risk level | Business meaning | Recommended action |
|---|---|---|
high | Content is clearly harmful and violates policy | Block or remove the content immediately |
medium | Content may violate policy and requires human judgment | Route to manual review |
low | Content has weak risk signals that may not warrant action alone | Handle when more risky content is detected |
Content with no detected risk returns an empty Labels field — handle it based on your business requirements.
Billing
Text Moderation 2.0 uses pay-as-you-go billing. You are only charged for successful requests (HTTP status code 200). If the service is not called, no charge is made.
| Moderation type 2.0 | Service | Unit price |
|---|---|---|
advanced text moderation (text_standard) | Multi-language detection for global business scenarios: comment_multilingual_global | USD 0.30 per 1,000 calls |
Advanced text moderation (text_advanced) | comment_multilingual_global | USD 0.3 per 1,000 calls |
Get started
Step 1: Activate the service
Open the service activation2.0 page to activate Text Moderation 2.0. After activation, the default billing method is pay-as-you-go.
Step 2: Grant permissions to a RAM user
Before calling API operations as a Resource Access Management (RAM) user, grant the user the required permissions.
Log on to the RAM console as a RAM administrator.
Create a RAM user. For details, see Create a RAM user.
Grant the
AliyunYundunGreenWebFullAccesssystem policy to the RAM user. For details, see Grant permissions to a RAM user.
After completing these steps, the RAM user can call the Content Moderation API. To authenticate API calls, create an AccessKey pair for the RAM user and include it in each request. For details, see Obtain an AccessKey pair.
Step 3: Install an SDK and call the API
The following table lists the supported regions and their endpoints. For SDK installation instructions and usage examples, see Text Moderation 2.0 SDKs and usage guide.
| Region | Public endpoint | Internal endpoint |
|---|---|---|
| Singapore | green-cip.ap-southeast-1.aliyuncs.com | green-cip-vpc.ap-southeast-1.aliyuncs.com |
| US (Virginia) | green-cip.us-east-1.aliyuncs.com | green-cip-vpc.us-east-1.aliyuncs.com |
| US (Silicon Valley) | green-cip.us-west-1.aliyuncs.com | N/A |
| UK (London) | green-cip.eu-west-1.aliyuncs.com | N/A |
To get SDK sample code for other programming languages, use OpenAPI Explorer. OpenAPI Explorer dynamically generates sample code for each supported SDK.
API reference
Usage notes
Service endpoint: https://green-cip.{region}.aliyuncs.com
Call the TextModeration operation to submit a text moderation task. For details on constructing HTTP requests, see Request syntax.
Billing: Only requests that return HTTP status code 200 are charged.
QPS limit: 100 calls per second per account. Requests that exceed this limit trigger throttling.
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
Service | String | Yes | comment_multilingual_global | The moderation service type. Valid value: comment_multilingual_global (multi-language moderation for international business) |
ServiceParameters | JSONString | Yes | — | The moderation parameters as a JSON string. See the table below. |
ServiceParameters fields
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
content | String | Yes | Content to be moderated | The text to moderate. Maximum length: 600 characters. |
accountId | String | No | 10123**** | An account ID that uniquely identifies an account. If specified, returned in the response. |
deviceId | String | No | 20240307**** | A device ID that uniquely identifies a device. If specified, returned in the response. |
deviceToken | String | No | MzQvo1d7scyZ3tl_RcJ****** | A device token obtained from the risk control SDK. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
Code | Integer | 200 | HTTP status code. See Error codes. |
Data | JSONObject | — | Moderation results. See the table below. |
Message | String | OK | Response message. |
RequestId | String | AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE**** | The request ID. |
Data object fields
| Parameter | Type | Example | Description |
|---|---|---|---|
Labels | String | sexuality,profanity | Detected risk labels, separated by commas. Empty if no risk is detected. |
Reason | String | {"riskLevel":"high",...} | A JSON string with details about detected risks. See the fields below. |
AccountId | String | 10123**** | Returned if accountId was specified in the request. |
DeviceId | String | 20240307**** | Returned if deviceId was specified in the request. |
Reason JSON fields
| Field | Description |
|---|---|
riskLevel | Risk level: high, medium, or low. See Risk levels. |
riskTips | Subcategory label (e.g., sexuality_Suggestive). |
riskWords | Risky words detected in the content. |
customizedWords | Words matched from a custom library. |
customizedLibs | Custom libraries that were matched. |
detectedLanguage | Detected language code (e.g., en, ar). |
translatedContent | English translation of the moderated content, to support manual review. |
Examples
All examples use the comment_multilingual_global service. Replace accountId with your actual account ID.
Request
{
"Service": "comment_multilingual_global",
"ServiceParameters": {
"content": "testing content",
"accountId": "10123****",
"dataId": "text0424****"
}
}Response: custom library and risky words both detected
{
"Code": 200,
"Data": {
"Labels": "C_customized,profanity",
"Reason": "{\"riskLevel\":\"high\",\"customizedWords\":\"HXXXXX\",\"detectedLanguage\":\"en\",\"riskTips\":\"sexuality_Suggestive\",\"riskWords\":\"pxxxxy\",\"translatedContent\":\"pxxxxy sxxxx,HXXXXX\",\"customizedLibs\":\"ZXXXXX\"}"
},
"Message": "OK",
"RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}Response: custom library only
{
"Code": 200,
"Data": {
"Labels": "C_customized",
"Reason": "{\"riskLevel\":\"high\",\"customizedWords\":\"HXXXXX\",\"detectedLanguage\":\"en\",\"translatedContent\":\"HXXXXX\",\"customizedLibs\":\"ZXXXXX\"}"
},
"Message": "OK",
"RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}Response: risky words only
{
"Code": 200,
"Data": {
"Labels": "sexuality",
"Reason": "{\"riskLevel\":\"high\",\"detectedLanguage\":\"ar\",\"riskTips\":\"sexuality_Suggestive\",\"riskWords\":\"pxxxxy\",\"translatedContent\":\"pxxxxy sxxxx\"}"
},
"Message": "OK",
"RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}Response: no risk detected
{
"Code": 200,
"Data": {
"Labels": "",
"Reason": "{\"detectedLanguage\":\"en\",\"translatedContent\":\"AXXXXXX\"}"
},
"Message": "OK",
"RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}Error codes
| HTTP status code | Error code | Description |
|---|---|---|
| 200 | OK | Request successful. |
| 400 | BAD_REQUEST | Invalid request. Check your request parameters. |
| 407 | NOT_SUPPORT | Language not identified or not supported. |
| 408 | PERMISSION_DENY | Account not authorized, overdue, not activated, or banned. |
| 500 | GENERAL_ERROR | Temporary server error. Retry the request. If the error persists, submit a ticket. |
| 581 | TIMEOUT | Request timed out. Retry the request. If the error persists, submit a ticket. |
| 588 | EXCEED_QUOTA | QPS limit exceeded. |
What's next
Text Moderation 2.0 SDKs and usage guide — SDK installation and complete API reference
OpenAPI Explorer — Interactive API console with generated SDK samples