# Statistics

## Generates a channel-specific report

> \
> \
> \*\*Required Permission:\*\* \`chatbots.statistics.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Statistics","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/statistics/reports/channel":{"get":{"operationId":"StatisticsController_getChannelReport[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot","schema":{"type":"string"}},{"name":"channelId","required":true,"in":"query","description":"The Id of the channel for which to retrieve statistics for.","schema":{"type":"string"}},{"name":"from","required":true,"in":"query","description":"The start date of the statistics timeframe (ISO format).","schema":{"type":"string"}},{"name":"to","required":true,"in":"query","description":"The end date of the statistics timeframe (ISO format).","schema":{"type":"string"}},{"name":"interval","required":true,"in":"query","description":"Sets the interval per day or hour in seconds (86400 for multiple days reports and 3600 for single day reports)","schema":{"enum":[86400,3600],"type":"number"}},{"name":"components","required":true,"in":"query","description":"Comma-separated list of component IDs.\n\n- `0`: STEP_EXEC_COUNT_FOR_CHANNEL_ID\n- `1`: CONVERSATION_COUNT_FOR_CHANNEL_ID\n- `2`: CONVERSATION_COUNT_INTERVAL_FOR_CHANNEL_ID\n- `3`: CONVERSATION_COUNT_PERIODIC_TREND_FOR_CHANNEL_ID\n- `4`: CONVERSATION_LANGUAGES_FOR_CHANNEL_ID\n- `5`: CONVERSATION_MESSAGE_COUNT_MEDIAN_FOR_CHANNEL_ID\n- `6`: INTENT_COUNT_FOR_CHANNEL_ID\n- `7`: INTENT_HITS_FOR_CHANNEL_ID\n- `8`: INTENT_SCORE_MEDIAN_FOR_CHANNEL_ID\n- `9`: INTERACTION_COUNT_FOR_CHANNEL_ID\n- `10`: INTERACTION_COUNT_INTERVAL_FOR_CHANNEL_ID\n- `11`: INTERACTION_COUNT_PERIODIC_TREND_FOR_CHANNEL_ID\n- `12`: MESSAGE_COUNT_FOR_CHANNEL_ID\n- `13`: MESSAGE_COUNT_INTERVAL_FOR_CHANNEL_ID\n- `14`: MESSAGE_COUNT_PERIODIC_TREND_FOR_CHANNEL_ID\n- `15`: MESSAGE_LENGTH_MEDIAN_FOR_CHANNEL_ID\n- `16`: CALL_DURATION_TOTAL\n- `17`: CALL_DURATION_PERIODIC_TREND\n- `18`: CALL_DURATION_MEDIAN\n- `19`: CALL_EXIT_STEP\n- `20`: CALL_USER_INPUTS_MEDIAN\n- `21`: CALL_END_REASON\n- `22`: CALL_TRANSFER_TARGET","schema":{"type":"string"}}],"responses":{"200":{"description":"The report structure depends on the requested components.","content":{"application/json":{"schema":{"type":"object"}}}}},"summary":"Generates a channel-specific report","tags":["Statistics"],"description":"\n\n**Required Permission:** `chatbots.statistics.get`\n\n**Resource:** `chatbots/:chatbotId`"}}}}
```

## Generates an overview report

> \
> \
> \*\*Required Permission:\*\* \`chatbots.statistics.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Statistics","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/statistics/reports/overview":{"get":{"operationId":"StatisticsController_getOverviewReport[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot","schema":{"type":"string"}},{"name":"from","required":true,"in":"query","description":"The start date of the statistics timeframe (ISO format).","schema":{"type":"string"}},{"name":"to","required":true,"in":"query","description":"The end date of the statistics timeframe (ISO format).","schema":{"type":"string"}},{"name":"interval","required":true,"in":"query","description":"Sets the interval per day or hour in seconds (86400 for multiple days reports and 3600 for single day reports)","schema":{"enum":[86400,3600],"type":"number"}},{"name":"components","required":true,"in":"query","description":"Comma-separated list of component IDs.\n\n- `0`: STEP_EXEC_COUNT\n- `1`: CONVERSATION_COUNT\n- `2`: CONVERSATION_COUNT_INTERVAL\n- `3`: CONVERSATION_LANGUAGES\n- `4`: CONVERSATION_BY_CHANNEL_TYPE\n- `5`: CONVERSATION_COUNT_PERIODIC_TREND\n- `6`: CONVERSATION_MESSAGE_COUNT_MEDIAN\n- `7`: MESSAGE_COUNT\n- `8`: MESSAGE_COUNT_INTERVAL\n- `9`: MESSAGE_COUNT_PERIODIC_TREND\n- `10`: MESSAGE_LENGTH_MEDIAN\n- `11`: INTENT_HITS\n- `12`: INTENT_SCORE_MEDIAN\n- `13`: INTENT_COUNT\n- `14`: INTERACTION_COUNT\n- `15`: INTERACTION_COUNT_INTERVAL\n- `16`: INTERACTION_COUNT_PERIODIC_TREND","schema":{"type":"string"}}],"responses":{"200":{"description":"The report structure depends on the requested components.","content":{"application/json":{"schema":{"type":"object"}}}}},"summary":"Generates an overview report","tags":["Statistics"],"description":"\n\n**Required Permission:** `chatbots.statistics.get`\n\n**Resource:** `chatbots/:chatbotId`"}}}}
```

## Creates an export of statistics

