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

# Get organization analytics

> Retrieve chat insight analytics for an organization

Returns organization-level chat analytics: ticket, lead, and message totals, plus time-series engagement series.

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Project API key for this organization. Format: `bot_live_…`
</ParamField>

## Path parameters

<ParamField path="organization_id" type="string" required>
  Organization ID. Must match the API key.
</ParamField>

## Query parameters

<ParamField query="start_date" type="datetime">
  Include data from this datetime (inclusive).
</ParamField>

<ParamField query="end_date" type="datetime">
  Include data until this datetime (inclusive).
</ParamField>

<ParamField query="project_id" type="string">
  Limit analytics to a single project.
</ParamField>

<ParamField query="channel_type" type="string">
  Filter by channel type (for example `web`, `whatsapp`, `telegram`).
</ParamField>

## Response

<ResponseField name="tickets" type="integer" required>
  Ticket count in scope.
</ResponseField>

<ResponseField name="leads" type="integer" required>
  Lead / new customer-profile identity count in scope.
</ResponseField>

<ResponseField name="messages" type="integer" required>
  Message count in scope.
</ResponseField>

<ResponseField name="user_engagement" type="array" required>
  Time-bucketed message engagement series (`label`, `count`).
</ResponseField>

<ResponseField name="session_growth" type="array" required>
  Time-bucketed lead / profile growth series (`label`, `count`).
</ResponseField>

<ResponseField name="lead_generation" type="array">
  Same growth series as `session_growth` (alias for clients).
</ResponseField>

<ResponseField name="group_by" type="string" required>
  Bucket size used for series: `daily`, `weekly`, `monthly`, or `yearly` (chosen from the date range).
</ResponseField>

## Errors

<ResponseField name="401" type="Unauthorized">
  Missing, invalid, or revoked API key.
</ResponseField>

<ResponseField name="403" type="Forbidden">
  API key is not authorized for this organization.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -G "https://backend.botcadence.com/organizations/ORG_ID/analytics" \
    -H "X-API-Key: bot_live_YOUR_KEY" \
    --data-urlencode "start_date=2026-07-01T00:00:00Z" \
    --data-urlencode "end_date=2026-07-22T23:59:59Z" \
    --data-urlencode "channel_type=web"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    start_date: "2026-07-01T00:00:00Z",
    end_date: "2026-07-22T23:59:59Z",
    channel_type: "web",
  });

  const response = await fetch(
    `https://backend.botcadence.com/organizations/${organizationId}/analytics?${params}`,
    { headers: { "X-API-Key": process.env.BOTCADENCE_API_KEY } }
  );
  ```

  ```python Python theme={null}
  import os
  import requests

  response = requests.get(
      f"https://backend.botcadence.com/organizations/{organization_id}/analytics",
      headers={"X-API-Key": os.environ["BOTCADENCE_API_KEY"]},
      params={
          "start_date": "2026-07-01T00:00:00Z",
          "end_date": "2026-07-22T23:59:59Z",
          "channel_type": "web",
      },
  )
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "status": "success",
    "message": "Organization analytics retrieved successfully",
    "data": {
      "tickets": 48,
      "leads": 120,
      "messages": 1840,
      "user_engagement": [
        { "label": "Jul 01", "count": 62 },
        { "label": "Jul 02", "count": 71 }
      ],
      "session_growth": [
        { "label": "Jul 01", "count": 8 },
        { "label": "Jul 02", "count": 11 }
      ],
      "lead_generation": [
        { "label": "Jul 01", "count": 8 },
        { "label": "Jul 02", "count": 11 }
      ],
      "group_by": "daily"
    },
    "status_code": 200
  }
  ```
</ResponseExample>
