All API requests require authentication using your API key in the Authorization header:
Authorization: Bearer sk_your_api_key
Never expose your API key in client-side code or public repositories. Always make API calls from your backend server.
Method | Endpoint | Description |
---|---|---|
POST | /v1/analyze/sentiment | Analyze sentiment of provided texts |
Rate limits are applied on user's account across all API keys. The limits are as follows:
Requests | Burst Rate |
---|---|
500 per Month | 15 per minute |
Each API response includes headers to help you track your rate limit usage:
X-RateLimit-Limit
: Total requests allowed per hourX-RateLimit-Remaining
: Remaining requests for the current hourSize limits are applied on a user across all API keys:
Characters count / request | JSON objects count / request |
---|---|
1200 characters | 10 objects |
Send a POST request with a JSON array of texts to analyze:
[ { "id": 1, "text": "First text to analyze" }, { "id": 2, "text": "Second text to analyze" } ]
The id
field is optional. If omitted, IDs will be automatically assigned based on array index.
The API returns a JSON response with sentiment analysis results:
{ "message": "success", "results": { "response": [ { "id": 1, "sentiment": "positive", "confidence": 0.95 }, { "id": 2, "sentiment": "negative", "confidence": 0.87 } ] } }
curl -X POST https://api.example.com/v1/analyze/sentiment \ -H "Authorization: Bearer sk_your_api_key" \ -H "Content-Type: application/json" \ -d '[ { "id": 1, "text": "The product quality is excellent" }, { "id": 2, "text": "Customer service needs improvement" } ]'
Status | Code | Description |
---|---|---|
400 | invalid_request | The request body is invalid or malformed |
401 | unauthorized | Invalid or missing API key |
403 | forbidden | API key does not have permission to access this resource |
429 | rate_limit_exceeded | Too many requests, please try again later |
500 | internal_error | An unexpected error occurred on our servers |
503 | service_unavailable | Service is temporarily unavailable |