Skip to main content

Overview

Guardian API returns structured JSON responses with comprehensive moderation data from all four models.

Response Schema

Top-Level Fields

text (string)

The input text that was moderated. May be truncated if very long.

label (object)

Outputs from all three detection models.

ensemble (object)

Final moderation decision combining all models.

meta (object)

Request metadata including processing time and models used.

Label Structure

Sexism Label

Toxicity Label

The overall score is automatically set to at least the maximum of all sub-category scores.

Rules Label

Ensemble Structure

The ensemble object provides the final moderation decision:

Summary Values

Primary Issue Values

Meta Structure

Metadata about the request and processing:

Complete Example

Request:
Response:

Using Response Data

Decision Making

1

Check ensemble.summary

Use the summary for quick decisions:
  • "likely_safe": Allow content
  • "potentially_harmful": Flag for review
  • "likely_harmful" or "highly_harmful": Block or moderate
2

Check ensemble.primary_issue

Understand why content was flagged:
  • Show specific feedback to users
  • Route to appropriate moderators
  • Apply category-specific rules
3

Use individual labels for detail

Access specific model outputs for:
  • Detailed reporting
  • Custom threshold logic
  • Audit trails
4

Monitor processing_time_ms

Track performance:
  • Identify slow requests
  • Optimize infrastructure
  • Set appropriate timeouts

Example Implementation

Next Steps

API Reference

Try the moderation endpoint

Ensemble

Learn how scores are calculated

Python SDK

Use the Python SDK

JavaScript SDK

Use the JavaScript SDK