πSentiment Analysis
The analyze-sentiment
endpoint returns the emotional polarity of a given text input.
It classifies the text as positive
, neutral
, or negative
and provides a confidence score.
π POST /analyze-sentiment
Base URL: https://api.cognitia.ai/v1/analyze-sentiment
π Authentication
All requests must include your API token in the Authorization
header:
Authorization: Bearer YOUR_API_TOKEN
π₯ Request
Headers
Authorization
string
β yes
Bearer token
Content-Type
string
β yes
application/json
Body
{
"text": "This is a wonderful product!"
}
text
string
β yes
The text to analyze (max 1000 characters)
π€ Response
Success β 200 OK
{
"sentiment": "positive",
"score": 0.92
}
sentiment
string
positive
, neutral
, or negative
score
float
Confidence score between 0 and 1
β Error Responses
400
Missing required field: text
The text
field is missing
Provide a non-empty text
string in the request body
401
Invalid or missing API token
Missing or wrong Authorization
header
Check your token and header format
413
Payload too large
Text exceeds 1000 characters
Shorten your input
500
Internal server error
Something went wrong server-side
Try again later or contact support
π§ͺ Example (curl)
curl -X POST https://api.cognitia.ai/v1/analyze-sentiment \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"text": "The design is elegant, but the app is too slow."}'
π Response
{
"sentiment": "neutral",
"score": 0.61
}
π§ Use Cases
Content moderation (filter negative reviews)
Social media monitoring
Product feedback analysis
Customer support triage
π Limitations
Input is limited to 1000 characters
Only supports English and French (beta)
Looking for bias detection or summarization? Check out our other endpoints:
Last updated