All Products
Search
Document Center

Content Moderation:/green/text/scan

Last Updated:Feb 27, 2026

Scans text synchronously for undesirable content such as pornography, advertising violations, spam, political content, and abuse.

Usage notes

Operation: /green/text/scan

Submit text moderation tasks through this endpoint. For details on constructing HTTP requests, see Request syntax. To use an SDK instead, see SDK overview.

By default, this operation moderates Chinese text. To moderate text in other languages, contact your account manager. Supported languages: English, French, German, Indonesian, Malaysian, Portuguese, Spanish, Thai, Vietnamese, Japanese, Arabic, Filipino, Hindi, Turkish, Russian, Italian, and Dutch.

Billing

Calling this operation incurs charges. For details, see Content Moderation Pricing.

QPS limit

This operation supports up to 100 calls per second per account. Exceeding this limit triggers throttling, which may affect your business. Factor this limit into your implementation.

Request parameters

ParameterTypeRequiredExampleDescription
bizTypeStringNodefaultThe business scenario. Create business scenarios in the Content Moderation console. For details, see Customize policies for machine-assisted moderation.
scenesStringArrayYes["antispam"]The moderation scenario. Set to antispam for text moderation.
tasksJSONArrayYesThe list of text entries to moderate. Contains up to 100 elements, each structured as a task object (see the following table). To submit more than 100 entries per request, contact your account manager to increase the concurrency limit.

task

ParameterTypeRequiredExampleDescription
clientInfoJSONObjectNoClient information. For details, see the "Common request parameters" section of Common parameters. The task-level clientInfo takes priority over the global clientInfo parameter.
dataIdStringNocfd33235-71a4-468b-8137-a5ffe323\*\*\*\*A unique identifier for the moderated object. Accepts letters, digits, underscores (\_), hyphens (-), and periods (.). Maximum length: 128 characters.
contentStringYesWe are a micro-lending company that provides an unsecured loan on the same day with reliable, fast, convenient, and door-to-door services when you apply for a loan on your mobile phone.The text to moderate. Maximum length: 10,000 characters, including punctuation.

Response parameters

ParameterTypeExampleDescription
codeInteger200HTTP status code. For details, see Common error codes.
msgStringOKThe response message.
dataIdStringcfd33235-71a4-468b-8137-a5ffe323\*\*\*\*The ID of the moderated object. Returned only if dataId was set in the request.
taskIdStringtxt6HB8NQoEbU@5fosnj2xVEM-1t\*\*\*\*The moderation task ID.
contentStringWe are a micro-lending company that provides an unsecured loan on the same day with reliable, fast, convenient, and door-to-door services when you apply for a loan on your mobile phone.The original text submitted in the request.
filteredContentStringWe are a \*\*\*\* company that provides an \*\*\* loan on the same day with reliable, fast, convenient, and \*\*\*\* services when you apply for a loan on your mobile phone.The text with matched custom terms replaced by asterisks (\*). Customize terms through the CreateKeywordLib API or the Content Moderation console. For details, see Manage custom text libraries.
resultsJSONArrayThe moderation results. On success (HTTP 200), returns an array of result objects (see the following table).

result

ParameterTypeExampleDescription
sceneStringantispamThe moderation scenario specified in the request.
suggestionStringblockThe recommended action. Valid values: pass (text is normal), review (text requires human review), block (text contains violations and can be deleted or blocked).
labelStringpornThe content category. Valid values: normal (normal content), spam (junk content), ad (advertising content), politics (political content), terrorism (terrorist content), abuse (abusive content), porn (pornographic content), flood (excessive junk content), contraband (prohibited content), meaningless (meaningless content), harmful (harmful content, including content related to mammonism, wealth flaunting, blind worshiping of idols, disruptive emotion, and negative enticing), customized (custom content, such as a custom term).
rateFloat99.91The confidence score. Valid values: 0 to 100. Higher values indicate greater confidence. When suggestion is pass, a higher score means the content is more likely normal. When suggestion is review or block, a higher score means the content is more likely to contain violations. Use the suggestion, label, and sublabel parameters to determine whether content contains violations. The sublabel parameter is returned by specific operations.
extrasJSONObject{"userId":"xxx"}Additional information (extended parameter).
detailsJSONArrayDetails of the risky content detected. A text entry can match multiple risk categories. Each element is a detail object (see the following table).

detail

ParameterTypeExampleDescription
labelStringpornThe risk category of matched content. Valid values: spam (junk content), ad (advertising content), politics (political content), terrorism (terrorist content), abuse (abusive content), porn (pornographic content), flood (excessive junk content), contraband (prohibited content), meaningless (meaningless content), harmful (harmful content, including content related to mammonism, wealth flaunting, blind worshiping of idols, disruptive emotion, and negative enticing), customized (custom content, such as a custom term).
contextsJSONArrayContext information for the matched risky content. Each element is a context object (see the following table).

context

ParameterTypeExampleDescription
contextStringdoor-to-doorThe term matched in the text. Returned only for term-based matches, not for algorithmic model matches.
positionsJSONArray[{"startPos":1, "endPos":10}]The position of the matched term in the original text.
libNameStringName of your custom text libraryThe name of the custom text library. Returned only when the text matches a term in a custom text library.
libCodeString123456The code of the custom text library. Returned only when the text matches a term in a custom text library.
ruleTypeStringipThe behavior rule type. Returned only when the text matches a behavior rule. Valid values: user_id, ip, umid, content, similar_content, imei, imsi.

Examples

Sample request

http(s)://[Endpoint]/green/text/scan
&<Common request parameters>
{
  "scenes": [
    "antispam"
  ],
  "tasks": [
    {
      "dataId": "cfd33235-71a4-468b-8137-a5ffe323****",
      "content": "We are a micro-lending company that provides an unsecured loan on the same day with reliable, fast, convenient, and door-to-door services when you apply for a loan on your mobile phone."
    }
  ]
}

Sample response

{
  "code": 200,
  "data": [
    {
      "code": 200,
      "content": "We are a micro-lending company that provides an unsecured loan on the same day with reliable, fast, convenient, and door-to-door services when you apply for a loan on your mobile phone.",
      "dataId": "cfd33235-71a4-468b-8137-a5ffe323****",
      "filteredContent": "We are a **** company that provides an *** loan on the same day with reliable, fast, convenient, and **** services when you apply for a loan on your mobile phone.",
      "msg": "OK",
      "results": [
        {
          "details": [
            {
              "contexts": [
                {
                  "context": "unsecured",
                  "positions": [
                    {
                      "endPos": 19,
                      "startPos": 16
                    }
                  ]
                },
                {
                  "context": "micro-lending",
                  "positions": [
                    {
                      "endPos": 6,
                      "startPos": 2
                    }
                  ]
                }
              ],
              "label": "spam"
            },
            {
              "contexts": [
                {
                  "context": "door-to-door",
                  "libCode": "123456",
                  "libName": "Name of your custom text library",
                  "positions": [
                    {
                      "endPos": 34,
                      "startPos": 30
                    }
                  ]
                }
              ],
              "label": "porn"
            }
          ],
          "label": "porn",
          "rate": 99.91,
          "scene": "antispam",
          "suggestion": "block"
        }
      ],
      "taskId": "txt6HB8NQoEbU@5fosnj2xVEM-1t****"
    }
  ],
  "msg": "OK",
  "requestId": "25711794-BF6D-4F32-A735-09CA21197D32"
}