Home API Tools Posts Hire Me About
Sign In Create Account
Live Free tier included

AI Content Moderation API

Analyze text for toxicity, profanity, spam, PII, and sentiment in real-time. Supports English & Arabic with auto-censoring, redaction, and actionable safety scores.

Toxicity Scoring PII Redaction Profanity Filter Spam Detection EN + AR

Try it Free

Paste any text and get a comprehensive safety analysis in seconds.

Try Free
Result

Enter text and click Analyze to check for toxicity, spam, PII, and more

API Documentation

Analyze text for toxicity, profanity, spam, PII (personal identifiable information), and sentiment. Supports English and Arabic with automatic language detection.

Endpoint

POST https://www.mahmoudalhabash.com/api/v1/moderate

Send text with optional check types. The API returns safety scores, detected flags, suggested actions (allow/review/block), PII redaction, profanity censoring, and sentiment analysis.

Request Parameters

ParameterTypeRequiredDescription
textstringrequiredText to analyze (max 10,000 characters)
checksarrayoptionalArray of checks: toxicity, profanity, pii, spam, sentiment
languagestringoptionalen, ar, or auto (default: auto)

Response Fields

is_safe Boolean — overall safety determination
overall_score 0.0 (safe) to 1.0 (dangerous)
action allow, review, or block
flags Array of detected issues (e.g. toxic, profanity, pii_detected, spam)
checks.toxicity Score, level, and categories (threat, hate_speech, harassment)
checks.profanity Found words, count, and censored text
checks.pii Detected PII types (email, phone, SSN, credit card) with redacted text
checks.spam Spam score, signals, and boolean is_spam
checks.sentiment Label (positive/negative/neutral/mixed) with confidence

Code Examples

cURL
curl -X POST https://www.mahmoudalhabash.com/api/v1/moderate \ -H "Content-Type: application/json" \ -d '{ "text": "Contact me at user@email.com", "checks": ["toxicity", "pii", "spam"], "language": "auto" }'
Response 200JSON
{ "status": "success", "is_safe": true, "overall_score": 0.0, "action": "allow", "flags": ["pii_detected"], "checks": { "toxicity": {"score": 0, "level": "low"}, "pii": { "found_count": 1, "types": ["email"], "redacted_text": "Contact me at [EMAIL_REDACTED]" }, "spam": {"score": 0, "is_spam": false} } }
JavaScript (fetch)
const res = await fetch('https://www.mahmoudalhabash.com/api/v1/moderate', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: userInput, checks: ['toxicity', 'profanity', 'pii'] }) }); const data = await res.json(); if (data.action === 'block') { alert('Content not allowed'); } else if (data.action === 'review') { queue.push({ text: userInput, flags: data.flags }); }
Python (requests)
import requests resp = requests.post( 'https://www.mahmoudalhabash.com/api/v1/moderate', json={ 'text': user_comment, 'checks': ['toxicity', 'profanity', 'spam'] } ) result = resp.json() if not result['is_safe']: print(f"Blocked: {result['flags']}") else: print(f"Safe. Sentiment: {result['checks']['sentiment']['label']}")

Error Codes

422 Validation failed — text is required (max 10,000 chars)
429 Rate limit exceeded
500 Internal server error

Rate Limits

Unlimited — Free during beta

No API key required. Supports English and Arabic. Pattern-based analysis — no data is stored or sent to third parties.