Retrieve campaign analytics

View as Markdown
Returns the all-time results of one campaign: interactions, completed calls, successes, success rate, average duration, average sentiment and the count of every outcome. There is no `days` window; for a windowed view of one campaign use `GET /api/analytics/overview?campaignId=...` or `GET /api/analytics/calls-per-day?campaignId=...`. **Success is category-specific here.** Successes are counted with the campaign's own success outcomes (for `sales` only `sale_closed`; for `scheduling` `appointment_booked` and `appointment_rescheduled`; and so on), which is stricter than the cross-category definition used by the overview and leaderboards. `successRateLabel` names the rate the way the category does (`conversionRate`, `bookingRate`, ...). An unrecognised stored category is treated as `general`. **Filters.** `direction` narrows every number; an unknown value is ignored and treated as `all` (no `400`). **Partial failure.** The aggregates and the outcome breakdown are read in parallel. If one of them fails, the response is still `200` with that part zeroed and its name listed in `_degraded`. When nothing failed, `_degraded` is absent. **No data.** Counts and `successRate` are `0`, `outcomeBreakdown` is `{}`, `avgSentiment` is `null`. `averageDurationSeconds` is `0` for a voice campaign without completed calls and `null` for any other channel. **Idempotency.** Safe to retry: this is a read. **Consistency.** Cached for 120 seconds, then served stale for up to 15 minutes while a background refresh runs. A `404` is never cached. **Access** - **Required scope:** `read`. Signed-in users need the owner, admin, member or viewer role. - **Rate limit:** Analytics — 30 requests/min per workspace, in addition to the general API budget of your plan. See [Rate limits](/rate-limits). - **Plan:** Available on every plan. A workspace without an active subscription (active, trialing or past due) gets `403 BILLING_ERROR`.

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"

Id of a campaign in your workspace. Deleted campaigns answer 404.

Query parameters

directionenumOptionalDefaults to all

Restrict the numbers to inbound or outbound calls. all (the default) counts both. An unknown value is ignored and treated as all.

Allowed values:

Response

The campaign’s all-time analytics.

dataobjectOptional

Errors

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