Endpoint
Request
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Body Parameters
The text to moderate. Should be a non-empty string.Min length: 1 character
Max length: 10,000 characters (recommended)
Request Example
Response
Returns a ModerationResponse object with:- Individual model outputs (
label) - Ensemble decision (
ensemble) - Metadata (
meta)
Response Schema
Success Response (200)
- Safe Content
- Harmful Content
Error Responses
400 Bad Request
400 Bad Request
Cause: Invalid request body or empty text
422 Unprocessable Entity
422 Unprocessable Entity
Cause: Request body doesn’t match expected schema
500 Internal Server Error
500 Internal Server Error
Cause: Server error during processing
Performance
| Metric | Value |
|---|---|
| Average Response Time | 20-40ms |
| With GPU | 15-25ms |
| Without GPU | 40-60ms |
| Rate Limit | Configurable (via Redis) |
Use Cases
- Real-time moderation: Moderate user comments before posting
- Content filtering: Screen user-generated content
- Chat moderation: Filter messages in real-time
- Form validation: Check text inputs on submission
Best Practices
Preprocessing
The API handles preprocessing automatically. Send raw user input without manual cleaning.
Use Ensemble
Rely on
ensemble.summary for quick decisions. Individual model outputs are available for detailed analysis.Handle Errors
Implement proper error handling. The API returns detailed error messages.
Monitor Latency
Track
processing_time_ms to monitor performance and detect issues.Related Endpoints
See Also
- Response Structure - Understanding the response
- Ensemble Logic - How scores are calculated
- Python SDK - Python client library
- JavaScript SDK - JavaScript/TypeScript client library