Example response
- 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 therecommendation object. It provides a clear action based on your channel configuration, severity scores, and author status.
reason_codes array tells you why a particular recommendation was made:
Check if flagged
For simple use cases, you can check theevaluation.flagged field. This boolean indicates if any of your enabled policies detected something that triggered a flag.
Severity score
Theseverity_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 acasebook
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.
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
Thepolicies array contains results from each policy enabled in your channel, sorted by highest probability. Each policy includes:
Classifier policies
Classifier policies (liketoxicity, spam, hate) analyze content and return a probability score:
Entity matcher policies
Entity matcher policies (likepersonal_information, url) detect and extract specific entities:
Handle masked content
If you have PII masking enabled, the API can automatically redact sensitive information. Check thecontent object:
- 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
Theinsights 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:
Handle errors
Checkmeta.status for the overall request status:
errors array contains details about any policies that encountered issues during processing.