Text Moderation
Text moderation is crucial for any application that deals with user-generated content. Kayle helps you automate this process with our text moderation API.
For text moderation, we offer two API methods. One which allows you to receive an immediate decision, and another which sends a webhook to your application when the moderation is complete.
Request Text Moderation
This endpoint allows you to moderate text.
Required attributes
- Name
text
- Type
- string
- Description
The text to moderate.
- Name
type
- Type
- string
- Description
If you haven't specified a type via the URL (i.e. you've used
/v1/moderate
instead of/v1/moderate/text
), you must specify the type of content you are moderating here. For text moderation, this must be set totext
.
Optional attributes
- Name
immediate
- Type
- boolean
- Default
- default: true
- Description
If set to true, the API will return a decision immediately.
Webhooks
If you've set immediate
to false
, we'll send you a webhook when the moderation is complete.
See the webhooks guide for more information on how webhooks work.
Request
curl -X POST https://api.kayle.ai/v1/moderate \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"text": "{text_to_moderate}", "type": "text" }'
Text Moderation Response
{
"is_safe": false,
"violations": [
"hate",
"self-harm"
],
"severity": 9
}
Text Moderation Webhook
{
"id": "WAz8eIbvDR60rouK",
"type": "text.moderation",
"payload": {
"is_safe": false,
"violations": [
"hate",
"self-harm"
],
"severity": 9
}
}