Moderate content

Request fields, response fields, and the moderation categories.

POST /v1/moderations classifies one text message and returns a structured outcome.

Request

Send a JSON body with Content-Type: application/json:

{
  "content": "Ești un om minunat!",
  "language": "ro"
}
Field Type Required Description
content string Yes The text to classify. 1–16,000 characters (UTF-16 code units). Can't be empty, whitespace only, or contain NUL (\u0000) characters.
language string No A language hint: a two- or three-letter code with an optional two-letter region, such as ro, fil, or pt-BR. Omit it or send null for automatic interpretation.

The whole request body is limited to 64 KiB. Unknown fields are ignored.

When to send language

Send language when you know it, for example from the author's profile or your app's locale. Any value other than English ensures multilingual evaluation. The hint can't weaken moderation: sending en doesn't skip any checks, and some models ignore the hint.

Response

A successful request returns 200 OK:

{
  "flagged": true,
  "categories": ["harassment", "vulgarity"],
  "latencyMs": 82.5,
  "outcome": "Rejected",
  "evaluatedBy": "Model"
}
Field Type Description
outcome string Pass, FlaggedForReview, or Rejected. Use this field to decide what to do. See Outcomes and thresholds.
categories string[] Every category that didn't pass, under your thresholds. Empty when the outcome is Pass.
flagged boolean true for both FlaggedForReview and Rejected. Kept for compatibility; prefer outcome.
evaluatedBy string Model, Prefilter, or Cache. See How moderation works.
latencyMs number Pipeline time in milliseconds, including failover attempts.
reviewId string (UUID) Only present when outcome is FlaggedForReview. Use it to track the human decision.

Responses carry Cache-Control: no-store. Ignore fields you don't recognize: new fields and enum values can be added without a new API version.

Categories

Every inference route reports the same category keys:

Category Covers
harassment Harassing, insulting, or demeaning language aimed at a person or group
harassment/threatening Harassment that also includes threats of violence or serious harm
hate Hateful content based on protected characteristics such as race, religion, gender, or disability
hate/threatening Hateful content that also includes threats
sexual Sexually explicit content
sexual/minors Sexual content involving anyone under 18
violence Content that depicts, praises, or encourages violence
violence/graphic Graphic depictions of death, injury, or gore
self-harm Content about self-harm, suicide, or eating disorders
self-harm/intent Expressions of intent to self-harm
self-harm/instructions Instructions or encouragement for self-harm
illicit Advice or instructions for committing wrongdoing
illicit/violent Illicit content that also involves violence or weapons
vulgarity Profanity and obscene language, including untargeted swearing

vulgarity is a Clusterbot criterion that not every inference route scores. When a result has no vulgarity score, a vulgarity threshold can't apply, so don't rely on vulgarity alone to block profanity.

Behavior to rely on

  • Server-managed routing. You can't choose a provider or model. Retired routing fields are ignored.
  • Failures are never results. If evaluation fails, you receive an error, never an unflagged response.
  • No idempotency. Each request is a new attempt. Retrying a request that timed out on your side can be charged twice.
  • Thresholds apply at request time. Changing thresholds affects later requests only; earlier results are never re-evaluated.

Validation errors

Problem Response
Missing, empty, whitespace-only, or oversized content 400 invalid_content
content contains NUL characters 400 invalid_content
Malformed language 400 invalid_language
Invalid JSON or wrong field types 400
Body over 64 KiB 413

Validation failures are not charged. See Errors for the complete list.

Questions about this guide? Contact us or try requests in the playground.