Add Keywords
curl --request POST \
--url https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords \
--header 'Content-Type: multipart/form-data' \
--header 'apikey: <api-key>' \
--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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
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 = {"apikey": "<api-key>"}
response = requests.post(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: 'POST', headers: {apikey: '<api-key>'}};
options.body = form;
fetch('https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords', 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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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",
"apikey: <api-key>"
],
]);
$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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
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("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
.header("apikey", "<api-key>")
.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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
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": "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
}
}Keywords
Add Keywords
Add keywords or regex patterns to a CometChat moderation list with REST API for automated content checks.
POST
/
moderation
/
keywords
Add Keywords
curl --request POST \
--url https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords \
--header 'Content-Type: multipart/form-data' \
--header 'apikey: <api-key>' \
--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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
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 = {"apikey": "<api-key>"}
response = requests.post(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: 'POST', headers: {apikey: '<api-key>'}};
options.body = form;
fetch('https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords', 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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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",
"apikey: <api-key>"
],
]);
$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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
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("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
.header("apikey", "<api-key>")
.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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
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": "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
}
}Authorizations
API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
Body
multipart/form-data
- Option 1
- Option 2
- Option 3
Type of entries in the list
Available options:
word, pattern, sentence-similarity Comma-separated values of keywords or regex patterns if no file is provided.
Example:
"AI-powered video moderation to detect unsafe content."
CSV file containing the keywords or regex patterns for the list.
Unique identifier for the word list.
Example:
"ID-of-the-word-list"
Descriptive name for the word list.
Example:
"Name of the word list"
Detailed explanation of the word list's purpose.
Example:
"Description of the word list"
Response
200 - application/json
Created Keyword
Show child attributes
Show child attributes
Was this page helpful?
⌘I