> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-angular-v5-docs-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Create a CometChat moderation rule with REST API to define content checks, actions, and rule conditions.

# Add Rule



## OpenAPI

````yaml post /moderation/rules
openapi: 3.0.0
info:
  title: Chat APIs
  description: Manage messages, users, groups for a particular app using our Chat API.
  version: '3.0'
servers:
  - url: https://{appId}.api-{region}.cometchat.io/v3
    variables:
      appId:
        default: appId
        description: (Required) App ID
      region:
        enum:
          - us
          - eu
          - in
        default: us
        description: Select Region
security: []
tags:
  - name: API Keys
    description: The API keys are used to authorise the APIs
  - name: Roles
    description: The roles are used to give user access rights
  - name: Users
    description: The REST collection for users.
  - name: Auth Tokens
    description: The auth tokens are used to login end users using client SDKs.
  - name: Blocked Users
    description: The REST collections for blocked users.
  - name: Friends
    description: List,add and remove friends by passing UID in path variables
  - name: Groups
    description: The REST collections for groups.
  - name: Banned Users
    description: Ban and Unban user by passing other UID in path variables.
  - name: Group Members
    description: The REST collections for group members.
  - name: Messages
    description: The REST collections for messages.
  - name: Conversations
    description: The REST collections for conversations.
  - name: Restrict Features
    description: Allows Restricting Features
  - name: Metrics
    description: Allows accessing Data Metrics
  - name: Triggers
    description: Allows adding triggers to a webhook.
  - name: Webhooks
    description: Allows accessing Webhooks.
  - name: Notifications
    description: Allows configuring Notifications core.
paths:
  /moderation/rules:
    post:
      tags:
        - Moderation
      summary: Add Rule
      description: >-
        Create a new moderation rule to specify actions and conditions for
        detecting and handling inappropriate content.
      operationId: create-rule
      parameters:
        - $ref: bdd44449-3415-4c98-8621-a438d75c8af7
        - $ref: eb8af1b4-d1c5-4104-b698-ace31da8b21a
        - $ref: 2b4ece7a-1864-457f-a686-bc6cdb5d5c7e
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: b1534907-a1a4-4e4e-8a5c-a13edc4e6201
      responses:
        '200':
          description: Created Rule
          content:
            application/json:
              schema:
                properties:
                  data:
                    properties:
                      '': ea5ace38-35e1-4c4d-94e8-a72963af7cb1
                    type: object
                type: object
              example:
                data:
                  id: moderation-test
                  name: Video Moderation
                  description: AI-powered video moderation to detect unsafe content.
                  enabled: true
                  conditions:
                    - id: 1
                      isKeywordsReferencePresent: false
                      isMediaPresent: true
                      entity: message
                      operand: image
                      category: word
                      operator: contains
                      value:
                        - violence_greaterThan_30
                      message:
                        - >-
                          Image contains violence with confidence greater than
                          30
                  action:
                    - blockMessage
                  active: true
                  createdAt: 1720003247
                  updatedAt: 1720003247
                  revisionId: 253179cf5f665257_moderation-test_1

````