> \
> \
> \*\*Required Permission:\*\* \`chatbots.statistics.export\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Statistics","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{},{}],"paths":{"/v1/chatbots/{chatbotId}/statistics/export":{"post":{"operationId":"StatisticsController_exportStats[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot","schema":{"type":"string"}},{"name":"from","required":true,"in":"query","description":"The start date of the statistics timeframe (ISO format).","schema":{"type":"string"}},{"name":"to","required":true,"in":"query","description":"The end date of the statistics timeframe (ISO format).","schema":{"type":"string"}}],"responses":{"202":{"description":"Export job has been started.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsExportResponseDto"}}}}},"summary":"Creates an export of statistics","tags":["Statistics"],"description":"\n\n**Required Permission:** `chatbots.statistics.export`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"StatsExportResponseDto":{"type":"object","properties":{"exportId":{"type":"string","description":"The ID of the started export job."},"error":{"type":"string","description":"Optional error message."}},"required":["exportId"]}}}}
```

## Retrieves the status of a statistics export

> \
> \
> \*\*Required Permission:\*\* \`chatbots.statistics.export\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Statistics","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/statistics/export/{exportId}":{"get":{"operationId":"StatisticsController_getStatsExportStatus[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot","schema":{"type":"string"}},{"name":"exportId","required":true,"in":"path","description":"The Id of the export job.","schema":{"type":"string"}}],"responses":{"200":{"description":"The current status of the export job.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetStatsExportStatusResponseDto"}}}}},"summary":"Retrieves the status of a statistics export","tags":["Statistics"],"description":"\n\n**Required Permission:** `chatbots.statistics.export`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"GetStatsExportStatusResponseDto":{"type":"object","properties":{"status":{"type":"string","description":"The status of the export."},"downloadUrl":{"type":"string","description":"URL to download the file when the export is completed."},"error":{"type":"string","description":"Optional error message."}},"required":["status"]}}}}
```

## Retrieves statistics of the inbox section of a chatbot.

> \
> \
> \*\*Required Permission:\*\* \`chatbots.statistics.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Statistics","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/statistics/inbox":{"get":{"operationId":"StatisticsController_getInboxStatistics[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot","schema":{"type":"string"}},{"name":"from","required":true,"in":"query","description":"The start date of the statistics timeframe (ISO format).","schema":{"type":"string"}},{"name":"to","required":true,"in":"query","description":"The end date of the statistics timeframe (ISO format).","schema":{"type":"string"}}],"responses":{"200":{"description":"The inbox statistics data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInboxReportResponseDto"}}}}},"summary":"Retrieves statistics of the inbox section of a chatbot.","tags":["Statistics"],"description":"\n\n**Required Permission:** `chatbots.statistics.get`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"GetInboxReportResponseDto":{"type":"object","properties":{"data":{"description":"The inbox report data.","nullable":true,"allOf":[{"$ref":"#/components/schemas/InboxReportDataDto"}]},"error":{"type":"string","description":"Optional error message."}},"required":["data"]},"InboxReportDataDto":{"type":"object","properties":{"transferredToAgentCount":{"type":"number","description":"The number of conversations transferred to an agent."},"conversationAcceptedCount":{"type":"number","description":"The number of conversations accepted by agents."},"conversationNotAcceptedCount":{"type":"number","description":"The number of conversations not accepted by agents."},"averageJoinTimeSeconds":{"type":"number","description":"The average time in seconds for agents to join conversations."},"agentPerformance":{"description":"The list of agent performance entries.","type":"array","items":{"$ref":"#/components/schemas/AgentPerformanceEntryDto"}}},"required":["transferredToAgentCount","conversationAcceptedCount","conversationNotAcceptedCount","averageJoinTimeSeconds","agentPerformance"]},"AgentPerformanceEntryDto":{"type":"object","properties":{"operatorId":{"type":"string","description":"The unique identifier of the operator."},"acceptedCount":{"type":"number","description":"The number of conversations accepted by the agent."},"avgJoinTimeSeconds":{"type":"number","description":"The average time in seconds for the agent to join a conversation."},"operatorName":{"type":"string","description":"The name of the operator."}},"required":["operatorId","acceptedCount","avgJoinTimeSeconds","operatorName"]}}}}
```

## Retrieves all channels associated with a chatbot

> \
> \
> \*\*Required Permission:\*\* \`chatbots.statistics.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Statistics","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/statistics/channels":{"get":{"operationId":"StatisticsController_getChannels[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot","schema":{"type":"string"}}],"responses":{"200":{"description":"The list of channels for the chatbot.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsGetChannelsResponseDto"}}}},"500":{"description":"Internal server error, e.g. if the channel service is unavailable."}},"summary":"Retrieves all channels associated with a chatbot","tags":["Statistics"],"description":"\n\n**Required Permission:** `chatbots.statistics.get`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"StatsGetChannelsResponseDto":{"type":"object","properties":{"channels":{"description":"The list of channels associated with the chatbot.","type":"array","items":{"$ref":"#/components/schemas/StatsChatbotChannelDto"}}},"required":["channels"]},"StatsChatbotChannelDto":{"type":"object","properties":{"channelId":{"type":"string","description":"The unique id of the channel."},"channelName":{"type":"string","description":"The display name of the channel."},"channelType":{"type":"string","description":"The type of the channel."}},"required":["channelId","channelName","channelType"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatcaptain.com/api/api-dokumentation/statistics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
