apyhub
Back

Basic Sentiment Analysis API

What it does

Basic Sentiment Analysis API tells you whether a piece of text reads as positive, negative, or neutral. Send text as the text query parameter and get back JSON with an overall sentiment for the whole input plus a breakdown for each sentence.

Detect Sentiment takes text and returns a document object with the overall sentiment, its confidence, and the average_confidence across sentences, along with a sentences array where each entry gives that sentence's sentiment, confidence, and its offset and length in the original text.

Basic Sentiment Analysis API is a good fit when you need to triage customer reviews or support tickets, track tone in social posts, or flag negative passages inside longer feedback without training your own model.

GET
Detect Sentiment API
https://api.eu.apyhub.com/skycraft/basic-sentiment-analysis/detect-sentiment

QUICKSTART

GUIDE

Quickstart

Check the sentiment of a piece of text by passing it as a query parameter.

curl -X GET "https://api.eu.apyhub.com/skycraft/basic-sentiment-analysis/detect-sentiment?text=Happy%20times%20feel%20so%20good." \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with optional document and sentences fields. document is an object with sentiment (string or null), confidence (integer), and average_confidence (integer). sentences is an array of objects, each with length (integer), offset (integer), sentiment (string or null), and confidence (integer).

{
  "document": {
    "sentiment": "positive",
    "confidence": 98,
    "average_confidence": 97
  },
  "sentences": [
    {
      "length": 25,
      "offset": 0,
      "sentiment": "positive",
      "confidence": 98
    }
  ]
}
TRY ITLIVE · 20 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Analyzes the sentiment of the text passed in the request and returns sentiment results for the full document plus sentence-level breakdowns.

Query Parameter(s)

AttributeTypeDescription
textStringInput text to analyze. Maximum length: 2,000 characters for Latin-script text (about 800 for other scripts, because the text is sent in the URL).

Response

Returns a JSON object with two top-level fields: document is an object containing overall sentiment analysis, and sentences is an array of sentence-level sentiment objects.

ParameterTypeDescription
documentObjectOverall sentiment analysis for the input text.
document.sentimentStringDocument-level sentiment. Nullable.
document.confidenceIntegerDocument-level confidence score.
document.average_confidenceIntegerAverage confidence score for the document.
sentencesObject ArraySentence-level sentiment analysis results.
sentences[].lengthIntegerSentence length.
sentences[].offsetIntegerSentence offset.
sentences[].sentimentStringSentence sentiment. Nullable.
sentences[].confidenceIntegerSentence confidence score.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.