Skip to main content
The moderation API returns a structured response that helps you decide how to handle content. Here’s an example response:
Example response
How you act on the response is up to you:
  • Block the content and return an error message to your user if it gets flagged
  • Store it to your database and let a human review it using review queues
  • Do something in between and only review content when the AI is not confident in its decision

Use the recommendation

The easiest way to handle moderation responses is to use the recommendation object. It provides a clear action based on your channel configuration, severity scores, and author status.
The reason_codes array tells you why a particular recommendation was made:

Check if flagged

For simple use cases, you can check the evaluation.flagged field. This boolean indicates if any of your enabled policies detected something that triggered a flag.

Severity score

The severity_score gives you more granular control. Higher scores indicate more severe violations:
We recommend using the recommendation.action field instead of implementing your own threshold logic. Configure thresholds in your channel settings for easier management.

Check the casebook

Your casebook is the record of how your team has ruled on content in the past. When you submit something close to a case it already holds, the response carries a casebook object describing what it found.

Agreement vs. confidence

Both are 0-1 strength numbers, and they answer different questions: agreement is unanimity, ignoring volume. Two cases that both say reject score the same as fifty that do. It is always at least 0.8 when a verdict is returned — below that the casebook reports a disagreement rather than picking a side — so treat it as a description of how clean the consensus was, not as a threshold to re-apply yourself. confidence is that agreement scaled by how much evidence backs it, so a handful of close, recent cases outweighs a single distant one. Older cases count for less, halving in weight roughly every 180 days. This is the number to use when you want a strength condition, and it is the one available in rules as casebook.confidence.
A high agreement with a low confidence means your cases were unanimous but there were few of them, or they were old. That is the casebook telling you it has an opinion it does not hold strongly.

When casebook is null

The field is null whenever the casebook has nothing to say, which covers several situations you do not need to tell apart:
  • Nothing in your casebook was close enough to the content.
  • The matching cases contradicted each other, so the casebook declined to pick a side.
  • Casebook lookups are not switched on for the channel handling the request.
  • Your plan does not include casebook lookups.
Always guard on it rather than reading through:
casebook reports what your casebook found. Whether it decided the outcome is a separate question — check recommendation, where a higher-priority rule may have settled the item first. When the casebook did decide, recommendation.reason_codes contains casebook_match.

Work with individual policies

The policies array contains results from each policy enabled in your channel, sorted by highest probability. Each policy includes:

Classifier policies

Classifier policies (like toxicity, spam, hate) analyze content and return a probability score:

Entity matcher policies

Entity matcher policies (like personal_information, url) detect and extract specific entities:

Handle masked content

If you have PII masking enabled, the API can automatically redact sensitive information. Check the content object:
This is useful for:
  • Anonymizing content before storing in your database
  • Preventing users from seeing personal information
  • Compliance with data protection regulations

Check author status

If you’re using author management, the response includes author information:

Use insights

The insights array provides additional analysis that doesn’t affect flagging:

Detect unicode spoofing

Spammers sometimes use look-alike characters to bypass moderation (e.g., mоney with a Cyrillic “о” instead of Latin “o”). The API detects and normalizes these characters. Check the unicode_spoofed field:
The field is omitted when neither normalization nor the Unicode spoofing policy is enabled on the channel, since nothing analyzed the text. To flag and route spoofed content rather than just observe it, enable the Unicode spoofing policy.

Handle errors

Check meta.status for the overall request status:
The errors array contains details about any policies that encountered issues during processing.