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

# Reporting and Usage Tracking

> Track platform and API usage with reporting endpoints, and build custom dashboards and KPIs tailored to your business needs

## Background

Until the **Sunny Seal** release, the platform included a built-in *Analytics* page.\
This page allowed customers to track metrics such as:

* request volume,
* user satisfaction,
* overall usage statistics.

Over time, however, we realized that **every customer had very different reporting needs**. A single, one-size-fits-all dashboard could not satisfy everyone. That’s why we decided to **deprecate the Analytics page** starting with Sunny Seal.

## New Strategy: Flexibility through the API

Instead of enforcing a generic interface, we shifted to a more flexible approach.\
Now, usage tracking is enabled through a series of **API endpoints** that expose raw data.

This choice has two main benefits:

1. **Total flexibility** – each customer can build dashboards and reports tailored to their needs.
2. **Easy integration** – data can be plugged directly into existing systems (BI tools, CRM, internal monitoring, etc.).

## Available Endpoints

The following endpoints are available for reporting:

* [Get Chat Sessions Report](https://lighton.mintlify.app/api-reference/reporting/get-chat-sessions-report)
* [Get Chat Feedbacks Report](https://lighton.mintlify.app/api-reference/reporting/get-chat-feedbacks-report)
* [Get Tools Report](https://lighton.mintlify.app/api-reference/reporting/get-tools-report)
* [Get Used Documents Report](https://lighton.mintlify.app/api-reference/reporting/get-used-documents-report)
* [Get User Activities Report](https://lighton.mintlify.app/api-reference/reporting/get-user-activities-report)

***

# How to Use the Endpoints

### Authentication

Each request requires an **API token** passed as a Bearer token in the header:

```
Authorization: Bearer <YOUR_API_TOKEN>
```

### Common Parameters

* `start_date` *(required)*: start date in `YYYY-MM-DD` format.
* `end_date` *(optional)*: end date, defaults to today.
* Depending on the endpoint, additional filters may be available (e.g., user ID, model ID).

***

## Example: Get Chat Sessions Report

### cURL

```
curl --request GET \
  --url "https://paradigm-preprod.lighton.ai/api/v2/reporting/chat-sessions/?start_date=2023-12-01&end_date=2023-12-31" \
  --header "Authorization: Bearer <YOUR_API_TOKEN>"
```

### Python

```
import requests

url = "https://paradigm-preprod.lighton.ai/api/v2/reporting/chat-sessions/"
params = {"start_date": "2023-12-01", "end_date": "2023-12-31"}
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

response = requests.get(url, headers=headers, params=params)
data = response.json()

print(data["reporting"][0]["dates"][0]["sessions"])
```

### Example JSON Response

```
{
  "metadata": {
    "sessions_count": {"description": "Total number of sessions", "unit": "integer"},
    "average_session_length": {"description": "Average session length", "unit": "seconds"}
  },
  "reporting": [
    {
      "company": {"name": "ACME Corp", "id": 123},
      "dates": [
        {
          "date": "2023-12-25",
          "sessions": {
            "sessions_count": 45,
            "unique_models_count": 3,
            "average_session_length": 120
          },
          "chats": {
            "user_queries_count": 200,
            "model_responses_count": 190,
            "last_model_response_date": "2023-12-25T22:30:00Z"
          }
        }
      ]
    }
  ]
}
```

***

## Example Use Cases

* **BI dashboards**: integrate with PowerBI, Looker, or Tableau to track adoption.
* **Internal alerts**: trigger notifications (e.g., threshold exceeded).
* **Product insights**: monitor which tools or documents are most used.

***

# FAQ

### What filters are available?

All endpoints support date filters, and some accept additional filters (e.g., user ID, document ID). See the API reference for details.

### How often can I call the API?

You can query as often as needed, but we recommend **aggregating data daily or weekly** to reduce load.

### Do you still provide a built-in reporting interface?

No. Our strategy is **API-only** for maximum flexibility and scalability.

### Can I combine multiple endpoints?

Yes. For example:

* Sessions + Feedbacks = adoption & satisfaction tracking.
* Documents + Tools = resource usage monitoring.
