Welcome to the Bad Information Detection Services API. This API helps you clean up your content for China.

API Base URL

Your account manager will provide you with a base URL. Use this base URL along with the endpoints described below to access the authentication services.


Endpoint: /detect

Use this API to detect and filter out bad information from your content. Clean content will be returned, with detected bad information replaced by *.

Request:

  • HTTP method: POST
  • Request format: JSON

Request JSON example:

{
    "key": "<API_KEY>",
    "content": "<TEXT>"
}


Examples

Successful Request with Clean Content

Request JSON:

{
    "key": "<API_KEY>",
    "content": "你好"
}

Response JSON:

{
    "bad_words": [],
    "clean_content": "你好",
    "status": "ok"
}

Successful Request with Detected Bad Information

Request JSON:

{
    "key": "<API_KEY>",
    "content": "8月6日,此前在抗洪抢险过程中遇险失联的舒兰市委常委、常务副市长骆旭东等3名公职人员被找到,已无生命体征,因公牺牲。随后,骆旭东等人乘坐的车辆在开原镇新开村东侧被打捞上岸。8月9日,记者来到车辆被打捞地,银白色的车辆被洪水冲刷变形,满布淤泥。"
}

Response JSON:

{
    "bad_words": [
        {
            "word": "常委"
        },
        {
            "word": "市长"
        },
        {
            "word": "受灾"
        },
        {
            "word": "共产党"
        }
    ],
    "clean_content": "8月6日,此前在抗洪抢险过程中遇险失联的舒兰市委*、常务副*骆旭东等3名公职人员被找到,已无生命体征,因公牺牲。随后,骆旭东等人乘坐的车辆在开原镇新开村东侧被打捞上岸。8月9日,记者来到车辆被打捞地,银白色的车辆被洪水冲刷变形,满布淤泥。",
    "status": "ok"
}

Failure Response Structure

Failure response JSON structure:

{
    "code": "<ERROR CODE>",
    "msg": "<MESSAGE>"
}

Fields

  • key: Your API key assigned by your account manager.
  • content: The text content to be processed for bad information.

  • bad_words: A list of sensitive words detected in the content. If this list is empty, no sensitive words were found. If it’s not empty, these words will be replaced with * in the clean_content.
  • status: Returns “ok” if the request is successful.
  • clean_content: The cleaned content after bad information processing.
  • code: An error code returned in case of a failed request. See the list below for code meanings.
  • msg: A short error message returned in case of a failed request. See the list below for message descriptions.

Error Codes and Definitions

  • 0070: Request format is not JSON.
  • 0072: Missing arguments phone_no or key in JSON.
  • 0073: Invalid key. Contact your account manager to obtain a valid API key.

Feel free to reach out if you have any further questions or need assistance.

Ready to try 21YunBox?

Get Started