> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.bitbybit.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Retrieve CS & ticket performance analytics per company.

The Analytics API returns aggregated CS and ticket performance metrics for the company the API key belongs to. The `company_id` is derived from the key — you do not pass it in the request.

## Common use cases

* **Daily CS reporting** — pull the previous day's tickets, response times, and resolution times per agent.
* **Agent scorecards** — filter by `agentName` to pull a single agent's window.
* **Channel breakdown** — narrow to a single channel via `sources`.

## Multi-company reporting

Each API key is scoped to one company. To build a report that spans multiple companies, iterate through each company's key and call the endpoint once per company. Merge the results on your side.

## Scope

This endpoint requires an API key with **`analytics` → `READ`** scope. Create or update a key from **Settings → Developer** in the bitbybit dashboard.

## Filters

| Parameter   | Required | Notes                                                           |
| ----------- | -------- | --------------------------------------------------------------- |
| `startAt`   | Yes      | ISO 8601 date-time, inclusive.                                  |
| `endAt`     | Yes      | ISO 8601 date-time, inclusive.                                  |
| `sources`   | No       | Single channel value. Call the endpoint per channel to combine. |
| `agentName` | No       | Case-insensitive substring match on the agent display name.     |

## Time format

Response times (`first_response_time`, `avg_response_time`, `resolution_time`) are formatted as `HH:MM:SS` for lossless representation. Convert to minutes/hours on your side if needed.

## AI agents

Rows where `agent_type` is `"ai"` (internal `agent_id = -2`) represent aggregated AI agent activity, not a specific human user.

## Example

```bash theme={null}
curl -X GET "https://api.bitbybit.studio/whatsapp/open/v1/analytics/agents?startAt=2026-07-20T00:00:00Z&endAt=2026-07-20T23:59:59Z" \
  -H "x-api-key: bbb_live_abc123..."
```
