Text Analysis
Analyze text content for spam, toxicity, profanity, threats, insults, and language detection. Our AI models provide accurate classification with confidence scores.
Detect toxic content, profanity, threats, and insults with confidence scores.
Identify spam, phishing attempts, and promotional content.
Automatically detect the language of input text with high accuracy.
Get clear true/false flags for quick decision making.
Endpoint
POST https://api.discuse.com/api/v2/checkRequest Format
Send your text content in the request body. The text field is required.
{
"content": {
"text": "Your text content to analyze goes here"
}
}Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
content.text | string | Yes | The text content to analyze (max 10,000 characters) |
Response Format
The API returns detailed analysis results including sentiment scores, spam detection, and language.
{
"has_violations": false,
"cached": false,
"message": "Content appears safe",
"results": {
"hits": false,
"sentiment": {
"hit": false,
"toxic": 0.02,
"profanity": 0.01,
"threat": 0.00,
"insult": 0.03
},
"spamfinder": {
"is_spam": false,
"confidence": 0.05
},
"language": {
"detected": "en",
"confidence": 0.98
}
},
"processing_time_ms": 45,
"usage": {
"api_requests_used": 150,
"api_requests_limit": 10000,
"api_requests_remaining": 9850
}
}Response Fields
Top-Level Fields
| Field | Type | Description |
|---|---|---|
has_violations | boolean | True if any violations were detected |
cached | boolean | True if result was served from cache |
message | string | Human-readable summary of the analysis |
processing_time_ms | number | Processing time in milliseconds |
Sentiment Analysis Fields
All sentiment scores are values between 0.0 and 1.0, where higher values indicate stronger presence of that sentiment.
| Field | Type | Description |
|---|---|---|
hit | boolean | True if any sentiment threshold was exceeded |
toxic | number | Toxicity score (0.0 - 1.0) |
profanity | number | Profanity score (0.0 - 1.0) |
threat | number | Threat score (0.0 - 1.0) |
insult | number | Insult score (0.0 - 1.0) |
Spam Detection Fields
| Field | Type | Description |
|---|---|---|
is_spam | boolean | True if content is classified as spam |
confidence | number | Classification confidence (0.0 - 1.0) |
Language Detection Fields
| Field | Type | Description |
|---|---|---|
detected | string | ISO 639-1 language code (e.g., "en", "es", "fr") |
confidence | number | Detection confidence (0.0 - 1.0) |
Example Responses
Toxic Content Detected
{
"has_violations": true,
"cached": false,
"message": "Potential violations detected",
"results": {
"hits": true,
"sentiment": {
"hit": true,
"toxic": 0.92,
"profanity": 0.15,
"threat": 0.78,
"insult": 0.85
},
"spamfinder": {
"is_spam": false,
"confidence": 0.12
},
"language": {
"detected": "en",
"confidence": 0.99
}
},
"processing_time_ms": 52,
"usage": {
"api_requests_used": 151,
"api_requests_limit": 10000,
"api_requests_remaining": 9849
}
}Spam Content Detected
{
"has_violations": true,
"cached": false,
"message": "Spam detected",
"results": {
"hits": true,
"sentiment": {
"hit": false,
"toxic": 0.05,
"profanity": 0.02,
"threat": 0.01,
"insult": 0.03
},
"spamfinder": {
"is_spam": true,
"confidence": 0.94
},
"language": {
"detected": "en",
"confidence": 0.97
}
},
"processing_time_ms": 38,
"usage": {
"api_requests_used": 152,
"api_requests_limit": 10000,
"api_requests_remaining": 9848
}
}Best Practices
- 1
Use appropriate thresholds
Sentiment scores are between 0.0 and 1.0. A threshold of 0.7 is typically recommended for high confidence detection.
- 2
Handle edge cases
Very short text may have lower confidence scores. Consider requiring minimum text length for reliable analysis.
- 3
Leverage caching
The API caches results for identical content. Cached responses do not count against your usage quota - you only pay for actual checks. The
cachedfield indicates if a cached result was returned. - 4
Monitor usage
Check the
usagefield to monitor your API quota and avoid unexpected rate limits.