import { ModerationApi } from "@moderation-api/sdk";
const moderationApi = new ModerationApi({
secretKey: process.env["MODAPI_SECRET_KEY"] ?? "",
});
async function run() {
const result = await moderationApi.channels.create("<id>", {
name: "<value>",
});
console.log(result);
}
run();
import os
from moderation_api import ModerationAPI
with ModerationAPI(
secret_key=os.environ["MODAPI_SECRET_KEY"],
) as moderation_api:
res = moderation_api.channels.create(project_id="<id>", name="<value>")
# Handle response
print(res)
declare(strict_types=1);
require 'vendor/autoload.php';
use ModerationApi;
use ModerationApi\Models\Operations;
$sdk = ModerationApi\ModerationApi::builder()
->setSecurity(
getenv('MODAPI_SECRET_KEY')
)
->build();
$body = new Operations\CreateChannelRequestBody(
name: '<value>',
);
$response = $sdk->channels->create(
projectId: '<id>',
body: $body
);
if ($response->channel !== null) {
// handle response
}
require 'moderation_api'
Models = ::ModerationApi::Models
s = ::ModerationApi::ModerationApi.new(
secret_key: ENV.fetch('MODAPI_SECRET_KEY')
)
res = s.channels.create(project_id: '<id>', body: Models::Operations::CreateChannelRequestBody.new(
name: '<value>'
))
unless res.channel.nil?
# handle response
end
modapi channels create --secret-key "$MODAPI_SECRET_KEY" --project-id '<id>' --name '<value>'
{
"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>"
}{
"type": "invalid_request_error",
"code": "invalid_request",
"message": "Invalid input data",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "authentication_error",
"code": "unauthorized",
"message": "Authorization not provided",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "permission_error",
"code": "permission_denied",
"message": "Insufficient access",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "not_found_error",
"code": "resource_not_found",
"message": "Not found",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}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.
import { ModerationApi } from "@moderation-api/sdk";
const moderationApi = new ModerationApi({
secretKey: process.env["MODAPI_SECRET_KEY"] ?? "",
});
async function run() {
const result = await moderationApi.channels.create("<id>", {
name: "<value>",
});
console.log(result);
}
run();
import os
from moderation_api import ModerationAPI
with ModerationAPI(
secret_key=os.environ["MODAPI_SECRET_KEY"],
) as moderation_api:
res = moderation_api.channels.create(project_id="<id>", name="<value>")
# Handle response
print(res)
declare(strict_types=1);
require 'vendor/autoload.php';
use ModerationApi;
use ModerationApi\Models\Operations;
$sdk = ModerationApi\ModerationApi::builder()
->setSecurity(
getenv('MODAPI_SECRET_KEY')
)
->build();
$body = new Operations\CreateChannelRequestBody(
name: '<value>',
);
$response = $sdk->channels->create(
projectId: '<id>',
body: $body
);
if ($response->channel !== null) {
// handle response
}
require 'moderation_api'
Models = ::ModerationApi::Models
s = ::ModerationApi::ModerationApi.new(
secret_key: ENV.fetch('MODAPI_SECRET_KEY')
)
res = s.channels.create(project_id: '<id>', body: Models::Operations::CreateChannelRequestBody.new(
name: '<value>'
))
unless res.channel.nil?
# handle response
end
modapi channels create --secret-key "$MODAPI_SECRET_KEY" --project-id '<id>' --name '<value>'
{
"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>"
}{
"type": "invalid_request_error",
"code": "invalid_request",
"message": "Invalid input data",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "authentication_error",
"code": "unauthorized",
"message": "Authorization not provided",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "permission_error",
"code": "permission_denied",
"message": "Insufficient access",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "not_found_error",
"code": "resource_not_found",
"message": "Not found",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}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?