apyhub
ARTIFICIAL INTELLIGENCE

Analyze Multiple Text Sentiment API

What it does

Sentiment Analysis classifies text as positive or negative and returns a confidence score for each result. Send a single text up to 512 characters in the body.text field, or submit multiple strings with the batch endpoint in body.texts.

Use it when you need to score customer feedback, triage support comments, or filter review streams by tone. The single-text endpoint returns the original text, a label of positive or negative, and a score between 0 and 1. The batch endpoint returns a results array, with each item containing a label and score for the corresponding input text.

Because the output is compact, it fits cleanly into moderation workflows, analytics pipelines, and product dashboards. You can run one-off checks on a message, or process a list of short texts in one request when you need to classify many comments at once.

▣ ENDPOINT 01 / 02
POST
Classify text as positive or negative with a confidence score
http://localhost:8080/dosvak/analyze-sentiment
QUICKSTARTGUIDE

Quickstart

Send a short piece of text to get its sentiment label and confidence score.

curl -X POST "http://localhost:8080/dosvak/analyze-sentiment" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"I really enjoyed the product and the support was excellent."}'

What you'll get back

Returns a JSON object with text as a string, label as either "positive" or "negative", and score as a number between 0 and 1.

{
  "text": "I really enjoyed the product and the support was excellent.",
  "label": "positive",
  "score": 0.98
}
TRY ITLIVE · 10 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.
body*
Input text (truncated to 512 tokens)

About this endpoint

What it does

Classifies an input text as positive or negative and returns the text, the predicted label, and a confidence score.

Request Body

ParameterTypeMandatoryDescription
textStringYesInput text. Maximum length: 512 characters. The schema description says it is truncated to 512 tokens.

Response

Returns a JSON object with text, label, and score fields. text is a string, label is a string enum with positive or negative, and score is a number between 0 and 1.

ParameterTypeMandatoryDescription
textStringNoThe text that was classified.
labelENUMNoThe predicted sentiment label: positive or negative.
scoreNumberNoConfidence score between 0 and 1.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 02 / 02
POST
Classify multiple texts in a single request
http://localhost:8080/dosvak/analyze-sentiment/batch
QUICKSTARTGUIDE

Quickstart

Send a batch of texts to analyze sentiment for each item.

curl -X POST "http://localhost:8080/dosvak/analyze-sentiment/batch" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"texts":["Great product!","Awful service."]}'

What you'll get back

Returns a JSON object with a results array. Each item in results is an object with a label string and a score number for the sentiment prediction.

{
  "results": [
    {
      "label": "positive",
      "score": 0.99
    },
    {
      "label": "negative",
      "score": 0.98
    }
  ]
}
TRY ITLIVE · 10 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.
body*
texts*

About this endpoint

What it does

Classifies multiple input texts in a single request and returns an array of sentiment results. Each result contains a label string and a score number.

Request Body

ParameterTypeMandatoryDescription
textsString ArrayYesThe texts to classify.

Response

Returns a JSON object with a results array field. Each item in results is an object with a label string field and a score number field.

ParameterTypeMandatoryDescription
resultsObject ArrayNoArray of classification results.
results[].labelStringNoPredicted sentiment label.
results[].scoreNumberNoConfidence score for the predicted label.

Body

Name
Type
Description
bodyREQUIRED
object
▣ 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.