> ## 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.

# Analytics API

> Workspace, campaign, and link analytics endpoints for overview cards, charts, breakdowns, live feeds, and exports

# Analytics API

Analytics APIs power metrics across workspace, campaign, and link views.

## Authentication and scope

* Requires workspace-authenticated context (session token or API key).
* Most routes require `analytics:read`.
* `GET /analytics/audit-log` requires `workspace:update`.
* Route-level feature gates apply to selected endpoints (for example deep-links and device analytics surfaces).

## Core endpoint groups

### Workspace analytics

* `GET /api/analytics/workspace/overview`
* `GET /api/analytics/workspace/timeseries`
* `GET /api/analytics/workspace/regions`
* `GET /api/analytics/workspace/continents`
* `GET /api/analytics/workspace/devices`
* `GET /api/analytics/workspace/triggers`
* `GET /api/analytics/workspace/top-folders`
* `GET /api/analytics/workspace/top-tags`
* `GET /api/analytics/workspace/campaigns/ranking`
* `GET /api/analytics/workspace/budgets`
* `GET /api/analytics/workspace/usage`

### Link analytics

* `GET /api/analytics/:linkId/summary`
* `GET /api/analytics/:linkId/timeseries`
* `GET /api/analytics/:linkId/geo`
* `GET /api/analytics/:linkId/cities`
* `GET /api/analytics/:linkId/regions`
* `GET /api/analytics/:linkId/continents`
* `GET /api/analytics/:linkId/devices`
* `GET /api/analytics/:linkId/referrers`
* `GET /api/analytics/:linkId/triggers`
* `GET /api/analytics/:linkId/rules`
* `GET /api/analytics/:linkId/rules/:ruleId/conditions`
* `GET /api/analytics/:linkId/traffic-flow`
* `GET /api/analytics/:linkId/click-paths`

### Unified overview and conversion analytics

* `GET /api/analytics/overview`
* `GET /api/analytics/conversions/details`
* `GET /api/analytics/leads`
* `GET /api/analytics/leads/timeseries`
* `GET /api/analytics/leads/breakdown`
* `GET /api/analytics/sales`
* `GET /api/analytics/sales/timeseries`
* `GET /api/analytics/sales/breakdown`
* `GET /api/analytics/composite`
* `GET /api/analytics/funnel`

### Real-time and operations

* `GET /api/analytics/live`
* `GET /api/analytics/live/ws`
* `GET /api/analytics/live/stats`
* `GET /api/analytics/export`
* `POST /api/analytics/batch`
* `GET /api/analytics/audit-log`
* `GET /api/analytics/embed`

## Shared query patterns

* Date range:
  * `days` (validated and capped server-side)
  * or explicit `start`/`end`
* Scope filters (supported by many routes):
  * `campaignId`
  * `linkId`
* Time formatting:
  * `timezone`
  * `granularity` (`hour`, `day`, `month` on supported endpoints)
* Currency display:
  * `currency` (supported currencies only, fallback to workspace default or USD)

## Response envelope

Most analytics routes return:

```json theme={null}
{
  "success": true,
  "data": {}
}
```

Failures use the standard error envelope with `error.code` and `error.message`.

## Performance behavior

* Analytics GET routes are fronted by snapshot caching middleware.
* Live feeds, exports, batch queries, and deep drilldowns are intentionally uncached.
* Some endpoints fall back to D1-derived aggregates when Tinybird is unavailable.

Related docs:

* `/api-reference/analytics/timeseries`
* `/api-reference/analytics/geographic`
* `/api-reference/analytics/devices`
* `/user-guides/manual/data/analytics-views-reference`
* `/user-guides/manual/data/analytics-and-reporting`
