List a campaign KPI time series

View as Markdown
Daily raw totals of a single KPI for a campaign, ascending by date (UTC days). The `kpi` query parameter is **required**; pass one of the `key`s returned by `GET /api/analytics/kpi/{campaignId}` (e.g. `revenue_total`). Omitting it returns `400 VALIDATION_FAILED`. Each row holds the day's accumulated `value` and `count`, NOT the aggregated KPI: for an `avg` KPI (e.g. `avg_ticket`) divide `value` by `count` yourself; for a `count` KPI read `count` (its `value` is `0`). A distribution KPI key returns daily counts without labels. **No data.** Only days with recorded samples appear (no zero rows). An unknown KPI key, an unknown campaign, or one from another workspace returns an empty `data` array, not an error. **Idempotency.** Read-only; safe to retry. **Consistency.** Cached 120 seconds per campaign, `kpi` and `days`. **Access** - **Required scope:** `read`. Signed-in users need the owner, admin, member or viewer role. - **Rate limit:** Analytics — 30 requests/min per workspace, shared with the rest of `/api/analytics/*` (except `/analysis/*`); a KPI request consumes 2 units, so effectively 15 requests/min. Also counts against the general API limit. See [Rate limits](/rate-limits). - **Plan:** Available on every plan (behind the `advancedDashboard` feature gate, which is enabled on every plan).

Authentication

AuthorizationBearer
Workspace API key: `jl_` followed by 64 lowercase hex characters, created by the workspace owner in the dashboard (**Settings → API Keys**) and sent as `Authorization: Bearer jl_...`. The plaintext is shown once, at creation; Jelliu stores only a SHA-256 hash. A workspace can hold up to 25 active keys. | Scope | GET / HEAD | POST / PUT / PATCH / DELETE | Admin-only routes | | --- | --- | --- | --- | | `read` | Yes | No | No | | `write` | Yes | Yes | No | | `full` | Yes | Yes | Yes | Operations restricted to admins or owners reject keys without the `full` scope with `403`, and say so in their description. No key, whatever its scope, can mint or revoke API keys or rotate a webhook secret — that requires a signed-in owner session. A revoked key stops authenticating within about 10 seconds. See [Authentication](/authentication).

Path parameters

campaignIdstringRequiredformat: "uuid"

UUID of the campaign. A non-UUID is a 400; an unknown id returns an empty list.

Query parameters

kpistringRequired1-100 characters

KPI key to chart (case-sensitive). Missing, empty or longer than 100 characters is a 400.

daysintegerOptional1-365Defaults to 30

Look-back window in days. Never rejected on its own - a non-integer, out-of-range (1-365) or non-numeric value falls back to 30.

Response

Time series, oldest day first.
datalist of objectsOptional

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
429
Too Many Requests Error