Serverless AI Text Moderation
AI powered text moderation service that analyzes text for potentially harmful or inappropriate content.
Endpoint
Text moderation with confidence scores for various labels
POSThttps://api.xtartapp.com/text/moderation
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
text | string | Yes | 2500 | The text to moderate |
Response
Name | Type | Description |
---|---|---|
data | object | The data of the text moderation |
data.classifications | array | Array of classifications with labels and confidence scores |
data.classifications[].label | string | The moderation label, labels list: 'sexual', 'harassment', 'hate', 'illicit', 'harm', 'violence', 'racism', 'insult', 'spam', 'terrorism', 'self-harm', 'drugs', 'gambling', 'pornography', 'personal', 'political', 'religious' |
data.classifications[].confidence | number | The confidence score for the label |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | TEXT_MODERATION_ERROR | Ex: could not moderate the text | parsing error |
400 | HARM_CONTENT | Ex.: The content is harmful and cannot be processed. |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
401 | UNAUTHORIZED | Ex.: The token is invalid. |
429 | TOO_MANY_REQUESTS | Ex.: The request limit has been reached. |