POST
/
v1
/
ai
/
sentiment
import { JigsawStack } from "jigsawstack";

const jigsaw = JigsawStack({ apiKey: "your-api-key" });

const response = await jigsaw.sentiment({
  "text": "I love this product! It's amazing but the delivery was a bit late."
})
{
  "success": true,
  "sentiment": {
        "emotion": "happiness",
        "sentiment": "positive",
        "score": 0.85,
        "sentences": [
              {
                    "text": "I love this product!",
                    "emotion": "love",
                    "sentiment": "positive",
                    "score": 0.9
              },
              {
                    "text": "It's amazing but the delivery was a bit late.",
                    "emotion": "neutral",
                    "sentiment": "positive",
                    "score": 0.7
              }
        ]
  }
}

Request Parameters

Body

text
string
required

The text content to analyze for sentiment and emotion.

x-api-key
string
required

Your JigsawStack API key

Response Structure

success
boolean

Indicates whether the call was successful.

sentiment
object

Contains the sentiment analysis results.

emotion
string

The overall emotional tone of the text. Supported emotions include: anger fear sadness happiness anxiety disgust embarrassment love surprise shame envy satisfaction self-confidence annoyance boredom hatred compassion guilt loneliness depression pride neutral

sentiment
string

The overall sentiment classification, typically “positive”, “negative”, or “neutral”.

score
number

Numerical score representing the sentiment intensity, typically on a scale from 0 to 1, where higher values indicate more positive sentiment.

sentences
array

Detailed sentiment analysis broken down by individual sentences.

import { JigsawStack } from "jigsawstack";

const jigsaw = JigsawStack({ apiKey: "your-api-key" });

const response = await jigsaw.sentiment({
  "text": "I love this product! It's amazing but the delivery was a bit late."
})
{
  "success": true,
  "sentiment": {
        "emotion": "happiness",
        "sentiment": "positive",
        "score": 0.85,
        "sentences": [
              {
                    "text": "I love this product!",
                    "emotion": "love",
                    "sentiment": "positive",
                    "score": 0.9
              },
              {
                    "text": "It's amazing but the delivery was a bit late.",
                    "emotion": "neutral",
                    "sentiment": "positive",
                    "score": 0.7
              }
        ]
  }
}