API Documentation

Authentication

All API requests require authentication using your API key in the Authorization header:

Authorization: Bearer sk_your_api_key

Security Notice

Never expose your API key in client-side code or public repositories. Always make API calls from your backend server.

Security Best Practices

  • Keep API keys secure and never expose them in client-side code
  • Implement proper request rate limiting in your application
  • Monitor API usage regularly through the dashboard
  • Rotate API keys periodically for enhanced security

API Endpoints

MethodEndpointDescription
POST/v1/analyze/sentimentAnalyze sentiment of provided texts

Rate Limits

Rate limits are applied on user's account across all API keys. The limits are as follows:

RequestsBurst Rate
500 per Month15 per minute

Rate Limit Headers

Each API response includes headers to help you track your rate limit usage:

  • X-RateLimit-Limit: Total requests allowed per hour
  • X-RateLimit-Remaining: Remaining requests for the current hour

API POST Size Limits

Size limits are applied on a user across all API keys:

Characters count / requestJSON objects count / request
1200 characters10 objects

Request/Response Format

Request Format

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.

Response Format

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
      }
    ]
  }
}

Example Usage

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"
    }
  ]'

Error Codes

StatusCodeDescription
400invalid_requestThe request body is invalid or malformed
401unauthorizedInvalid or missing API key
403forbiddenAPI key does not have permission to access this resource
429rate_limit_exceededToo many requests, please try again later
500internal_errorAn unexpected error occurred on our servers
503service_unavailableService is temporarily unavailable
Sentimapper API

© 2025 SentiMapper. All rights reserved.