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

# Batch, Export, and Embed Analytics

> Batch analytics requests, export formats, audit log, workspace usage, and embed endpoints

# Batch, Export, and Embed Analytics

## Endpoints

* `POST /api/analytics/batch`
* `GET /api/analytics/export`
* `GET /api/analytics/audit-log`
* `GET /api/analytics/workspace/usage`
* `GET /api/analytics/embed`

## Batch requests

`POST /api/analytics/batch` accepts up to `10` sub-requests.

Supported sub-request types:

* `overview`
* `timeseries`
* `city_breakdown`
* `qr_analytics`
* `qr_geo_breakdown`
* `qr_timeseries`

## Export endpoint

`GET /api/analytics/export`

Query params:

* `format`: `csv` or `json`
* `type`: `timeseries`, `composite`, `funnel`, `utm_breakdown` (plus default click-stats fallback)
* optional: `days`, `start`, `end`, `granularity`, `linkId`, `campaignId`, `dimension`

## Audit log endpoint

`GET /api/analytics/audit-log`

* requires `workspace:update`
* optional filters: `action`, `actorId`, `resourceType`, date range, `limit`

## Workspace usage endpoint

`GET /api/analytics/workspace/usage`

Returns usage counters used for billing cross-checks (clicks, leads, sales) over selected range.

## Embed endpoint

`GET /api/analytics/embed`

Query params:

* `node`: `embed_stats`, `embed_timeseries`, `embed_top_referrers`
* `widgetType` (optional)
* date range and optional `limit`

## Permissions

* `analytics:read` for batch/export/usage/embed
* `workspace:update` for audit-log

## Common errors

* `400`: invalid batch payload or unsupported request type
* `500`: analytics not configured or backend failure
