Skip to content

Moderate Text

The text content to moderate. Maximum 50,000 characters.

The type of content being moderated. Controls how the pipeline interprets the input.

Supported values:

  • default — General-purpose moderation.
  • username — Username validation. Stricter matching for slurs, impersonation, and inappropriate names.
  • chat — Real-time chat messages. Optimized for short, informal text.
  • forum_post — Forum or community posts. Allows longer-form discussion patterns.
  • comment — User comments on content. Balances between chat and forum post handling.

An optional identifier for the user who authored the content. Used for per-user analytics and repeat offender tracking in the dashboard.

Unique identifier for this moderation request.

Recommended action based on category scores and thresholds. One of allow, flag, or block.

true if any category score exceeded its configured threshold.

Per-category moderation results.

Each category contains:

Confidence score from 0.0 to 1.0.

The configured threshold for this category. Scores above this value are flagged.

true if the score exceeds the threshold.

Which pipeline tier handled the request:

  • 0 — Local Rust/WASM processing (fastest, no cost)
  • 1 — OpenAI omni-moderation
  • 2 — Claude Haiku (ambiguous or custom categories)

Total processing time in milliseconds.

The following categories are evaluated by default:

CategoryDescription
toxicityGenerally toxic, rude, or disrespectful language.
harassmentTargeted insults, bullying, or intimidation.
hate_speechAttacks based on race, religion, gender, orientation, or other protected attributes.
sexualSexually explicit or suggestive content.
violenceGraphic violence, threats, or glorification of harm.
self_harmContent promoting or describing self-harm or suicide.
spamSpam, scams, or unsolicited commercial content.
Terminal window
curl -X POST https://api.getsieve.dev/v1/moderate/text \
-H "Authorization: Bearer mod_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"content": "You are such a terrible person, I hope bad things happen to you",
"context": "chat",
"user_id": "user_456"
}'
const response = await fetch("https://api.getsieve.dev/v1/moderate/text", {
method: "POST",
headers: {
"Authorization": "Bearer mod_live_abc123...",
"Content-Type": "application/json",
},
body: JSON.stringify({
content: "You are such a terrible person, I hope bad things happen to you",
context: "chat",
user_id: "user_456",
}),
});
const result = await response.json();
import requests
response = requests.post(
"https://api.getsieve.dev/v1/moderate/text",
headers={
"Authorization": "Bearer mod_live_abc123...",
"Content-Type": "application/json",
},
json={
"content": "You are such a terrible person, I hope bad things happen to you",
"context": "chat",
"user_id": "user_456",
},
)
result = response.json()
{
"request_id": "req_7f3a2b1c",
"action": "flag",
"flagged": true,
"categories": {
"toxicity": {
"score": 0.89,
"threshold": 0.7,
"flagged": true
},
"harassment": {
"score": 0.76,
"threshold": 0.7,
"flagged": true
},
"hate_speech": {
"score": 0.05,
"threshold": 0.7,
"flagged": false
},
"sexual": {
"score": 0.01,
"threshold": 0.8,
"flagged": false
},
"violence": {
"score": 0.42,
"threshold": 0.7,
"flagged": false
},
"self_harm": {
"score": 0.03,
"threshold": 0.7,
"flagged": false
},
"spam": {
"score": 0.01,
"threshold": 0.9,
"flagged": false
}
},
"pipeline_tier": 1,
"latency_ms": 145
}
Terminal window
curl -X POST https://api.getsieve.dev/v1/moderate/text \
-H "Authorization: Bearer mod_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"content": "xX_SlurWord_Xx",
"context": "username"
}'
const response = await fetch("https://api.getsieve.dev/v1/moderate/text", {
method: "POST",
headers: {
"Authorization": "Bearer mod_live_abc123...",
"Content-Type": "application/json",
},
body: JSON.stringify({
content: "xX_SlurWord_Xx",
context: "username",
}),
});
import requests
response = requests.post(
"https://api.getsieve.dev/v1/moderate/text",
headers={"Authorization": "Bearer mod_live_abc123..."},
json={
"content": "xX_SlurWord_Xx",
"context": "username",
},
)
StatusCodeDescription
400invalid_requestMissing content field or content exceeds 50,000 characters.
401unauthorizedMissing or invalid API key.
429rate_limit_exceededToo many requests. Check the Retry-After header.
{
"error": {
"code": "invalid_request",
"message": "The 'content' field is required and must be a non-empty string."
}
}
{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key. Include a valid key in the Authorization header."
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Retry after 1 second.",
"retry_after": 1
}
}