> ## 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 project analytics

> Retrieve chat insight analytics for a project

Returns project-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 and project. Format: `bot_live_…`
</ParamField>

## Path parameters

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

<ParamField path="project_id" type="string" required>
  Project 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="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`.
</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 or project.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -G "https://backend.botcadence.com/organizations/ORG_ID/projects/PROJECT_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"
  ```

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

  const response = await fetch(
    `https://backend.botcadence.com/organizations/${organizationId}/projects/${projectId}/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}/projects/{project_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",
      },
  )
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "status": "success",
    "message": "Project analytics retrieved successfully",
    "data": {
      "tickets": 12,
      "leads": 34,
      "messages": 520,
      "user_engagement": [
        { "label": "Jul 01", "count": 18 },
        { "label": "Jul 02", "count": 22 }
      ],
      "session_growth": [
        { "label": "Jul 01", "count": 3 },
        { "label": "Jul 02", "count": 5 }
      ],
      "lead_generation": [
        { "label": "Jul 01", "count": 3 },
        { "label": "Jul 02", "count": 5 }
      ],
      "group_by": "daily"
    },
    "status_code": 200
  }
  ```
</ResponseExample>
