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

> Add keywords or regex patterns to a CometChat moderation list with REST API for automated content checks.

# Add Keywords



## OpenAPI

````yaml post /moderation/keywords
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.
  - name: Moderation
    description: The REST collections for Moderations.
paths:
  /moderation/keywords:
    post:
      tags:
        - Moderation
      summary: Add Keywords
      description: Create a new keyword list for moderation.
      operationId: chat-api-create-rule-keyword
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/KeywordList'
      responses:
        '200':
          description: Created Keyword
          content:
            application/json:
              schema:
                properties:
                  data:
                    properties:
                      '':
                        $ref: '#/components/schemas/webhookSchema'
                    type: object
                type: object
              example:
                data:
                  id: profane-word-list-1
                  name: profane word list
                  description: Profane word list
                  category: word
                  isCSV: true
                  searchTerms:
                    - '"a"'
                    - '"b"'
                    - '"c"'
                  createdAt: 1720023805
                  updatedAt: 1720023805
                  revisionId: 253179cf5f665257_profane-word-list-1_1
                  active: true
      security:
        - apiKey: []
components:
  schemas:
    KeywordList:
      discriminator:
        propertyName: category
        mapping:
          word:
            $ref: '#/components/schemas/WordPatternSchema'
          pattern:
            $ref: '#/components/schemas/PatternSchema'
          sentence-similarity:
            $ref: '#/components/schemas/SentenceSimilaritySchema'
      oneOf:
        - $ref: '#/components/schemas/WordPatternSchema'
        - $ref: '#/components/schemas/PatternSchema'
        - $ref: '#/components/schemas/SentenceSimilaritySchema'
    webhookSchema:
      description: Response data
      properties:
        id:
          type: string
        name:
          type: string
        webhookURL:
          type: string
        useBasicAuth:
          type: boolean
        username:
          type: string
        password:
          type: string
        enabled:
          type: boolean
        createdAt:
          type: integer
        updatedAt:
          type: integer
      type: object
    WordPatternSchema:
      required:
        - category
        - searchTerms
      properties:
        file:
          description: CSV file containing the keywords or regex patterns for the list.
          type: string
          format: binary
        id:
          description: Unique identifier for the word list.
          type: string
          example: ID-of-the-word-list
        name:
          description: Descriptive name for the word list.
          type: string
          example: Name of the word list
        description:
          description: Detailed explanation of the word list's purpose.
          type: string
          example: Description of the word list
        category:
          $ref: '#/components/schemas/CategoryType'
        searchTerms:
          description: >-
            Comma-separated values of keywords or regex patterns if no file is
            provided.
          type: string
          example: AI-powered video moderation to detect unsafe content.
      type: object
    PatternSchema:
      required:
        - category
        - searchTerms
      properties:
        file:
          description: CSV file containing the keywords or regex patterns for the list.
          type: string
          format: binary
        id:
          description: Unique identifier for the pattern list.
          type: string
          example: ID-of-the-pattern-list
        name:
          description: Descriptive name for the pattern list.
          type: string
          example: Name of the pattern list
        description:
          description: Detailed explanation of the pattern list's purpose.
          type: string
          example: Description of the pattern list
        category:
          $ref: '#/components/schemas/CategoryType'
        searchTerms:
          description: >-
            Comma-separated values of keywords or regex patterns if no file is
            provided.
          type: string
          example: AI-powered video moderation to detect unsafe content.
      type: object
    SentenceSimilaritySchema:
      required:
        - category
        - disallowedSentences
      properties:
        file:
          description: CSV file containing the keywords or regex patterns for the list.
          type: string
          format: binary
        id:
          description: Unique identifier for the keyword list.
          type: string
          example: ID-of-the-sentences-list
        name:
          description: Descriptive name for the keyword list.
          type: string
          example: Name of the sentences list
        description:
          description: Detailed explanation of the keyword list's purpose.
          type: string
          example: Description of the sentences list
        category:
          $ref: '#/components/schemas/CategoryType'
        disallowedSentences:
          description: >-
            Comma-separated sentences that are disallowed if the category is
            'sentence-similarity'.
          type: array
          items:
            type: string
          example:
            - Hello, let's connect on Whatsapp.
      type: object
    CategoryType:
      description: Type of entries in the list
      type: string
      enum:
        - word
        - pattern
        - sentence-similarity
  securitySchemes:
    apiKey:
      type: apiKey
      description: API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
      name: apikey
      in: header

````