Core features
Content moderation
Classify text against safety categories using the moderations endpoint.
POST
/v1/moderations
Classifies input text against a set of policy categories and returns per-category scores and a top-level flagged boolean.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
input | string or array | Yes | Text to classify. Pass an array to classify multiple strings in one call. |
model | string | No | A safety/moderation model id from your catalog, e.g. Nemotron-3.5-Content-Safety. |
Example request
{
"model": "Nemotron-3.5-Content-Safety",
"input": "I want to learn how to make sourdough bread."
}Batch request
{
"model": "Nemotron-3.5-Content-Safety",
"input": [
"I want to learn how to make sourdough bread.",
"How do I pick a lock?"
]
}Response
{
"id": "modr-abc123",
"model": "Nemotron-3.5-Content-Safety",
"results": [
{
"flagged": false,
"categories": {
"hate": false,
"hate/threatening": false,
"harassment": false,
"harassment/threatening": false,
"self-harm": false,
"self-harm/intent": false,
"self-harm/instructions": false,
"sexual": false,
"sexual/minors": false,
"violence": false,
"violence/graphic": false
},
"category_scores": {
"hate": 0.000012,
"hate/threatening": 0.000001,
"harassment": 0.000034,
"harassment/threatening": 0.000002,
"self-harm": 0.000001,
"self-harm/intent": 0.000001,
"self-harm/instructions": 0.000001,
"sexual": 0.000005,
"sexual/minors": 0.000001,
"violence": 0.000021,
"violence/graphic": 0.000003
}
}
]
}flagged: true means at least one category exceeded the model's threshold. Use category_scores for custom thresholds in your application.
Errors
| Status | When |
|---|---|
400 | Input missing or empty |
401 | API key missing or invalid |
429 | Rate limit or budget exceeded |
Code examples
curl -sS --request "POST" \
--url "$MYT_BASE_URL/moderations" \
--header "Authorization: Bearer $MYT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"model":"Nemotron-3.5-Content-Safety","input":"Hello world"}'Full parameter reference: Moderations.