Skip to main content
The Moderation API provides endpoints for managing content moderation rules and keyword lists. You can define rules that automatically detect and block inappropriate content in messages, including text profanity, AI-based image/video moderation, and custom keyword filters.

Key Behaviors

  • Default rules cover text profanity, AI-based image/video moderation, custom profanity, contact details, and email content.
  • Text and custom profanity filters scan for words (including regex patterns) and drop the message if a violation is detected.
  • AI-based image/video moderation scans attachments and discards the message if a violation is found.
  • When a rule is violated, the message is blocked. Optionally, the sender can be kicked or banned (in groups) or blocked (in 1-on-1 conversations).

How Moderation Connects to Other Resources

  • Messages — Moderation rules are evaluated against Messages in real time before delivery.
  • Groups — Violations in group messages can trigger member kicks or bans via Group Members and Banned Users.
  • Blocked Users — Violations in 1-on-1 messages can trigger a block on the sender.

Available Endpoints

OperationDescription
RulesCreate, read, update, and delete moderation rules
KeywordsManage keyword lists or regex patterns for text moderation
Blocked MessagesRetrieve messages that violated moderation rules
Flagged MessagesRetrieve flagged messages for review
ReasonsManage custom flag reasons
Rule RevisionsFetch historical revisions of a rule

AI Image and Video Moderation Labels

LabelDescription
ViolenceInstruments or devices used to cause harm — firearms, sharp weapons, explosives, and ammunition
AlcoholDrinking alcoholic beverages from bottles or glasses
GamblingParticipating in games of chance — cards, roulette, slot machines
Drugs & TobaccoTablets, capsules, or the act of smoking cigarettes, cigars, e-cigarettes, hookah, or joints
Rude gesturesHand gesture with the middle finger extended
Explicit NudityVisible human genitalia
Non-Explicit NudityExposed human back from neck to spine without full occlusion
Swimwear or underwearSwimwear or undergarments — bikinis, swim trunks, swim briefs, etc.
Visually DisturbingExtremely thin, undernourished human bodies with severe physical wasting
Hate symbolsSymbols, flags, or gestures associated with extremist or terrorist groups

API Constraints

Need higher limits? Contact CometChat Support to discuss enterprise options.
| Parameter | Limit | |-----------|-------| | Rule ID | Max 100 characters, no spaces or special characters | | Name | Max 100 characters | | Description | Max 255 characters | | Filters per rule | Max 10 filters | | Conditions per rule | Max 10 conditions | | Rules per app | Max 25 custom rules (excludes default rules) |

Error Handling

Error CodeDescription
AUTH_ERR_EMPTY_APIKEYAPI key is missing from the request headers
AUTH_ERR_APIKEY_NOT_FOUNDThe provided API key is invalid
AUTH_ERR_NO_ACCESSThe API key doesn’t have the required scope
For the complete list of error codes, see Error Codes. For system limits, see Properties and Constraints.