curl --request POST \
--url https://api.moderationapi.com/v1/projects/{projectId}/channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"key": "<string>",
"description": "<string>"
}
'import requests
url = "https://api.moderationapi.com/v1/projects/{projectId}/channels"
payload = {
"name": "<string>",
"key": "<string>",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', key: '<string>', description: '<string>'})
};
fetch('https://api.moderationapi.com/v1/projects/{projectId}/channels', 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://api.moderationapi.com/v1/projects/{projectId}/channels",
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([
'name' => '<string>',
'key' => '<string>',
'description' => '<string>'
]),
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://api.moderationapi.com/v1/projects/{projectId}/channels"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.moderationapi.com/v1/projects/{projectId}/channels")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moderationapi.com/v1/projects/{projectId}/channels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"projectId": "<string>",
"key": "<string>",
"name": "<string>",
"description": "<string>",
"isDefault": true,
"contentType": "profile",
"flaggingMode": "DRY_RUN",
"contextEnabled": true,
"enableImageModeration": true,
"enableVideoModeration": true,
"enableAudioModeration": true,
"enableVoiceModeration": true,
"includeTranscriptInResponse": true,
"transcriptionQuality": "SPEED",
"unicodeSpoofDetectionEnabled": true,
"frameCaptureInterval": 30.05,
"maxFramesPerVideo": 500,
"spreadFrames": true,
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}Create a channel
Create a channel in a project, with the default rules. The project’s first channel becomes its default. Needs the channels:write permission.
curl --request POST \
--url https://api.moderationapi.com/v1/projects/{projectId}/channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"key": "<string>",
"description": "<string>"
}
'import requests
url = "https://api.moderationapi.com/v1/projects/{projectId}/channels"
payload = {
"name": "<string>",
"key": "<string>",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', key: '<string>', description: '<string>'})
};
fetch('https://api.moderationapi.com/v1/projects/{projectId}/channels', 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://api.moderationapi.com/v1/projects/{projectId}/channels",
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([
'name' => '<string>',
'key' => '<string>',
'description' => '<string>'
]),
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://api.moderationapi.com/v1/projects/{projectId}/channels"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.moderationapi.com/v1/projects/{projectId}/channels")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moderationapi.com/v1/projects/{projectId}/channels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"projectId": "<string>",
"key": "<string>",
"name": "<string>",
"description": "<string>",
"isDefault": true,
"contentType": "profile",
"flaggingMode": "DRY_RUN",
"contextEnabled": true,
"enableImageModeration": true,
"enableVideoModeration": true,
"enableAudioModeration": true,
"enableVoiceModeration": true,
"includeTranscriptInResponse": true,
"transcriptionQuality": "SPEED",
"unicodeSpoofDetectionEnabled": true,
"frameCaptureInterval": 30.05,
"maxFramesPerVideo": 500,
"spreadFrames": true,
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the project to add the channel to.
Body
The channel's name.
1 - 100The key you pass as channel when you moderate content. Defaults to the name in lowercase with dashes. Must be unique in the project.
1 - 100^[A-Za-z0-9_-]+$The channel's description.
500The kind of content the channel moderates.
profile, message, post, comment, event, product, review, voice, other Response
Channel created successfully
The ID of the channel.
The ID of the project the channel is in.
The key you pass as channel when you moderate content. Unique in the project.
The channel's name.
The channel's description.
Whether requests that name no channel use this one. Each project has one default channel.
The kind of content the channel moderates.
profile, message, post, comment, event, product, review, voice, other ACTIVE flags content. DRY_RUN evaluates content without flagging it.
DRY_RUN, ACTIVE Whether earlier messages in the conversation are read when moderating a message.
Whether images are moderated.
Whether videos are moderated.
Whether audio is moderated.
Whether real-time voice streams are moderated.
Whether audio and video transcripts are returned in responses.
Trade-off between transcription speed and accuracy.
SPEED, BALANCED, ACCURACY Whether look-alike Unicode characters are normalized before moderation.
Seconds between frames captured from a video.
0.1 <= x <= 60The most frames moderated per video.
1 <= x <= 1000Whether frames are spread evenly across the whole video.
When the channel was created.
When the channel was last changed.
Was this page helpful?