Sentiment Analysis API

Sentiment Analysis API

Perform sentiment analysis on a sentence, paragraph or a single word

Overview

The Sentiment Analysis API is a powerful tool for conducting comprehensive sentiment analysis on textual data. Designed to meet the needs of developers, businesses, and researchers, this API leverages state-of-the-art natural language processing techniques to provide accurate and nuanced insights into the sentiment expressed within text.

Features

  • Sentiment Classification: The API for sentiment analysis can classify text into one of three categories: positive, negative, or neutral sentiment. This classification allows for a quick understanding of the emotional tone of the text.
  • Multi-Language Support: The API supports multiple languages, ensuring it can be utilized in a global context to analyze sentiment in text from various regions (currently supporting English, Spanish and Portuguese).
  • Real-Time Analysis: With low latency, sentiment API can provide real-time sentiment analysis, making it suitable for live chat, social media monitoring, and other time-sensitive applications.

Getting Started

To access the Sentiment Analysis API , you need to obtain an API key from AnyAPI.io. The API key is used for authentication and should be included in the request URL as a query parameter.

Let’s Try Sign In.

Sentiment Analysis endpoint

Send a GET request to the following URL to Sentiment Analysis

curl --request GET \
  --url 'https://anyapi.io/api/v1/sentiment?input=I%20am%20feeling%20great%20today&language=English&apiKey=YOUR_API_KEY'
{
  "sentiment": "positive",
  "score": 0.8,
  "language": "English",
  "tokens": [
    "I",
    "am",
    "feeling",
    "great",
    "today"
  ]
}

Request parameters

Use the parameters listed below to customize your request. Mandatory parameters are indicated

inputstringRequired
Input string to analyze
languagestringOptional
Language of the given input (e.g. English, Spanish or Portuguese)
apiKeystringRequired
Your unique API key, which is required to authenticate your requests.

Response parameters

The API returns its response in a simple, lightweight JSON format.

sentimentstring
The classified sentiment of the input text (positive, negative, or neutral)
scorenumber
A decimal number between 0 and 1 indicating the strength of the sentiment
languagestring
The detected language of the input text
tokensobject
The individual tokens (words) extracted from the input text

Response and error codes

Whenever you make a request that fails for some reason, an error is returned also in the JSON format. The errors include an error code and description, which you can find in detail below.

Status CodeTypeDetails
200OKThe request was successful.
400Bad RequestThe request was invalid or cannot be otherwise served.
401UnauthorizedAuthentication credentials were missing or incorrect.
422Quota reachedThe request cannot be served due to the application's rate limit having been exhausted for the resource.
404Not FoundThe requested resource could not be found.
429Too Many RequestsThe request cannot be served due to the application's rate limit having been exhausted for the resource.
500Internal Server ErrorSomething went wrong on the server.
503Service UnavailableThe service is temporarily unavailable.