Skip to main content
PUT
/
api
/
v3
/
network-settings
/
enhance-moderation
Update enhance-moderation configuration.
curl --request PUT \
  --url https://apix.us.amity.co/api/v3/network-settings/enhance-moderation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "enabled": true,
  "commentDeletionBehavior": "delete_attachment_only",
  "confidences": [
    {
      "category": "hate",
      "flagConfidence": 3,
      "blockConfidence": 5,
      "moderationType": "text"
    }
  ],
  "userModerationExclusionPatterns": [
    "^admin_"
  ]
}
'
import requests

url = "https://apix.us.amity.co/api/v3/network-settings/enhance-moderation"

payload = {
"enabled": True,
"commentDeletionBehavior": "delete_attachment_only",
"confidences": [
{
"category": "hate",
"flagConfidence": 3,
"blockConfidence": 5,
"moderationType": "text"
}
],
"userModerationExclusionPatterns": ["^admin_"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
commentDeletionBehavior: 'delete_attachment_only',
confidences: [
{
category: 'hate',
flagConfidence: 3,
blockConfidence: 5,
moderationType: 'text'
}
],
userModerationExclusionPatterns: ['^admin_']
})
};

fetch('https://apix.us.amity.co/api/v3/network-settings/enhance-moderation', 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://apix.us.amity.co/api/v3/network-settings/enhance-moderation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'commentDeletionBehavior' => 'delete_attachment_only',
'confidences' => [
[
'category' => 'hate',
'flagConfidence' => 3,
'blockConfidence' => 5,
'moderationType' => 'text'
]
],
'userModerationExclusionPatterns' => [
'^admin_'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://apix.us.amity.co/api/v3/network-settings/enhance-moderation"

payload := strings.NewReader("{\n \"enabled\": true,\n \"commentDeletionBehavior\": \"delete_attachment_only\",\n \"confidences\": [\n {\n \"category\": \"hate\",\n \"flagConfidence\": 3,\n \"blockConfidence\": 5,\n \"moderationType\": \"text\"\n }\n ],\n \"userModerationExclusionPatterns\": [\n \"^admin_\"\n ]\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
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.put("https://apix.us.amity.co/api/v3/network-settings/enhance-moderation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"commentDeletionBehavior\": \"delete_attachment_only\",\n \"confidences\": [\n {\n \"category\": \"hate\",\n \"flagConfidence\": 3,\n \"blockConfidence\": 5,\n \"moderationType\": \"text\"\n }\n ],\n \"userModerationExclusionPatterns\": [\n \"^admin_\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://apix.us.amity.co/api/v3/network-settings/enhance-moderation")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"commentDeletionBehavior\": \"delete_attachment_only\",\n \"confidences\": [\n {\n \"category\": \"hate\",\n \"flagConfidence\": 3,\n \"blockConfidence\": 5,\n \"moderationType\": \"text\"\n }\n ],\n \"userModerationExclusionPatterns\": [\n \"^admin_\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "enabled": true,
  "commentDeletionBehavior": "delete_whole_comment",
  "confidences": [
    {
      "category": "hate",
      "flagConfidence": 3,
      "blockConfidence": 5,
      "moderationType": "text"
    },
    {
      "category": "nudity",
      "flagConfidence": 40,
      "blockConfidence": 80,
      "moderationType": "media"
    }
  ],
  "userModerationExclusionPatterns": [
    "^admin_"
  ]
}
{
"status": "error",
"code": 400000,
"message": "Bad Request."
}
{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Enhance-moderation configuration. All fields are optional; only the fields you send are written.

enabled
boolean

Enable or disable enhance-moderation.

commentDeletionBehavior
enum<string>

What to remove when a comment trips moderation.

Available options:
delete_whole_comment,
delete_attachment_only
confidences
object[]
Required array length: 1 - 100 elements
userModerationExclusionPatterns
string[]

Regex patterns for users excluded from moderation.

Minimum string length: 1

Response

Enhance-moderation configuration

enabled
boolean
default:false
commentDeletionBehavior
enum<string>
default:delete_whole_comment

What to remove when a comment trips moderation.

Available options:
delete_whole_comment,
delete_attachment_only
confidences
object[]
userModerationExclusionPatterns
string[]

Regex patterns for users excluded from moderation.

Minimum string length: 1