Skip to main content

Text Analysis

Analyze text content for spam, toxicity, profanity, threats, insults, and language detection. Our AI models provide accurate classification with confidence scores.

Sentiment Analysis

Detect toxic content, profanity, threats, and insults with confidence scores.

Spam Detection

Identify spam, phishing attempts, and promotional content.

Language Detection

Automatically detect the language of input text with high accuracy.

Content Flags

Get clear true/false flags for quick decision making.

Endpoint

POST https://api.discuse.com/api/v2/check

Request 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

ParameterTypeRequiredDescription
content.textstringYes 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

FieldTypeDescription
has_violationsboolean True if any violations were detected
cachedboolean True if result was served from cache
messagestring Human-readable summary of the analysis
processing_time_msnumber 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.

FieldTypeDescription
hitboolean True if any sentiment threshold was exceeded
toxicnumber Toxicity score (0.0 - 1.0)
profanitynumber Profanity score (0.0 - 1.0)
threatnumber Threat score (0.0 - 1.0)
insultnumber Insult score (0.0 - 1.0)

Spam Detection Fields

FieldTypeDescription
is_spamboolean True if content is classified as spam
confidencenumber Classification confidence (0.0 - 1.0)

Language Detection Fields

FieldTypeDescription
detectedstring ISO 639-1 language code (e.g., "en", "es", "fr")
confidencenumber 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 cached field indicates if a cached result was returned.

  • 4

    Monitor usage

    Check the usage field to monitor your API quota and avoid unexpected rate limits.

Try Text Analysis

Test text analysis with our interactive demo. No API key required.

Open Demo