Parameter Specification

一、 Parameter specification

  • Request URL:

Get it from the Console - Service Configuration

  • HTTP request Header:
Header Value Property Description
Content-Type application/json;charset=UTF-8 Required Request body type
Accept application/json;charset=UTF-8 Required Return type accepted
X-AppId Required The only identifier of the project or application.
X-TimeStamp Required The UTC timestamp of the request. Timestamps need to be formatted according to W3C standards, for example: 2010-01-31T23:59:59Z. (
Authorization Required Signature value
  • Request method:POST

  • Request body JSON object:

Parameter Property Type Description
content Required String The text to be detected. This text is UTF-8 encoded strings with no more than 2048 characters.
strategyId Optional String Policy number. The default policy DEFAULT is used when not passed.
country Optional String country The default policy DEFAUL is used when not passed.
userId Optional String Unique end user ID. The userID should be no more than 64 characters.
sessionId Optional String sessionId,The sessionId should be no more than 64 characters.
receiverId Optional String receiverId,The receiverId should be no more than 64 characters.
userName Optional String User name, nickname. The user name should be no more than 32 characters.
userLevel Optional Number User level
totalPay Optional Number User total payment. Support up to 2 digits after the decimal point.
registrationDate Optional Number User registration date. 10 digit timestamp.
msgCount Optional Number Number of message sent
msgType Optional String Message type
pkgChannel Optional String Package channel
userIp Optional String User IP address
did Optional String User device ID
dtype Optional String User device type:1:iPhone 2:android 3: ipad 4:wphone 5: pc 6:web 7:wap
checkTags Optional array the type you want to filter
  • Example of request body:

    JSON Response
          "content":“fuck you”,
          "strategyId":"123"  //Not required, if it is empty, the default policy will be called.
  • Request signature:

When the user requests the Text Check API, the request can be signed with the appId and secretKey. When the API receives the request with the signature information, it will verify the signature using the same algorithm, and if the signature is found to be inconsistent, the API will return 401 error to the user.

If the API validation signature is consistent and the user corresponding to the appId has permission to operate the requested resource, the request succeeds, otherwise the API returns 401 error.

  • Request Header to send a signature via HTTP

Method: Add a header named Authorization in the request, whose value is the signature value. For example:

 Authorization: ****
  • Signature calculation method
  1. Canonicalized Query String:

Convert the request body JSON string to a hexadecimal string (not Base64) by doing sha256 encoding with UTF-8 character encoding.

CanonicalizedQueryString = hex(sha256(jsonBody))

  1. Constructs the signed string StringToSign ("\n" stands for ASCII newline character):

     StringToSign = HTTPMethod + "\n" +
                    HostHeaderInLowercase + "\n" +
                    HTTPRequestURI + "\n" +
                    CanonicalizedQueryString <get from previous> + "\n" +
                    "X-AppId:" + SAME_APPID_IN_HEADER + "\n" +
                    "X-TimeStamp:" + SAME_TIMESTAMP_IN_HEADER

The HTTP RequestURI is the absolute path to the request URI, without the request string. If the HTTPRequestURI is empty, also keep a forward slash (/)

The hash-based message authentication code (HMAC) is created using the HMAC-SHA256 protocol and the signature is calculated.

  1. StringToSign as the signature string, secretKey as the secret key and SHA256 as the hash algorithm.

    For more information about HMAC, see:
  2. Converting the results of the previous step to a BASE64 string

  3. Put the BASE64 string into the Authorization of HTTP request Header

  • Example of signature

Below is an example of appId & secretKey & video.

content="fuck you"

Below is an example of request type.

 "content":"fuck you",
 "userId": "12345678"

Generate CanonicalizedQueryString


Generate StringToSign


Signatures from HMAC calculations