Skip to main content

Add profanity words in batch

Add multiple profanity words to the filter list in a single request.

  • Default maximum: 50 profanity words total. If adding the batch exceeds the limit, the entire request fails and the response includes the remaining quota.
  • Changes take effect after approximately 15 minutes.
  • Supported languages: Chinese, English, Japanese, German, Russian, Korean, Arabic.

See Content moderation overview for profanity filter rules.

Prerequisites

The profanity filter is built in and requires no activation. By default, it applies only to messages sent from client SDKs. To apply it to server API messages, enable Moderate messages sent by server API in the console.

Request

POST: https://[Base URL](/platform-chat-api/base-url)/v4/profanity-word/batch/add

Rate limit: 100 requests per second

Authentication: All server API requests require signature verification. See API request signing.

Request body

Content type: application/json

ParameterTypeRequiredDescription
wordsArrayYesArray of profanity word objects. Max 50 total profanity words.
words[i].wordStringYesThe profanity word. Max 32 characters.
words[i].replacementStringNoReplacement text (max 32 characters). If not set, messages containing the word are blocked. If set, the word is replaced before delivery.

Request example

HTTP
POST /v4/profanity-word/batch/add HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json

{
"words": [
{
"word": "badword1",
"replacement": "***"
},
{
"word": "badword2"
}
]
}

Response

PropertyTypeDescription
codeNumberStatus code. 0 indicates success.
result.remainingQuotaNumberRemaining number of profanity words that can be added.

Response example

HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
"code": 0,
"result": {
"remainingQuota": 50
}
}