---
title: "Sentiment"
method: GET
path: "/topics/{topicId}/statistics/sentiments"
tags: ["Statistics"]
---

# Sentiment

`GET /topics/{topicId}/statistics/sentiments`

## Request

- Base URL: `https://api.youscan.io/api/external`
- URL: `https://api.youscan.io/api/external/topics/{topicId}/statistics/sentiments`
- Auth: one of:
  - API key in header `X-API-KEY`
  - API key in query parameter `apiKey`
- TypeScript: <https://skmtc.dev/youscan/apis/youscan-api/docs/topics/:topicId/statistics/sentiments/get.ts> (a function with typed inputs; its response is checked against the schema)

Distribution of mentions by sentiment.

## Path parameters

- `topicId` integer, required

## Query parameters

- `from` string, date
- `to` string, date
- `country` string[]
- `excludeCountry` string[]
- `sourceTypes` SourceTypeFilter[]
- `excludeSourceTypes` SourceTypeFilter[]
- `sources` string[]
- `excludeSources` string[]
- `tags` integer[]
- `excludeTag` integer[]
- `subcategories` integer[]
- `excludeSubcategory` integer[]

## Response `200`

Sentiment distribution.

- object
  - `sentiments` NameCount[]
    - `name` string: Name of the bucket.
    - `count` integer: Number of mentions in the bucket.
  - `totalCount` integer

## Other responses

- `401`: The API key is missing or invalid.

---

[API](https://skmtc.dev/youscan/apis/youscan-api.md) - [All operations](https://skmtc.dev/youscan/apis/youscan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/youscan/apis/youscan-api/revisions/f5bef260f153?raw)
