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": "love",
        "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": "satisfaction",
                    "sentiment": "positive",
                    "score": 0.8
              }
        ]
  },
  "_usage": {
        "input_tokens": 20,
        "output_tokens": 75,
        "inference_time_tokens": 2390,
        "total_tokens": 2485
  }
}

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.

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": "love",
        "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": "satisfaction",
                    "sentiment": "positive",
                    "score": 0.8
              }
        ]
  },
  "_usage": {
        "input_tokens": 20,
        "output_tokens": 75,
        "inference_time_tokens": 2390,
        "total_tokens": 2485
  }
}