API Endpoint
POST Content Moderation & Spam API
/api/v1/ai/spam-detection
Analyze text to detect spam, promotional abuse, toxicity, and PII, keeping your platform safe from malicious actors.
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
text |
string | Required | The raw text content to analyze (Max: 5,000 characters). |
content_type |
string | Optional | Context of where the text came from (e.g., "blog_comment", "email", "product_review"). Helps the AI understand the expected format. |
strictness |
string | Optional | Filter strictness: "low", "medium", or "high". Default is "medium". |
detect_toxicity |
boolean | Optional | Optional. Set to true to analyze the text for hate speech, harassment, and severe profanity. |
detect_pii |
boolean | Optional | Optional. Set to true to detect Personal Identifiable Information (emails, phone numbers, SSNs). |
return_sanitized |
boolean | Optional | Optional. Set to true to receive a redacted version of the text where malicious links, profanity, and PII are replaced with "[REMOVED]". |
model |
string | Optional | Optional AI model to use. |
Example Request (Full Moderation)
In this example, we test a highly abusive comment and request all advanced moderation features, including sanitization.
JSON Request
{
"text": "You guys are idiots! Call me at 555-019-2831 or visit my crypto scam site http://bit.ly/scam-link to win free money.",
"content_type": "blog_comment",
"strictness": "high",
"detect_toxicity": true,
"detect_pii": true,
"return_sanitized": true
}
cURL
curl -X POST https://rsflowhub.com/api/v1/ai/spam-detection \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "You guys are idiots! Call me at 555-019-2831 or visit my crypto scam site http://bit.ly/scam-link to win free money.",
"content_type": "blog_comment",
"strictness": "high",
"detect_toxicity": true,
"detect_pii": true,
"return_sanitized": true
}'
Example Response
The API processes the text and returns a comprehensive moderation report, including the safely redacted text.
JSON Response
{
"success": true,
"data": {
"result": {
"is_spam": true,
"spam_score": 0.98,
"spam_category": "promotional",
"reason": "Contains a suspicious shortlink and unsolicited promotional language.",
"is_toxic": true,
"toxicity_score": 0.85,
"contains_pii": true,
"pii_types": ["phone_number"],
"sanitized_text": "You guys are [REMOVED]! Call me at [REMOVED] or visit my crypto scam site [REMOVED] to win free money."
}
},
"meta": {
"credits_used": 2,
"credits_remaining": 991
}
}
API Request Example
Use the cURL snippet below to test the endpoint.
cURL
curl -X POST 'https://rsflowhub.com/api/v1/ai/spam-detection' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"text": "You guys are idiots! Call me at 555-019-2831 or visit http://bit.ly/scam-link",
"content_type": "blog_comment",
"detect_toxicity": true,
"detect_pii": true,
"return_sanitized": true
}'