Synchronous Text Check

Check a single text and receive its moderation result in the same response.

POSThttps://tsafe.ilivedata.com/api/v1/text/check

UTF-8 text, up to 2,048 characters per request. Send and receive JSON; authenticate with an Authorization signature.

Request Parameters

Request Headers

All headers below are required.

Header Value Description
Content-Type application/json; charset=UTF-8 Request body format
Accept application/json; charset=UTF-8 Response format
X-AppId — Project ID from Console → Service Configuration
X-TimeStamp — UTC time when the request is sent, in W3C format.
Format example: 2026-09-30T02:30:00Z. Use the current time for actual requests.
Authorization — See Request Signature below

Request Body

Only content is required. When strategyId is omitted, the DEFAULT policy is used.

Parameter Type Required Description
content String Required The text to be detected. This text is UTF-8 encoded strings with no more than 2048 characters.
strategyId String Optional Policy ID. Defaults to DEFAULT when omitted.
country String Optional country The default country setting is used when omitted.
checkTags Array Optional First-level categories to check. See Supported Check Categories below.
userId String Optional Unique end user ID. The userID should be no more than 64 characters.
userName String Optional User name, nickname. The user name should be no more than 32 characters.
userLevel Number Optional User level
userIp String Optional User IP address
sessionId String Optional sessionId, The sessionId should be no more than 64 characters.
receiverId String Optional receiverId, The receiverId should be no more than 64 characters.
totalPay Number Optional User total payment. Support up to 2 digits after the decimal point.
registrationDate Number Optional User registration date. 10 digit timestamp.
msgCount Number Optional Number of message sent
msgType String Optional Message type
pkgChannel String Optional Package channel
did String Optional User device ID
dtype String Optional Device type: 1 iPhone, 2 Android, 3 iPad, 4 Windows Phone,
5 PC, 6 Web, 7 WAP.
extra Object Optional Additional key-value data, such as {"server":"123","version":"456"}.

Supported Check Categories

Use the following first-level codes in checkTags.

Code Category
100 Politics
110 Violence and terrorism
120 Prohibited content
130 Eroticism
150 Advertising
160 Insults
170 Hate speech
180 Minor protection
190 Sensitive hot topics
220 Private transactions
410 Irregular emoticons
420 Nicknames
999 Custom categories

Request Example

{
  "content": "fuck you",
  "userId": "1234556",
  "strategyId": "123"
}

Request Signature

Calculate the Authorization value using Request Signature, with the following parameters.

Signing Parameter Value
HTTPMethod POST
HostHeaderInLowercase tsafe.ilivedata.com
HTTPRequestURI /api/v1/text/check

HTTP Response

Content-Type: application/json;charset=UTF-8

errorCode indicates whether the API call succeeded. textSpam.result is the moderation decision: 0 pass, 1 review recommended, 2 fail. The top-level code field is reserved and can be ignored.

Response Fields

Field Type Description
errorCode Number Error code; 0 means success
errorMessage String Error message
code Number Reserved; ignore this field
textSpam Object Text moderation result
warning Boolean Custom advertising-word alert configured in the console blacklist
taskId String Unique identifier of this API call
language String Detected language
startTime Number Timestamp when text detection was called
endTime Number Timestamp when the result was returned

textSpam

Field Type Description
content String Text with sensitive words replaced by asterisks; other content is unchanged
result Number 0: pass; 1: review recommended; 2: fail
tags Array First-level classifications
wordList String[] Sensitive words

tags[]

First-level classifications in textSpam.tags.

Field Type Description
tag Number First-level category code; see Classification Codes
tagName String First-level category name
tagNameEn String First-level category name in English
level Number 0: normal; 1: suspected; 2: abnormal
confidence Number Advertising confidence, from 0 to 100. Returned only for tag = 150; higher values indicate a greater likelihood of advertising
subTags Array Second-level classifications

subTags[]

Second-level classifications in textSpam.tags[].subTags.

Field Type Description
subTag Number Second-level code; see Classification Codes
subTagName String Second-level category name
subTagNameEn String Second-level category name in English
wordList String[] Matched words
wordPosition Map<String, Position[]> Map from each matched word to its position array

Position

Each position object appears in the arrays of wordPosition.

Field Type Description
start Number Start position of the matched word
end Number End position of the matched word
offset Number Length of the matched word

Response Example

{
  "errorCode": 0,
  "textSpam": {
    "content": "****",
    "result": 2,
    "tags": [
      {
        "tag": 160,
        "level": 2,
        "tagName": "辱骂",
        "tagNameEn": "insults",
        "subTags": [
          {
            "subTag": 160001,
            "subTagName": "谩骂人身攻击",
            "subTagNameEn": "insults and personal attacks",
            "wordList": [
              "fuck"
            ]
          }
        ]
      }
    ],
    "wordList": [
      "fuck"
    ]
  },
  "taskId": "c01b212f-3e31-4a2e-8346-b6f6ce3a3456",
  "language": "English",
  "startTime": 1660103900367,
  "endTime": 1660103900374
}

Error Codes

For common request and authentication errors, see Common Error Codes. This API has the following additional conditions:

HTTP Status Error Code Message API-Specific Condition
400 2000 Missing Parameter The JSON request body is missing content.
400 2102 Input Too Long content exceeds 2,048 characters.
429 1104 Out of Rate Limit The request rate exceeds 20 texts/second, or the total character rate for texts longer than 100 characters exceeds 1K characters/second.

The limits above are the documented defaults. If the project’s limits have been increased, use the configured limits.