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

# Live and Realtime Analytics

> Live event feed, WebSocket stream, and realtime stats endpoints

# Live and Realtime Analytics

## Endpoints

* `GET /api/analytics/live`
* `GET /api/analytics/live/ws`
* `GET /api/analytics/live/stats`

## Access

* Permission: `analytics:read`
* Workspace scope is enforced by middleware for all live routes

## `GET /api/analytics/live`

Returns recent live events used for initial UI hydration.

Event types include:

* `click`
* `qr_scan`
* `conversion`

Response includes enriched names (`campaignName`, `linkTitle`) and summary counts in `meta`.

## `GET /api/analytics/live/ws`

WebSocket upgrade endpoint for push updates.

Requirements:

* `Upgrade: websocket` header
* authenticated workspace context

Errors:

* `426` if upgrade headers are missing
* `503` if realtime backend binding is unavailable

## `GET /api/analytics/live/stats`

Returns realtime backend status/diagnostics for the current workspace.

## Operational notes

* Live routes are excluded from long-TTL snapshot caching.
* `/live` is for first payload; `/live/ws` is for incremental updates.
* Do not use polling when WebSocket stream is available.
