Skip to main content
POST
/
moderation
/
reasons
Create Reasons
curl --request POST \
  --url https://{appId}.api-{region}.cometchat.io/v3/moderation/reasons \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "unfiltered-content",
  "name": "RawContent",
  "description": "Content delivered without moderation or filtering."
}
'
import requests

url = "https://{appId}.api-{region}.cometchat.io/v3/moderation/reasons"

payload = {
"id": "unfiltered-content",
"name": "RawContent",
"description": "Content delivered without moderation or filtering."
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'unfiltered-content',
name: 'RawContent',
description: 'Content delivered without moderation or filtering.'
})
};

fetch('https://{appId}.api-{region}.cometchat.io/v3/moderation/reasons', 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/reasons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'unfiltered-content',
'name' => 'RawContent',
'description' => 'Content delivered without moderation or filtering.'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$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/reasons"

payload := strings.NewReader("{\n \"id\": \"unfiltered-content\",\n \"name\": \"RawContent\",\n \"description\": \"Content delivered without moderation or filtering.\"\n}")

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

req.Header.Add("Content-Type", "application/json")

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/reasons")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"unfiltered-content\",\n \"name\": \"RawContent\",\n \"description\": \"Content delivered without moderation or filtering.\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{appId}.api-{region}.cometchat.io/v3/moderation/reasons")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"unfiltered-content\",\n \"name\": \"RawContent\",\n \"description\": \"Content delivered without moderation or filtering.\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "unfiltered-content",
    "name": "RawContent",
    "description": "Content delivered without moderation or filtering.",
    "createdAt": 1760449410,
    "updatedAt": 1760449410
  }
}

Body

application/json
id
string
required

Unique identifier for the content type.

Example:

"unfiltered-content"

name
string
required

Display name for the content type.

Example:

"RawContent"

description
string

Description of the content type.

Example:

"Content delivered without moderation or filtering."

Response

200 - application/json

Reason created successfully.

data
object