cURL
curl -X POST https://api.omnifence.ai/api/v1/moderate/text \
-H "Authorization: Bearer $OMNIFENCE_API_KEY" \
-F "text=A beautiful sunset over the ocean" \
-F "webhook_url=https://your-app.com/webhooks/omnifence" # optionalimport requests
url = "http://localhost:3051/api/v1/moderate/text"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:3051/api/v1/moderate/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3051",
CURLOPT_URL => "http://localhost:3051/api/v1/moderate/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3051/api/v1/moderate/text"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3051/api/v1/moderate/text")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3051/api/v1/moderate/text")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued"
}{
"error": "<string>",
"message": "<string>",
"statusCode": 503,
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Moderation
Submit text moderation
Submit text for moderation. Returns a job ID for polling or webhook delivery. The pipeline runs keyword filtering and an LLM prohibition check; prohibited text is rejected, with the reason returned on the completed job. The prohibition check also evaluates every custom category enabled on your account, and names the one that tripped in the reason. Multipart requests allow at most eight non-file fields. Each field other than text must be at most 16,384 UTF-8 bytes. Oversized fields return 400; too many fields return 413.
POST
/
api
/
v1
/
moderate
/
text
cURL
curl -X POST https://api.omnifence.ai/api/v1/moderate/text \
-H "Authorization: Bearer $OMNIFENCE_API_KEY" \
-F "text=A beautiful sunset over the ocean" \
-F "webhook_url=https://your-app.com/webhooks/omnifence" # optionalimport requests
url = "http://localhost:3051/api/v1/moderate/text"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:3051/api/v1/moderate/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3051",
CURLOPT_URL => "http://localhost:3051/api/v1/moderate/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3051/api/v1/moderate/text"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3051/api/v1/moderate/text")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3051/api/v1/moderate/text")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued"
}{
"error": "<string>",
"message": "<string>",
"statusCode": 503,
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Requires the
moderate:text scope. Requests without this scope receive a 403 FORBIDDEN
response. See authentication.The
text field is limited to 20,000 characters. Longer input is rejected with 400 INVALID_REQUEST before a job is created or billed. Split longer documents into chunks and submit
each one.