---
title: "Get analytics"
method: GET
path: "/get-analysis/{chatbotId}"
tags: ["Chatbot Analytics"]
---

# Get analytics

`GET /get-analysis/{chatbotId}`

## Request

- Base URL: `https://api.chat-data.com/api/v2`
- URL: `https://api.chat-data.com/api/v2/get-analysis/{chatbotId}`
- Auth: HTTP bearer

Get the aggregated statistics of a chatbot.

## Path parameters

- `chatbotId` string, required

## Query parameters

- `startTimestamp` number: Start of the time range (inclusive), in milliseconds since the Unix epoch. Statistics are stored per UTC day, each dated at 00:00 UTC.
- `endTimestamp` number: End of the time range (inclusive), in milliseconds since the Unix epoch.
- `source` string[]: Filter analytics by source. Repeat the parameter to match several sources.

## Response `200`

Successful response.

- AnalysisRes
  - `status` 'success', required
  - `countryDistribution` object[], required: Messages per user country, most messages first.
    - `country` string: The 2-letter ISO country code from the IP address lookup (`Unknown` when it could not be resolved).
    - `count` number: The number of messages for users from this country within the specified date range.
  - `hourDistribution` object[], required: Messages per UTC hour and source, ordered by hour.
    - `hour` string: The UTC hour when the messages occurred.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source of the messages.
    - `count` number: The number of messages during this UTC hour within the specified date range.
  - `creditsDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where message credits were consumed.
    - `count` number: The number of message credits consumed on the specified date.
  - `messagesDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the messages were sent.
    - `count` number: The number of messages sent on the specified date.
  - `liveChatEmailsDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the live chat emails were sent.
    - `count` number: The number of live chat emails sent on the specified date.
  - `liveChatSmsDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the live chat SMS messages were sent.
    - `count` number: The number of live chat SMS messages sent on the specified date.
  - `liveChatEscalationsDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the live chat escalations happened.
    - `count` number: The number of live chat escalations on the specified date.
  - `upVotesDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the upvotes occurred.
    - `count` number: The number of upvotes on the specified date.
  - `downVotesDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the downvotes occurred.
    - `count` number: The number of downvotes on the specified date.
  - `conversationsDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the conversations started.
    - `count` number: The number of conversations started on the specified date.
  - `leadsCountDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the leads were collected.
    - `count` number: The number of leads collected on the specified date.
  - `workflowEmailsDistribution` object[], required: One entry per day and source, oldest first.
    - `date` number: The day, as a timestamp in milliseconds since the Unix epoch.
    - `source` 'widget' | 'iframe' | 'site' | 'api' | 'Whatsapp' | 'WhatsappWebAPI' | 'Messenger' | 'Instagram' | 'Telegram' | 'Line' | 'Slack' | 'Discord' | 'Workflow Studio' | 'cron-trigger' | 'youtube-transcription' | 'image-description-test' | 'metering': The source where the workflow emails were sent.
    - `count` number: The number of workflow emails sent on the specified date.
  - `topicsDistribution` object[], required: Totals per topic, highest count first.
    - `topic` string: The topic name.
    - `count` number: The number of user messages classified with this topic.
  - `sentimentsDistribution` object[], required: Totals per sentiment, highest count first.
    - `sentiment` string: The sentiment value (for example positive, negative or neutral).
    - `count` number: The number of user messages classified with this sentiment.
  - `ratingDistribution` object[], required: Totals per rating, highest count first.
    - `rating` string: The rating value (1-5).
    - `count` number: The number of conversations with this rating.

## Other responses

- `400`: An unexpected error occurred while processing the request; `message` contains the error.
- `401`: Authentication failed: the `Authorization` header is missing or not in the `Bearer <key>` format, the API key does not exist, its workspace is unavailable or has no owner, or the workspace's plan does not include API access. `message` says which.
- `403`: The API key cannot access the requested chatbot. A chatbot-scoped key used with another chatbot's ID gets `Access denied to this chatbot`. A workspace key gets `Chatbot <id> was not found in this API key's workspace. It may have been deleted or moved to another workspace.` when the chatbot does not exist or belongs to another workspace.
- `429`: The workspace sent more than 600 API requests in the last minute. Wait the number of seconds given in the `Retry-After` header (and in `message`) before retrying.

---

[API](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide.md) · [All operations](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide/llms.txt) · [OpenAPI document](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide/revisions/72871007f7f0?raw)
