Enterprise Content Moderation API
The Content Moderation API is a powerful, enterprise-grade solution designed to automatically detect and filter harmful content across text, images, videos, and audio with military-grade precision and sub-second response times.
Text Safety
Detect toxicity, hate speech, harassment, and spam across 100+ languages.
API Logic Flow & Decision Process
How the API Processes Your Request
Step 1: Parameter Validation
- Required:
content_type
,moderate
,api_key
- Optional:
threshold
(default: 0.7),custom_instruction
- If any required parameter is missing →
400 Bad Request
Step 2: Content Type Processing
- text: Direct text analysis
- text_custom_instruction: Uses your custom moderation rules
Step 3: Moderation Categories Decision
Scenario A: "standard" only
Uses 16 predefined categories: Finance, Health, Religion & Belief, Legal, Toxic, Insult, Public Safety, War & Conflict, Illicit Drugs, Profanity, Politics, Derogatory, Violent, Sexual, Death Harm & Tragedy, Firearms & Weapons
Scenario B: "standard" + custom words
Uses all 16 standard categories PLUS your custom moderation topics with custom words you defined (max 50 total)
Step 4: AI Analysis Process
- Confidence Scoring: Determines confidence scores with respect to 16 standard moderation types
- Text Parsing: Parses text to match words and phrases against 16 standard types and any additional custom ones added by user
- Custom Instructions: Moderates text based on custom specific instructions which allows more granular control over moderation than by setting moderation types only. You can e.g. instruct our API to keep specific words even though they may belong to one of moderation types, or remove specific custom words even though they do not belong to one of moderation types
Step 5: Response Generation
- moderation: Confidence scores for standard moderation types (JSON)
- moderation_words: Specific phrases found matching your categories. Each matched phrase is represented in array as element [phrase, moderation type, start index of phrase in text, end index of phrase]
- moderation_custom_instruction: Custom analysis result (if applicable)
- status: 200 (success) or error code
Authentication
API requests should be sent to the secure endpoint:
A valid API key is required to access our enterprise API endpoints. API keys are available through our enterprise subscription plans. After obtaining a plan, log in to your dashboard to retrieve your unique API key.
Include your API key in all requests as a parameter:
Advanced Content Moderation
Submit a POST request with your content and specify which types of harmful content to detect. Our AI-powered engine analyzes content across multiple dimensions and returns detailed safety scores and classifications.
Moderation Parameter Logic
What happens with different "moderate" values?
Empty "moderate" Parameter
Result: API returns error
"standard" Only
Result: Uses 16 predefined categories
- Finance
- Health
- Religion & Belief
- Legal
- Toxic
- Insult
- Public Safety
- War & Conflict
- Illicit Drugs
- Profanity
- Politics
- Derogatory
- Violent
- Sexual
- Death, Harm & Tragedy
- Firearms & Weapons
"standard" + Custom Words
Result: Uses all 16 standard categories PLUS your custom words
- All 16 standard categories
- + betting
- + gambling
- + crypto
Note: Maximum 50 total categories allowed
Complete API Parameters
Parameter | Type | Required | Possible Values | Description |
---|---|---|---|---|
content | string | Required | Any text or URL | The text content to be analyzed for moderation. |
content_type | string | Required | text, text_custom_instruction | Type of content to analyze. Supports text analysis and custom instruction moderation. |
moderate | string | Required | "standard" or comma-separated custom words | Moderation categories. Use "standard" for 16 predefined categories, or specify custom words (max 50 total). |
custom_instruction | string | Conditional | Any instruction text | Required when content_type is "text_custom_instruction". Your custom moderation instructions. |
threshold | float | Optional | 0.0 to 1.0 | Confidence threshold for flagging content. Defaults to 0.7. |
api_key | string | Required | Your API key | Your unique enterprise API key for authentication. |
Enterprise SDKs & Code Examples
Production-ready code examples for seamless integration into your content platforms. All examples include error handling, retry logic, and security best practices.
Comprehensive Enterprise Example
The following example demonstrates our API analyzing potentially harmful content across multiple dimensions:
Text Moderation Request
Python Integration
import urllib.parse
import json
import logging
# Configure enterprise logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def moderate_content(content, content_type, moderation_types, api_key, threshold=0.7):
"""
Enterprise-grade content moderation with error handling and logging
"""
try:
conn = http.client.HTTPSConnection("www.contentmoderationapi.com")
payload = urllib.parse.urlencode({
'content': content,
'content_type': content_type,
'moderate': ','.join(moderation_types),
'threshold': threshold,
'api_key': api_key
})
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Enterprise-Content-Moderation/1.0'
}
conn.request("POST", "/api/predict", payload, headers)
response = conn.getresponse()
data = response.read().decode("utf-8")
if response.status == 200:
result = json.loads(data)
logger.info(f"Content moderated - Status: {result.get('status', 'Unknown')}")
return result
else:
logger.error(f"API request failed with status {response.status}")
return None
except Exception as e:
logger.error(f"Content moderation failed: {str(e)}")
return None
finally:
conn.close()
# Enterprise usage example
user_message = "Visit the best betting site for amazing odds and win big money now!"
moderation_types = ['standard', 'betting'] # Standard categories + betting
result = moderate_content(user_message, 'text', moderation_types, 'your_api_key')
if result:
if result.get('status') == 200:
print("✅ Content analyzed successfully")
print("Moderation Confidence Scores:", result.get('moderation', 'N/A'))
print("Specific phrases found matching your categories:", result.get('moderation_words', []))
print("Each matched phrase is represented in array as element [phrase, moderation type, start index of phrase in text, end index of phrase]")
else:
print("⚠️ Content analysis failed")
print("Error:", result.get('error', 'Unknown error'))
else:
print("❌ Failed to connect to API")
Complete Response Examples
Successful Analysis Response
Custom Instruction Response
When using content_type: "text_custom_instruction"
:
Error Response Examples
Missing Required Parameter:
Invalid Content Type:
Enterprise Error Handling
All API responses include a status field. Status code 200 indicates successful processing. Our enterprise SLA guarantees comprehensive error reporting and rapid resolution.
HTTP Status Codes
Status Code | Description | Resolution |
---|---|---|
200 | Success: Content successfully analyzed. | ✅ Process the moderation results as needed. |
400 | Bad Request: Invalid content or parameters. | 🔧 Verify content format and required parameters. |
401 | Unauthorized: Invalid or missing API key. | 🔑 Check API key validity and permissions. |
403 | Quota Exceeded: Monthly request limit reached. | 💳 Upgrade plan or purchase additional credits. |
410 | Content Load Error: URL could not be loaded or text too short. | 📝 Verify URL accessibility or provide longer text. |
411 | Access Denied: Content blocked by security measures. | 🔒 Content may be behind authentication or firewall. |
429 | Rate Limited: Too many requests per minute. | ⏱️ Implement request throttling or increase rate limits. |
500 | Server Error: Internal processing error. | 🆘 Contact enterprise support for immediate assistance. |
24/7 Enterprise Support
Dedicated support team available around the clock for enterprise customers. Average response time: < 15 minutes for critical issues.
Contact SupportStatus & Monitoring
Real-time API status dashboard with performance metrics, uptime monitoring, and proactive incident notifications.
View Status