Skip to main content
PUT
/
apps
/
{appId}
/
moderation
/
keywords
/
{keywordId}
Update keyword
curl --request PUT \
  --url https://apimgmt.cometchat.io/apps/{appId}/moderation/keywords/{keywordId} \
  --header 'Content-Type: multipart/form-data' \
  --header 'key: <key>' \
  --header 'secret: <secret>' \
  --form 'searchTerms=AI-powered video moderation to detect unsafe content.' \
  --form 'file=<string>' \
  --form id=ID-of-the-word-list \
  --form 'name=Name of the word list' \
  --form 'description=Description of the word list' \
  --form 0.file='@example-file' \
  --form 1.file='@example-file' \
  --form 2.file='@example-file'
import requests

url = "https://apimgmt.cometchat.io/apps/{appId}/moderation/keywords/{keywordId}"

files = {
"0.file": ("example-file", open("example-file", "rb")),
"1.file": ("example-file", open("example-file", "rb")),
"2.file": ("example-file", open("example-file", "rb"))
}
payload = {
"searchTerms": "AI-powered video moderation to detect unsafe content.",
"file": "<string>",
"id": "ID-of-the-word-list",
"name": "Name of the word list",
"description": "Description of the word list"
}
headers = {
"key": "<key>",
"secret": "<secret>"
}

response = requests.put(url, data=payload, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('searchTerms', 'AI-powered video moderation to detect unsafe content.');
form.append('file', '<string>');
form.append('id', 'ID-of-the-word-list');
form.append('name', 'Name of the word list');
form.append('description', 'Description of the word list');
form.append('0.file', '{
"fileName": "example-file"
}');
form.append('1.file', '{
"fileName": "example-file"
}');
form.append('2.file', '{
"fileName": "example-file"
}');

const options = {method: 'PUT', headers: {key: '<key>', secret: '<secret>'}};

options.body = form;

fetch('https://apimgmt.cometchat.io/apps/{appId}/moderation/keywords/{keywordId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://apimgmt.cometchat.io/apps/{appId}/moderation/keywords/{keywordId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"searchTerms\"\r\n\r\nAI-powered video moderation to detect unsafe content.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\nID-of-the-word-list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nName of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nDescription of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"2.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"key: <key>",
"secret: <secret>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://apimgmt.cometchat.io/apps/{appId}/moderation/keywords/{keywordId}"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"searchTerms\"\r\n\r\nAI-powered video moderation to detect unsafe content.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\nID-of-the-word-list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nName of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nDescription of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"2.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("key", "<key>")
req.Header.Add("secret", "<secret>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://apimgmt.cometchat.io/apps/{appId}/moderation/keywords/{keywordId}")
.header("key", "<key>")
.header("secret", "<secret>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"searchTerms\"\r\n\r\nAI-powered video moderation to detect unsafe content.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\nID-of-the-word-list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nName of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nDescription of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"2.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();
require 'uri'
require 'net/http'

url = URI("https://apimgmt.cometchat.io/apps/{appId}/moderation/keywords/{keywordId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["key"] = '<key>'
request["secret"] = '<secret>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"searchTerms\"\r\n\r\nAI-powered video moderation to detect unsafe content.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\nID-of-the-word-list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nName of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nDescription of the word list\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"2.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "profanity-list",
    "name": "Profane Words",
    "category": "word",
    "isCSV": false,
    "searchTerms": [
      "fuck",
      "nigger",
      "fuck",
      "nigger",
      "wanker",
      "cunt",
      "damn",
      "shit",
      "fag",
      "shithead",
      "jizz",
      "hellbitch",
      "retard",
      "cocksucker",
      "cock",
      "kill",
      "cunt",
      "kike",
      "twat",
      "bastard",
      "death",
      "asshole",
      "wop",
      "scumbag",
      "penis",
      "murder",
      "dick",
      "gook",
      "vagina",
      "rape",
      "bastard",
      "spic",
      "spunk",
      "beat"
    ],
    "createdAt": 1718354412,
    "updatedAt": 1718354412,
    "revisionId": "253157108b5294c4_profanity-list_1",
    "active": true,
    "default": true
  }
}

Headers

key
string
required

Authorization Key

secret
string
required

Authorization Secret

Path Parameters

keywordId
string
required

Keyword ID

appId
string
required

AppID in which the extension has to be enabled/disabled

Body

multipart/form-data
category
enum<string>
required

Type of entries in the list

Available options:
word,
pattern,
sentence-similarity
searchTerms
string
required

Comma-separated values of keywords or regex patterns if no file is provided.

Example:

"AI-powered video moderation to detect unsafe content."

file
file

CSV file containing the keywords or regex patterns for the list.

id
string

Unique identifier for the word list.

Example:

"ID-of-the-word-list"

name
string

Descriptive name for the word list.

Example:

"Name of the word list"

description
string

Detailed explanation of the word list's purpose.

Example:

"Description of the word list"

Response

200 - application/json

Update Keyword

data
object