POST /api/sentiment

Analyze Sentiment

Detect the emotional tone and sentiment of text (positive, negative, neutral). Optionally get detailed analysis with emotional indicators, confidence scores, and aspect-based sentiment.

$0.02 per request

> REQUEST_PARAMETERS

Parameter Type Required Description
text string Yes Text to analyze (1-10,000 characters)
options.detailed boolean No Include emotional indicators and key phrases
options.aspects array No Specific topics for aspect-based sentiment (e.g., ["price", "quality"])

> EXAMPLE_REQUEST

POST /api/sentiment
Headers:
  Content-Type: application/json
  PAYMENT-SIGNATURE: [x402 payment signature via Faremeter SDK]

{
  "text": "I absolutely love this product! It has exceeded all my expectations and the customer service was outstanding.",
  "options": {
    "detailed": true
  }
}

> EXAMPLE_RESPONSE

{
  "result": {
    "sentiment": "positive",
    "confidence": 0.96,
    "score": 0.88,
    "emotional_indicators": ["love", "exceeded", "outstanding"],
    "key_phrases": ["absolutely love", "exceeded expectations", "customer service"]
  },
  "tokens_used": {
    "prompt_tokens": 89,
    "completion_tokens": 45,
    "total_tokens": 134
  }
}

> RESPONSE_FIELDS

sentiment

Classification: positive, negative, or neutral

confidence

Confidence score from 0.0 to 1.0 (higher = more certain)

score

Sentiment score from -1.0 (very negative) to +1.0 (very positive)

emotional_indicators

Array of emotion words found in the text (detailed mode only)

key_phrases

Phrases contributing to sentiment (detailed mode only)

> ERROR_RESPONSES

400 Bad Request
Validation failed or content blocked
402 Payment Required
Invalid or missing x402 payment headers
451 Unavailable
Generated content filtered

> TRY_IT_OUT

curl https://textmerchant.xyz/api/sentiment/docs/schema