Skip to navigation

Retrieve campaign KPIs

View as Markdown

The KPIs defined for the campaign’s category (e.g. revenue_total, avg_ticket for sales), aggregated over the calls of the last days days, plus breakdown: for each distribution KPI (e.g. best_product), the share of calls per label. Plot one KPI over time with GET /api/analytics/kpi/{campaignId}/timeseries; see which fields feed each category with GET /api/analytics/kpi/templates/{category}.

  • value is the sum for sum KPIs, the average (two decimals) for avg KPIs, and equals count for count KPIs. KPIs ending in _today cover the current day in your workspace’s timezone (since 2026-09-15; it was the UTC day before).
  • breakdown items are sorted by count descending; percentage is the share (0-100, two decimals) of all labelled calls for that KPI. Distribution labels are the values the agent extracted (Spanish product text).

No data. Every KPI of the category is always listed; with no samples its value and count are 0 (not null) — read count to tell “nothing measured” from a real zero. A distribution KPI with no labelled calls has [] in breakdown. An unknown, deleted or other workspace’s campaign id is NOT a 404: it is reported with category general and zero values.

Idempotency. Read-only; safe to retry.

Consistency. Cached 120 seconds per campaign and days; cleared whenever a call of the campaign has its KPIs processed.

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/*. Also counts against the general API limit. See Rate limits.
  • Plan: Available on every plan. Requires an active subscription (active, trialing or past_due); without one the request is refused with 403 BILLING_ERROR (metadata.kind: subscription_required).

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.

ScopeGET / HEADPOST / PUT / PATCH / DELETEAdmin-only routes
readYesNoNo
writeYesYesNo
fullYesYesYes

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.

Path parameters

campaignIdstringRequiredformat: "uuid"

UUID of the campaign (see GET /api/campaigns). A non-UUID is a 400; a well-formed id that is unknown or belongs to another workspace returns zero-valued general KPIs, not a 404.

Query parameters

daysintegerOptional1-365Defaults to 30

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

Response

Campaign KPIs.
dataobjectOptional

Errors

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