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.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.