> For the complete documentation index, see [llms.txt](https://docs.mylinkconnect.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mylinkconnect.com/connect-api/globa-platform-api/statistics/runtime-data-2.md).

# Bot Statistics Data

This endpoint can be used to retrieve statistics data for a specific chatbot. The data you can retrieve with this API endpoint is identical to the data available in live [dashboards](/analytics/dashboards.md).

### Request

The following request will retrieve statistics data:

```bash
curl --location --request GET 
'https://publicapi.xenioo.com/analytics/statistics/<TYPES>/<GROUPMODE>/<DAYS>' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
--header 'Content-Type: application/json'
```

### Parameters

The following parameters are expected on the endpoint:

| Parameter | Description                                                                                                   |
| --------- | ------------------------------------------------------------------------------------------------------------- |
| TYPES     | A comma separated list of all the possible types of analytic endpoints available. See belo table and example. |
| GROUPMODE | The time group mode for the returned values. Sett below table for possible values                             |
| DAYS      | The amount of history days to return. Acceptable values go from 1 to 30 days of history.                      |

Supported types are as follows:

| Type                                   | Code |
| -------------------------------------- | ---- |
| New User                               | 0    |
| Returning User                         | 1    |
| Active User                            | 2    |
| Messages                               | 3    |
| Action Messages                        | 4    |
| Fallback Reply                         | 5    |
| NLP Detected                           | 6    |
| NLP Missed                             | 7    |
| Conversation Length                    | 8    |
| Time To Pick Up                        | 9    |
| Takeover Rate                          | 10   |
| Support Conversation Length            | 11   |
| Goal Reached                           | 12   |
| Incoming Message                       | 13   |
| API Request                            | 14   |
| API Request Error                      | 15   |
| Time To First Message                  | 16   |
| Operator Message                       | 17   |
| Tag Hit                                | 18   |
| User Logged In                         | 19   |
| User Logged Out                        | 20   |
| User Afk                               | 21   |
| AI Prompt Hit                          | 22   |
| AI Completion Tokens                   | 23   |
| AI Prompt Tokens                       | 24   |
| AI Total Tokens                        | 25   |
| Action Messages - External API         | 26   |
| Action Messages - External API Slow    | 27   |
| Action Messages - External API Timeout | 28   |
| Action Messages - Database             | 29   |
| Action Messages - Script               | 30   |
| Action Messages - Script Legacy Engine | 31   |
| Action Messages - Script Timeout       | 32   |
| Action Messages - Email                | 33   |
| Action Messages - SMS                  | 34   |
| Action Messages - Speech Recognition   | 35   |
| Action Messages - NLP                  | 36   |
| Action Messages - Integrations         | 37   |
| Action Messages - RSS Feed             | 38   |
| Action Messages - Bot Redirection      | 39   |
| Action Messages - Message Relay        | 40   |
| Action Messages - Public API           | 41   |
| Action Messages - MCP                  | 42   |
| Action Messages - Broadcast            | 43   |
| Action Messages - AI Training          | 44   |
| Action Messages - Uncategorized        | 45   |

Time grouping modes can be instead one of the following:

| Value | Description             |
| ----- | ----------------------- |
| hour  | Group entries by hours  |
| day   | Group entries by days   |
| month | Group entries by months |
| year  | Group entries by years  |

### Response

If successful, the response will contain a detailed array of statistical data.

```javascript
[
   {
      "GroupLabel":"...",
      "BotName":"...",
      "ChannelName":"...",
      "EventLabel":"...",      
      "EventData":"...",
      "IsPreviousPeriod":false,
      "GoalId":"...",
      "GoalName":"...",
      "ReferenceValue":0,
   } 
]
```

### Response Codes

This endpoint will reply with the following standard HTTP codes.

| Code | Meaning                                                      |
| ---- | ------------------------------------------------------------ |
| 200  | Ok. The request has been successfully fulfilled.             |
| 404  | Not Found. The specified  account or bot has not been found. |
