> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developers.deepgram.com/docs/sentiment-analysis/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.deepgram.com/_mcp/server. # Sentiment Analysis Deepgram API Playground Try this feature out in our API Playground. \ `sentiment` *boolean*   Default: `false` Pre-recorded Streaming:Nova English (all available regions) Deepgram's Sentiment Analysis feature recognizes the sentiment of the entire transcript and detects shifts in sentiment throughout the transcript. A `sentiment` of `positive`, `negative`, or `neutral` along with a `sentiment_score` is identified for each segment of the transcript, and an `average` of the entire transcript's sentiment is also provided along with the average `sentiment_score`. This sentiment feature produces sentiment analysis at every level of transcription requested, so you'll get sentiment values for every word, sentence, utterance, and paragraph, in addition to the top-level sentiment for the entire transcription. > **Info** > > The break point for a `sentiment_score` becoming positive or negative is `+-0.333333333...`. ## Enable Feature To enable Sentiment, use the following parameter in the query string when you call Deepgram’s `/listen` endpoint: `sentiment=true` To transcribe audio from a file on your computer, run the following curl command in a terminal or your favorite API client. **`cURL`** ```bash cURL curl \ --request POST \ --header 'Authorization: Token YOUR_DEEPGRAM_API_KEY' \ --header 'Content-Type: audio/wav' \ --data-binary @youraudio.wav \ --url 'https://api.deepgram.com/v1/listen?sentiment=true' ``` > **Warning** > > Replace `YOUR_DEEPGRAM_API_KEY` with your [Deepgram API Key](https://console.deepgram.com/signup?jump=keys). ### Query Parameters | Parameter | Values | Type | Description | | ----------- | ------ | ------- | -------------------------------------------------------------------------- | | `sentiment` | `true` | boolean | Enables sentiment analysis | | `language` | `en` | string | The language of your input audio (Only English is supported at this time.) | ## Analyze Response When the file is finished processing, you’ll receive a JSON response that has the following basic structure: **`JSON`** ```json JSON "metadata": {...}, "results": { "channels": [ { "alternatives": [...] } ], "sentiments": { "segments": [ { "text": "Hi there. I love my current phone, but want a new one.", "start_word": 0, "end_word": 11, "sentiment": "positive", "sentiment_score": 0.4443286657333374 }, { "text": "Can I upgrade my phone?", "start_word": 12, "end_word": 16, "sentiment": "neutral", "sentiment_score": 0.1317894160747528 } ], "average": { "sentiment": "positive", "sentiment_score": 0.35909067500721326 } } } } ``` The `sentiment` values added to objects are: * `sentiment`: The sentiment of the associated text ('positive' | 'negative' | 'neutral'). * `sentiment_score`: A floating point value between -1 and 1 representing the sentiment of the associated span of text. -1 being the most negative sentiment, and 1 being the most positive sentiment. --- ### Response Properties | Property | Description | | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `channels.alternatives.words[i].sentiment` | The sentiment rating and score for the associated word. | | `sentiments.segments` | Spans of text covering your entire transcript that show when the sentiment shifts throughout the transcribed audio. | | `sentiments.segments[i].sentiment` | A rating for the given span of text. Can be either `positive`, `neutral`, or `negative`. | | `sentiments.segments[i].sentiment_score` | A floating point value between -1 and 1 representing the sentiment of the associated span of text, with -1 being the most negative sentiment, and 1 being the most positive sentiment. | | `sentiments.average` | The average sentiment for the entire transcription. | ### API Warning Response #### Warning If you request Sentiment Analysis with an unsupported language by specifying a language code such as `sentiment=true&language=es` or `sentiment=true&detect_language=true` where the detected language is unsupported, you will get the warning message below. **`JSON`** ```json JSON "warnings": [ { "parameter": "sentiment", "type": "unsupported_language", "message": "Sentiment is only supported for English." } ] ``` | Warning Name | Warning Message | | ---------------------- | ---------------------------------------------------------------- | | `unsupported_language` | Feature isn't supported with the specified or detected language. | **Example Warning** Here is an example of the JSON structure of a request with warning object. **`JSON`** ```json JSON { "metadata": { ... }, "warnings": [ { "parameter": "sentiment", "type": "unsupported_language", "message": "Sentiment is only supported for English." } ] }, "results": { "channels": [ { "alternatives": [...] } ], } } ``` > Sentiment Analysis recognizes the sentiment throughout an entire transcript.