Skip to main content
Languages: every operation supports cURL, Node.js (TypeScript), Python, Go, Ruby, and PHP. The first 15 operations on this page show all six languages; the remaining 63 show cURL and TypeScript — the two most-used.

Analytics API

Analytics endpoints exposed by the Devotel CPaaS API Base path: /api/v1 Endpoint count: 76

title: “Worked analytics queries” description: “KPI summary with filters, cursor-paged breakdown rows, prebuilt scheduled-report reads, the zeroed-period shape, validation/role errors, and copyable response envelopes for the generated dashboard, carrier-truth, satisfaction-goal, intelligence, and scheduled-report shells.”

Worked analytics queries

Every operation below is documented on this page with its parameters, but the bodies you branch on — the KPI envelope, the breakdown rows, the totals line — are easiest to learn as one reader chain: pick a metric/summary endpoint → filter by period and channel → page through the breakdown rows → read the totals row. The samples below walk that chain end to end and show the full response envelope at each step. Scope of this overlay:
  • Per the language note above, these samples show cURL and TypeScript — the two most-requested languages. The other four tabs appear on the endpoint blocks themselves.
  • The full endpoint catalogue with every filter combination lives at the stats API guide; recurring email delivery of the same data (schedule, recipients, cadence) is covered in scheduled reports. This overlay stays envelope-accurate: request, response, and the errors that decide what you branch on — nothing else.
  • The closing section, Response envelopes for the generated shells, groups the remaining analytics operations — dashboards, carrier and route truth, satisfaction goals, portfolio intelligence, and scheduled-report writes — into five panels with one copyable envelope each.
All analytics reads are tenant-scoped and read-only. They degrade to a zeroed summary or an empty rows array — still a 200 — during a transient storage blip, so a poll loop or an always-on dashboard never flashes a 5xx; design your polling against that contract.

1. Pull a KPI summary

GET /api/v1/analytics/messages returns the headline KPIs for a period — sent, delivered, failed, read, the derived rates, and the average delivery time — plus a bucketed time series for charting. Filter the window with start_date / end_date (or a days lookback) and narrow to one channel with channel.
200
Adopt the same envelope shape everywhere on this page: all counters live under data.totals, chartable buckets under data.time_series (or a named breakdown array), and the echoed granularity under data.group_by. The cost counterpart — GET /api/v1/analytics/costs — answers with the same totals + time_series envelope plus a by_channel breakdown.

2. Page a breakdown series

Breakdown endpoints return the counters you just read, re-sliced per dimension — channel, destination country, or error code behind failures. Page through the list endpoints that carry a cursor (for example goals): keep the same filters, pass the previous page’s nextCursor back as cursor, and stop when it comes back null. GET /api/v1/analytics/goals
Page 1:
200
Page 2 — pass cursor=cur_8Kw2mQ1z; when this page’s nextCursor is null you have the full set:
200
The fixed-shape breakdowns — GET /api/v1/analytics/messages/by-channel, /by-country, and /messages/errors — are single-response reads with no cursor; each returns its full ranked array (channels, countries, errors) so you render them directly.

3. Prebuilt report read (and the empty-period shape)

GET /api/v1/analytics/scheduled-reports lists the recurring reports already scheduled for your organization — the prebuilt views the scheduler emails on a cadence — with each report’s type, frequency, recipients, and its last- and next-send timestamps.
200
The empty period is a zeroed summary, not an error. Choose a window with no traffic (or hit the degraded path during a storage blip) and the KPI endpoint still returns 200 with zeroed totals and an empty series — test your client against this shape so a quiet period never parses as a failure:
200

4. Errors

Two branches cover the mistakes callers actually hit on this surface. Validation — unrecognized filter value. Query params are validated before any query runs. A failed validation returns 422 VALIDATION_ERROR with error.details.issues listing each rejected field — for example a group_by outside the allowed set (hour / day / week / month):
422
Role — reads are gated to specific roles. The analytics reads on this page require an org role of owner, admin, developer, or viewer (writes such as creating goals or scheduled reports narrow to owner, admin, and developer); a key presented without one of those roles is rejected with 403 INSUFFICIENT_PERMISSIONS and a message naming the accepted roles:
403
Treat both as terminal, not retriable: the 422 needs a corrected filter before you re-send, and a 403 will not succeed until the role changes.

Response envelopes for the generated shells

The endpoint blocks on this page carry parameters and status codes, but a number of operations render with a bare data shell in the generated reference. This section hands you one copyable, field-accurate envelope per operation, grouped into five panels so you land on the one you need: dashboards and widgets, carrier and route truth, satisfaction goals, portfolio and campaign intelligence, and scheduled-report writes. Every envelope below is tenant-scoped, wraps in the standard meta block (request_id, timestamp) shown in sections 1–4 — omitted here for readability — and degrades to zeroed or empty collections with a 200 during a transient storage blip, per the contract at the top of this page.

Dashboards and widgets

GET /api/v1/analytics/dashboards/widgets is the palette for the no-code dashboard builder: every composable widget with the read-only source endpoint that backs it, plus the grid constraints the builder enforces. It takes no query parameters.
200
GET /api/v1/analytics/deliverability answers with the per-channel deliverability panel: totals, the canonical rates, a bucketed series, and the top failure reasons and countries for one channel (channel required; window 24h|7d|30d; optional groupBy).
200
GET /api/v1/analytics/deliverability-health-center is the cross-channel deliverability cockpit: one composite 0–100 score over the five per-channel sender-reputation cards (SMS route quality, email domain and IP authentication, WhatsApp quality rating, RCS sender status, voice call quality), each independently fail-safe, plus the worst-first remediation list. days (1–90, default 7) sizes the SMS route-quality slice.
200
GET /api/v1/analytics/funnel/{step}/drop-reasons returns the ranked carrier rejection codes behind one funnel step — the same drop-reason vocabulary as the errors breakdown in section 2 — so a step’s drop-off and its causes parse with one shape.

Carrier and route truth

These four reads are the “the DLR says delivered, but is it?” panel. The silent-drop inference compares the carrier-claimed delivery rate against an engagement signal over a sliding window: a destination that reports delivered but never replies, answers, or raises any other engagement inside the window counts toward inferred_dropped, and a carrier whose engagement-backed rate stays under the drop-rate threshold over a sufficient sample flips silent_drop_suspected to true. The same sliding-window fields the handler returns are echoed on every response — dropRateThreshold (default 92), silentWindowHours (default 4 for the SMS DLR grace window), and minSampleSize — so you can audit each verdict against your own thresholds; the account health score uses that same 24-hour engagement window for its Engagement subscore. GET /api/v1/analytics/per-mno-delivery buckets outbound SMS or voice traffic by destination carrier. This row is a real silent-drop verdict: the carrier claims 1,178 delivered of 1,204 terminal, but only 610 ever showed engagement, so 568 sends are inferred dropped and the carrier trips the threshold.
200
GET /api/v1/analytics/per-route-delivery is the connector-side companion: the same counters grouped by the carrier connector that carried each message (the wholesale softswitch, a per-SMPP credential, or the connector the retry pipeline fell back to), paginated with page / pageSize. totals.degraded covers every route, not just the page.
200
GET /api/v1/analytics/route-dlr-anomaly classifies every outbound SMS route (carrier × destination country) against its learned 14-day delivery-rate baseline — drop, normal, or insufficient_data — so a carrier silently degrading one route surfaces before your customers notice. No query parameters.
200
GET /api/v1/analytics/route-latency-slo catches the two blind spots the DLR-rate detector cannot see: a route that still delivers ~100% but has slowed to minutes (p95 latency against the 300 s SLO), and a route whose DLRs silently stopped arriving (share of sends stuck non-terminal past the receipt grace). Each route lists the thresholds it breached.
200

Satisfaction goals

Satisfaction goals put a target on one survey metric — CSAT (percent), NPS (points), or CES (score) — and recompute progress from your live survey responses on every read; nothing is stored but the target itself. Every operation in this cluster parses the same goal object: the stored fields plus a progress envelope comparing the live value against your target.
200
current is the live metric value over window_days (null until responses exist), baseline is the value captured when the goal was created, and progress_pct measures the journey from baseline to target, clamped to 0–100; attained flips to true once current reaches the target. The five operations wrap that object:
  • GET /api/v1/analytics/satisfaction-goals returns { items, total } of the goal object above.
  • GET /api/v1/analytics/satisfaction-goals/{id} returns the single goal object (404 when the id is not one of yours).
  • POST /api/v1/analytics/satisfaction-goals creates a goal — body: name, metric (csat | nps | ces), target within the metric’s scale, optional survey_id, window_days (1–365, default 30), enabled — and returns 201 with the goal object; the baseline is captured from live responses at creation.
  • PATCH /api/v1/analytics/satisfaction-goals/{id} updates any of name, target, survey_id, window_days, enabled (at least one; metric is immutable) and returns 200 with the recomputed goal object.
  • DELETE /api/v1/analytics/satisfaction-goals/{id} stops tracking the target and returns 200 with:
200
Writes require owner, admin, or developer; reads follow the analytics-read hierarchy. A target outside the metric’s scale (CSAT 0–100, NPS −100–100, CES 0–10) is a 422 VALIDATION_ERROR naming the accepted range. (The conversion-goal cluster — GET /analytics/goals, paged in section 2 — is the separate “which touchpoint drove a sale” surface.)

Portfolio and campaign intelligence

GET /api/v1/analytics/sentiment rolls per-message sentiment up across conversations: a portfolio-wide totals line, a chronological trend, and per-channel / per-agent / per-language / per-resolution breakdowns, each carrying a net sentiment index in −100–100.
200
GET /api/v1/analytics/sms-click-through is the channel-level click-through panel over your tracked short links: sends, tracked sends, raw and verified clicks, and both CTRs per campaign (or per queue with group=queue), paginated like the route breakdown above. click_rate is null for a bucket that carried no tracked links.
200
GET /api/v1/analytics/telegram returns the Telegram-only KPIs the generic rollups cannot express: bot-blocked rate (Bot API 403 user-blocked family), custom-emoji rate, and the DM-vs-group split with a per-chat-type breakdown.
200
GET /api/v1/analytics/topic-intelligence answers “what are customers contacting us about, and is it rising or falling” across voice, SMS, WhatsApp, email, and web chat: up to 50 trending contact reasons with current-vs-prior volume, the per-channel split, CSAT / deflection / handling-time rollups, and linked example threads.
200
GET /api/v1/analytics/usage-anomalies compares the last complete hour of each usage family (SMS throughput and telco cost, voice throughput and telco cost) against a learned 72 h baseline and flags spike or drop — the tenant-wide stall or runaway-cost surge the per-route detectors are too narrow to see.
200

Scheduled reports

POST /api/v1/analytics/scheduled-reports/{id}/send-now marks one scheduled report due immediately; the dispatcher emails it on its next tick instead of waiting for the cadence, and the UI polls last_sent_at to show delivery progress. Returns 200 with a queue acknowledgement (404 when the id does not resolve to one of your reports); requires owner or admin and supports the Idempotency-Key header.
200
PATCH /api/v1/analytics/scheduled-reports/{id} updates any of name, type, frequency, recipients, filters, enabled, timezone (at least one). Changing frequency re-anchors the cadence from the last send; the derived next tick never lands in the past. Returns 200 with the updated report:
200

Multi-touch marketing attribution (first/last/linear model picker)

GET /api/v1/analytics/attribution
Re-attributes the conversions recorded by the goals pipeline across channels under a caller-chosen model: first_touch (100% to the oldest touchpoint), last_touch (100% to the newest), or linear (even split across every touchpoint). Returns by_channel + by_campaign credit buckets (conversions + value_cents + share) alongside totals and the unattributed-conversions count. Query params: model (first_touch|last_touch|linear, default last_touch), goal_id (restrict to one goal’s conversions, optional), window_days (conversions within trailing N days, 1-365, default 30), lookback_days (per-conversion touchpoint lookback, 1-365, default 30). Restricted to owner/admin/developer/viewer; read-only, rate-limited, 60s cached.

Compare your rates against cross-tenant benchmark cohorts

GET /api/v1/analytics/benchmarks
Compares the caller’s own delivery and open rates (by channel, country, message type) against anonymized cross-tenant cohort percentile bands (p25/p50/p75/p90) published nightly. Only cohorts that clear the k-anonymity floor (at least five distinct tenants and five hundred messages) are ever published, so no single tenant is re-identifiable. Optional filters: channel, metric, messageType, country (ISO alpha-2). Use it to see how your deliverability stacks up against comparable senders. Responds available: false before the first nightly snapshot exists. Read-only; owner/admin/developer/viewer.

Estimated CO2e footprint per channel

GET /api/v1/analytics/carbon
Converts the tenant’s outbound usage telemetry (message counts + voice minutes) into an estimated CO2e footprint per channel over a date window, for sustainability reporting and EMEA / public-sector procurement questionnaires. Optional filters: start_date / end_date (YYYY-MM-DD) or a trailing days number (default 30). Read-only; owner/admin/developer/viewer. For a downloadable report use GET /analytics/carbon/export.

Download a CSV carbon sustainability report

GET /api/v1/analytics/carbon/export
Renders the same per-channel estimated CO2e report as GET /analytics/carbon as a downloadable, self-describing CSV attachment (Content-Type text/csv), ready to attach to a procurement sustainability questionnaire. Optional filters: start_date / end_date (YYYY-MM-DD) or trailing days, plus optional format. Read-only; owner/admin/developer/viewer.

Aggregated contact-reason volume analytics

GET /api/v1/analytics/contact-reasons
Answers ‘why are customers contacting us’ by rolling the inbox auto-categorize signal (auto_category / auto_urgency / auto_intent stamped on conversations) up into reason, category, urgency, channel, and trend breakdowns. Query params: window, optionally channel, category, reason. Use it for CX portfolio reporting and to close the voice-vs-text parity gap (voice has the equivalent under /voice/intelligence/trends). Read-only; owner/admin/developer/viewer; 60s cached.

Top conversations by telco cost-to-serve

GET /api/v1/analytics/cost-per-conversation
Ranks conversations by telco cost-to-serve: sums the per-unit prices already stamped on message rows and call legs, grouped by conversation over a caller-supplied window (no re-pricing). Required query: start / end (ISO datetime with offset, end strictly after start); optional limit (1–500, default 100). Use it for P&L on high-volume support threads. Read-only; owner/admin/developer/viewer.

Cost analytics with time-series and channel breakdown

GET /api/v1/analytics/costs
Returns cost analytics over a date window with a time-series and a per-channel breakdown, so finance and ops can track messaging spend. Query: start_date / end_date (YYYY-MM-DD), optional channel, and group_by (day|hour|week|month, default day). Read-only; any authenticated member with analytics:read.

List the widget catalog for custom dashboards

GET /api/v1/analytics/dashboards/widgets
Returns the palette for the no-code dashboard builder: every composable widget (id, title, category, the read-only source endpoint that backs it, default visualization and size, accepted params) plus the grid constraints the builder enforces client-side (default column count and max widgets per dashboard). The catalog is stateless — each placed widget fetches its own already tenant-scoped source endpoint when rendered. Takes no query parameters. Read-only; owner/admin/developer/viewer.

Per-channel deliverability dashboard

GET /api/v1/analytics/deliverability
Returns the deliverability dashboard for one channel: sent / accepted / delivered / read / failed / bounced / complained / unsubscribed totals, the canonical delivery / read / failure rates, a time-bucketed series, and the top failure reasons and countries. Query params: channel (required — one of sms, whatsapp, rcs, email, voice, instagram, messenger, viber; e.g. ?channel=sms), window (24h|7d|30d, default 7d), and optional groupBy (hour|day; defaults to hour for 24h and day otherwise). Series buckets use the tenant’s billing timezone, echoed as timezone. Read-only; owner/admin/developer/viewer; 60s cached.

Cross-channel deliverability and sender-reputation cockpit

GET /api/v1/analytics/deliverability-health-center
Rolls every channel’s sender reputation into one composite 0–100 score with an excellent/good/fair/poor/critical tier: SMS route quality, email domain and IP authentication, WhatsApp quality rating, RCS sender status, and voice call quality. Each channel card is independently fail-safe — a channel outage degrades that one card to an error status instead of blanking the cockpit — and below the healthy bar each affected channel joins the worst-first issues list with its root cause and remediation. Query params: days (1–90, default 7; sizes the SMS route-quality slice) — e.g. ?days=30. Read-only; owner/admin/developer/viewer; 60s cached.

Per-queue/campaign outbound delivery funnel

GET /api/v1/analytics/delivery-waterfall
Aggregates outbound SMS into a pending → sent → delivered → read / failed waterfall grouped by the operational unit a delivery ticket is filed against: an SMS queue (messaging service) or a campaign. Query params: group (queue|campaign, default queue), channel (sms), window (24h|7d|30d, default 7d), page (1-indexed, default 1) and pageSize (1–100, default 25) — e.g. ?group=queue&window=7d&page=1. Buckets sort by total traffic desc; totals sums every bucket, not just the page. Use it to say ‘the VIP-support queue lost 40% at the provider hop, not at the campaign hop’. Read-only; owner/admin/developer/viewer; 60s cached.

Carrier rejection codes behind a funnel drop-off

GET /api/v1/analytics/funnel/{step}/drop-reasons
Drill down on one funnel step to see the top carrier rejection codes for messages that dropped there, each decorated with a human-readable name, description, and actionable guidance from the carrier error dictionary. Path step: sent (sent but never delivered) carries the reasons; delivered / read / queued are reserved and currently return an empty list. Query params: date range (start_date / end_date, else days), channel, and limit (1-20, default 5). Use it to answer ‘why did this funnel bar drop?’ inline. Read-only.
string
required
—

List conversion goals

GET /api/v1/analytics/goals
Returns the tenant’s conversion goals with an all-time conversion count and revenue roll-up batched into the same page (one query — no per-goal N+1 stats call). Query params: limit (1-200, default 50) and offset. For pixel_fire goals each entry includes its signed pixel URL. Read-only.

Get one conversion goal

GET /api/v1/analytics/goals/{id}
Returns one goal by id: its configuration, attribution model, enabled flag, and — for pixel_fire goals — the signed pixel URL to embed on your site. Responds 404 when the goal does not exist. Read-only.
string
required
—

List a goal’s conversions

GET /api/v1/analytics/goals/{id}/conversions
Returns the recorded conversions for one goal, newest first: contact id, value, attribution pointers (message / campaign / agent), conversion time, and free-form metadata. Optional query limit (1-500, default 100). Use it to inspect exactly which conversions a goal recorded instead of only the aggregated counts. Read-only.
string
required
—

Aggregate conversion stats for one goal

Need this flow in Python, Go, Ruby, or PHP? The Worked sequences section renders this surface’s hero flows in the full six-language group.
GET /api/v1/analytics/goals/{id}/stats
Rolls up one goal’s conversions over a trailing window: total conversion count, summed value, and the top attributed messages, campaigns, and agents the attribution model credited. Optional query window_days (1-365, default 30). Use it to see which of your sends actually drive conversions. Read-only.
string
required
—

Cross-channel customer-journey path (Sankey) analytics

GET /api/v1/analytics/journey-paths
Reconstructs the ordered touchpoint sequence each customer walked across channels (chat, voice, email, WhatsApp, SMS) from the tenant’s conversations and folds it into a Sankey-ready payload: nodes (a channel occupying an ordered stage), links (stage-to-stage transitions with a journey count), stages (per-stage reached/continued/dropped/drop_off_rate), and top_paths (the most-walked full channel sequences with their share), alongside total_journeys, total_touchpoints, channels, and the echoed window/entry_channel/current_since. Query params: window (24h|7d|30d|90d, default 30d), entry_channel (keep only journeys whose first touchpoint was this channel), max_stages (2-10, default 6), min_journeys (prune links carried by fewer journeys, default 1). Restricted to owner/admin/developer/viewer; read-only, rate-limited, 60s cached.

List self-serve KPI alert rules

GET /api/v1/analytics/kpi-alert-rules
Returns every KPI alert rule defined for this organization with its runtime state (last evaluation outcome, last observed value, last fired timestamp) plus registry-derived display metadata (metric label, unit, direction, dashboard deep-link). Use this to render the rule list before creating or updating rules. Any authenticated member may read; writes are owner/admin/developer. Standard { data, meta } envelope with data.items + data.total.

List fired KPI alert events

GET /api/v1/analytics/kpi-alert-rules/events
Returns the organization’s fired KPI alert feed, newest-cap-retained (up to 50 events): each entry carries the rule it came from, the metric value at fire time, the breached threshold (for threshold rules), the trigger mode, a rendered human message, and a dashboard deep-link. Poll this to build a notification history or alert-acknowledgement UI. Any authenticated member may read. Standard { data, meta } envelope with data.items + data.total.

Aggregate message delivery metrics with time series

GET /api/v1/analytics/messages
Returns headline totals (sent, delivered, failed, read, delivery rate, read rate, average delivery time in ms) plus a bucketed time series of the same counters. Query params: start_date / end_date (YYYY-MM-DD or ISO datetime; else days lookback, max 365), channel (sms|whatsapp|rcs|email|viber|voice|push|messenger|telegram), status, campaign_id, group_by (hour|day|week|month, default day), phone_number_id (narrow a WhatsApp breakdown to one WABA connection). Time-bucketed rows carry a tenant-local period_date for calendar alignment. Use this for the overview volume chart on the analytics dashboard.

Delivery metrics broken down by channel

GET /api/v1/analytics/messages/by-channel
Returns one counter bucket per messaging channel (sms, whatsapp, rcs, email, viber, voice, push, messenger, telegram): totals sent/delivered/failed/read, delivery + read rates, plus engagement counters (opened / clicked / spam) for email. Same date-range params as GET /analytics/messages; phone_number_id narrows the outbound breakdown to one WhatsApp WABA connection. Use this for the per-channel KPI cards on the analytics dashboard.

Delivery metrics broken down by destination country

GET /api/v1/analytics/messages/by-country
Returns one counter bucket per destination country with sent/delivered/failed totals and delivery rate — the geographic view of outbound messaging reach, resolved from the message’s network identity. Same date-range params as GET /analytics/messages plus an optional channel filter. Use this to surface which destinations hold the volume and where delivery lags.

Message failure analysis by carrier error code

GET /api/v1/analytics/messages/errors
Returns failed-message rows grouped by carrier error code for the selected window, each decorated with a human-readable name, a description, and a failure category — the “why did messages fail?” panel behind the funnel drop-off drill-down. Same date-range params as GET /analytics/messages plus an optional channel filter. Use this to triage quality issues before they become a deliverability problem.

Account-level messaging health score

GET /api/v1/analytics/messaging-health-score
Rolls every outbound message over the window into one benchmarked 0–100 composite with five subscores — Sent Rate (delivery success), Compliance (complaint + opt-out rates), Fraud (suspected-fraud block rate), Latency (median accept-to-delivered seconds), and Engagement (reply within the engagement window) — plus ranked “fix this to gain X points” recommendations. Below the minimum sample floor the response carries an insufficient tier instead of a misleading score. Query params: window (24h|7d|30d, default 7d) and optional minSampleSize override. Read-only, open to owner/admin/developer/viewer, 60s cached.

Messaging insights — carrier, country, and error breakdowns

GET /api/v1/analytics/messaging-insights
Returns three histograms plus a totals roll-up for one channel over a window: per-carrier sent/delivered/failed with delivery + failure rates, per-country counters resolved from the message network identity, and per-error-code counts decorated with a human-readable name/description/category — plus a failure-category roll-up so you can see at a glance whether carrier filtering, content, or opt-outs dominate. Query params: channel (sms|whatsapp|rcs|email|viber|push|messenger|telegram), window (24h|7d|30d), and optional carrier / country / errorCode drill-downs; each dimension capped at the top 25 buckets. Owner/admin only — the carrier-side filtering signal is withheld from viewer scope. Read-only, 60s cached.

Per-carrier (MNO) delivery truth with silent-drop inference

GET /api/v1/analytics/per-mno-delivery
Buckets outbound SMS or voice traffic by destination carrier (MCCMNC) and cross-checks the carrier-claimed delivery rate against an engagement signal (an inbound reply / a >0-second answered call within the silent-drop window) so you can spot an operator that reports delivered but never actually arrives. Use it when per-country deliverability looks clean but handsets stay quiet; the buckets array exposes silent_drop_suspected per carrier and totals aggregate the suspicion count. Restricted to owner/admin/developer/viewer; read-only, rate-limited, 60s cached.

Per-carrier-connector (route-level) delivery breakdown

GET /api/v1/analytics/per-route-delivery
Groups outbound traffic by the carrier connector that actually carried each message — the wholesale softswitch, a per-SMPP credential, or the connector the retry pipeline fell back to (metadata._attempt_carrier when present, else the original provider) — and reports terminal/delivered/failed/undelivered counts with delivery, failure and undelivered rates per route. Use it when per-country or per-MNO deliverability degrades and you need to know which of YOUR connector paths is failing, not which destination operator. Paginated (page/pageSize); the totals.degraded counter covers ALL routes (not just the page) so a low-volume route past the row cap still surfaces. Restricted to owner/admin/developer/viewer; read-only, rate-limited, 60s cached.

Per-route DLR-rate anomaly classification (drop/normal/insufficient_data)

GET /api/v1/analytics/route-dlr-anomaly
Compares the last COMPLETE day’s delivery rate on every outbound SMS route (carrier provider × destination country) against a learned 14-day baseline (z-score with a floored stddev, plus relative-ratio and absolute-points guards) and flags it drop, normal or insufficient_data. Use it to catch a carrier silently degrading one route — a blocked sender, a filtering change, an upstream wholesale outage — before customers open a ticket; the daily webhook-worker scheduler pages on the same classification. No query parameters. Restricted to owner/admin/developer/viewer; read-only, rate-limited, 60s cached.

Per-route delivery-latency + silent-failure SLO status (ok/breach/insufficient_data)

GET /api/v1/analytics/route-latency-slo
Measures the last 6h of outbound SMS traffic per route (carrier provider × destination country) and classifies it against the delivery-latency SLO (p50/p95 of delivered_at − sent_at) and the silent-failure SLO (share of sends past the 15-min receipt grace still stuck non-terminal — the DLR that never arrived). Use it when a route keeps delivering ~100% but has slowed to minutes, or has silently stopped returning DLRs — the two blind spots the DLR-rate detector cannot see; the hourly webhook-worker sweep pages on the same thresholds. No query parameters. Restricted to owner/admin/developer/viewer; read-only, rate-limited, 60s cached.

List satisfaction goals (CSAT / NPS / CES targets + progress)

GET /api/v1/analytics/satisfaction-goals
Lists the organization’s satisfaction goals — named targets on a CX survey metric (CSAT 0–100 percent, NPS −100..100 points, CES 0–10 score) — each hydrated with its live current value and progress from the baseline captured at creation. Current values are recomputed from the tenant’s answered survey responses over the goal’s window_days lookback, so the surface never reports a stale figure. Use it to power a CX OKR widget; any authenticated member with analytics:read scope.

Get one satisfaction goal with live progress

GET /api/v1/analytics/satisfaction-goals/{id}
Returns a single satisfaction goal by id, hydrated with its live current value and progress (same computation as the list endpoint). Returns 404 when the id does not resolve to one of the org’s goals. Any authenticated member with analytics:read scope.
string
required
—

List scheduled analytics reports

GET /api/v1/analytics/scheduled-reports
Lists the organization’s scheduled reports — recurring digests (messaging_volume, deliverability, top_contacts, spend, or a custom saved query) emailed to a recipient list on a daily / weekly / monthly cadence (09:00 in the report’s IANA timezone, UTC when unset). Each row echoes last_sent_at, the display next_send_at and whether it is enabled. Keyset-paginated: pass cursor (the opaque nextCursor from the previous page) and limit (1–200, default 200). Any authenticated member with analytics:read scope.

Portfolio-level conversation sentiment analytics

GET /api/v1/analytics/sentiment
Rolls per-message sentiment (score in [-1, 1] plus positive/neutral/negative label) up across conversations into a CX portfolio view: a portfolio-wide totals roll-up, a chronological trend (hour buckets for 24h, day buckets otherwise), and breakdowns by_channel, by_agent, by_language, and by_resolution — each bucket carrying total, avg_score, the label counts, and a net_sentiment index in [-100, 100]. Query params: window (24h|7d|30d|90d, default 7d), optional channel and optional language (BCP-47 short code, e.g. en, es; unknown matches pre-enrichment messages). Use it to monitor experience week-on-week and find which channel, agent, or locale is degrading. Read-only; owner/admin/developer/viewer; 60s cached.

SMS click-through reporting parity panel

GET /api/v1/analytics/sms-click-through
Rolls the tracked short links in outbound SMS up to a per-campaign (or per-queue) click-through panel: sends, tracked_sends, sends_with_clicks, raw/unique/verified clicks, and both raw + verified CTR per bucket, plus aggregate totals and keyset pagination. Query params: group (campaign|queue, default campaign), window (24h|7d|30d, default 7d), page + pageSize (≤100, default 25). CTR denominators only count sends that actually carried a tracked link; click_rate is null when the bucket carried no tracked sends. Read-only; owner/admin/developer/viewer; 60s cached.

Telegram-specific KPIs

GET /api/v1/analytics/telegram
Returns the Telegram-only KPIs the generic per-channel rollups can’t express: totals (total_outbound, bot_blocked_count/rate — the share of sends the Bot API rejected with a 403 user-blocked/chat-not-found family error — and custom_emoji_count/rate), group_vs_dm (DM vs non-DM volume plus a per-chat-type breakdown over private/group/supergroup/channel), and a daily trend keyed by period. Accepts the shared date-range params (start_date/end_date or days). Use it for the Telegram KPI cards on the analytics dashboard. Read-only; owner/admin/developer/viewer; 60s cached.

Cross-channel topic & contact-reason intelligence

GET /api/v1/analytics/topic-intelligence
Answers “what are customers contacting us about, and is it rising or falling” across voice, SMS, WhatsApp, email, and web chat in one surface. Returns the window boundaries (current_since, previous_since), the current-window conversation count, and up to 50 trending topics — each with current vs prior volume, change_pct, a rising/falling/stable trend direction, the per-channel volume split, outcome rollups (avg_csat, deflection_rate, avg_aht_seconds), and up to 5 linked example threads. Query params: window (24h|7d|30d|90d, default 30d) and optional channel (voice|sms|whatsapp|email|web_chat). Read-only; owner/admin/developer/viewer; 60s cached.

Aggregate usage & delivery anomaly snapshot

GET /api/v1/analytics/usage-anomalies
Classifies each usage metric family (SMS throughput, SMS telco cost, voice throughput, voice telco cost) by comparing the last complete UTC hour against a learned hourly baseline, and flags a statistically-significant spike or drop. Each metric entry carries the current value, baseline mean/stddev, signed z-score, ratio, sample size, a status (spike|drop|normal|insufficient_data), and an anomalous flag; the snapshot also echoes computed_at, bucket_start, baseline_hours, and a summary count block. Use it to catch a tenant-wide traffic stall (broken integration) or a runaway cost surge that per-route detectors are too narrow to see. Read-only; owner/admin/developer/viewer; 60s cached.

Recent activity feed

GET /api/v1/stats/activity
Most recent platform activity for the tenant — messages, agent events, and webhook deliveries — newest first. Powers the home overview’s activity widget and the Insights → Logs viewer. Use ?limit= to size the feed (default 20, max 100) and ?since_hours to bound the server-side query to the trailing N hours (max 8760) so time-range controls re-query real history instead of re-slicing a fixed top-100 feed. An always-on widget — transient database availability degrades to an empty feed (200) rather than an error.
integer
Number of recent activity items to return (default 20, max 100).
integer
Optional window bound — only return activity from the trailing N hours.

Agent and conversation statistics

GET /api/v1/stats/agents
Aggregate statistics for AI agents and conversations: the total and active agent counts plus total and active conversation counts, as rendered by the Agents dashboard cards. Read-only; no query parameters.

Advanced message analytics

GET /api/v1/stats/analytics
Full advanced-analytics payload for the window: daily volume, the delivery funnel, channel and geographic breakdown, peak hours (with the tenant timezone they’re computed in), cost by channel, and top recipients. Use ?days= (default 30, max 365) or an explicit start_date / end_date pair to select the window. Requires the advanced-analytics feature flag; otherwise returns 403.
integer
Trailing window in days (default 30, capped at 365). An explicit start_date / end_date pair takes precedence over days.
string
Window start date in YYYY-MM-DD local tenant time. Must be used together with end_date.
string
Window end date in YYYY-MM-DD local tenant time. Must be used together with start_date.

Per-channel analytics breakdown

GET /api/v1/stats/analytics/channels
Message analytics broken down per channel (SMS, WhatsApp, email, voice) for the window: volume, delivery outcome, and spend per channel, as rendered by the analytics channel comparison view. Use ?days= (default 30, max 365) or an explicit start_date / end_date pair to select the window. Requires the advanced-analytics feature flag; otherwise returns 403.
integer
Trailing window in days (default 30, capped at 365). An explicit start_date / end_date pair takes precedence over days.
string
Window start date in YYYY-MM-DD local tenant time. Must be used together with end_date.
string
Window end date in YYYY-MM-DD local tenant time. Must be used together with start_date.

Delivery funnel for the window

GET /api/v1/stats/analytics/delivery
Message delivery funnel for the window: counts at each stage from sent through delivered / failed, as rendered by the analytics delivery-funnel chart. Use ?days= (default 30, max 365) or an explicit start_date / end_date pair to select the window. Requires the advanced-analytics feature flag; otherwise returns 403.
integer
Trailing window in days (default 30, capped at 365). An explicit start_date / end_date pair takes precedence over days.
string
Window start date in YYYY-MM-DD local tenant time. Must be used together with end_date.
string
Window end date in YYYY-MM-DD local tenant time. Must be used together with start_date.

Analytics summary for the window

GET /api/v1/stats/analytics/summary
Consolidated analytics for the window: total messages and sent / delivered / terminal / failed counts, failed-delivery count, contact count, wallet spend for the window, and the delivery rate. Use ?days= (default 30, max 365) or an explicit start_date / end_date pair to select the window; only the counts you need are returned — cheaper than the full analytics payload. Requires the advanced-analytics feature flag; otherwise returns 403.
integer
Trailing window in days (default 30, capped at 365). An explicit start_date / end_date pair takes precedence over days.
string
Window start date in YYYY-MM-DD local tenant time. Must be used together with end_date.
string
Window end date in YYYY-MM-DD local tenant time. Must be used together with start_date.

Daily message volume timeline

GET /api/v1/stats/analytics/volume
Daily message-volume timeline for the window — one entry per day with the sent and delivered counts — as rendered by the analytics volume chart. Use ?days= (default 30, max 365) or an explicit start_date / end_date pair to select the window. Requires the advanced-analytics feature flag; otherwise returns 403.
integer
Trailing window in days (default 30, capped at 365). An explicit start_date / end_date pair takes precedence over days.
string
Window start date in YYYY-MM-DD local tenant time. Must be used together with end_date.
string
Window end date in YYYY-MM-DD local tenant time. Must be used together with start_date.

Per-channel operational health

GET /api/v1/stats/channel-health
Operational health for each messaging and voice channel (SMS, WhatsApp, email, voice): the delivery- or connect-quality signal and status the Messages hub and home overview render as channel tiles. An always-on dashboard widget — transient database availability degrades to an empty list (200) rather than an error.

Contact count and growth statistics

GET /api/v1/stats/contacts
Contact-list statistics for the tenant: the total contact count, contacts created in the last 30 days, and the resulting growth rate, as rendered by the Contacts overview cards. Read-only; no query parameters.

Conversation intelligence analytics

GET /api/v1/stats/conversation-intelligence
AI-powered conversation analytics for the trailing window: aggregate totals, sentiment distribution, per-channel breakdown, agent leaderboard, time-series volume, and recent conversations. Use the optional ?days= query param (default 30, max 365) to widen or narrow the trailing window. Powers the dashboard Conversation Intelligence page; a handled 200 with empty aggregates renders like a fresh tenant.
integer
Trailing window in days (default 30, capped at 365).

Unified home-overview dashboard

GET /api/v1/stats/dashboard
All home-overview widgets in a single request: the summary (message / agent / API-call / spend counters), per-channel health, usage timeline, and recent activity are computed in parallel and returned as one payload. Use the optional ?days= query param (default 30, max 365) for the usage-timeline window. Prefer this over polling the four widget routes individually — each leg shares cache keys with those routes. An always-on read — transient database availability degrades to a zero-valued payload (200) rather than an error.
integer
Usage-timeline window in days (default 30, capped at 365).

Flow execution statistics

GET /api/v1/stats/flows
Automation flow statistics: the total flow and published-flow counts plus aggregate execution totals (total, successful, and failed executions) across all flows, as rendered by the Flows overview. Read-only; no query parameters.

SMS gateway operational health

GET /api/v1/stats/gateway/sms
Operational health of the outbound SMS gateway over a rolling 24 hours: a status verdict (operational / degraded / down), the gateway latency, the total / delivered / failed counts for that window, the genuine terminal failure rate, and the terminal delivery rate as a first-class field — so availability and delivery performance can be rendered as separate dimensions, as the SMS workspace header card does.

Phone number inventory statistics

GET /api/v1/stats/numbers
Phone-number inventory statistics for the tenant: the total number count, how many are active, and how many are SMS- or voice-capable. Powers the Numbers overview cards. Read-only; no query parameters.

API request logs for the tenant

GET /api/v1/stats/request-logs
Paginated API request logs for this tenant — the Developer → Request Logs viewer. Filter by method, status, path, api_key (API-key prefix), or request_id; bound the window with days or a start_date / end_date pair; page with cursor (and limit, max 100, default 50). Each entry carries timestamp, method, path, status, latency in ms, caller IP, user agent, request id, response size, and the W3C trace id for cross-system correlation.
integer
Page size (default 50, max 100).
string
Pagination cursor from a previous response’s next_cursor.
string
HTTP method filter (e.g. GET, POST).
string
HTTP status filter (e.g. 200, 4xx, 5xx).
string
Request path substring filter.
integer
Trailing window in days (capped at 365). An explicit start_date / end_date pair takes precedence.
string
Window start date in YYYY-MM-DD. Must be used together with end_date.
string
Window end date in YYYY-MM-DD. Must be used together with start_date.
string
API-key prefix filter — only requests made with keys matching this prefix.
string
Exact request correlation id — drill down to a single request.

SMS channel statistics

GET /api/v1/stats/sms
Aggregate SMS statistics for the tenant: total outbound messages, delivered and failed counts, the terminal delivery rate (delivered over delivered-plus-failed), and the average delivery latency in ms. Powers the SMS workspace overview cards. Read-only; no query parameters.

Dashboard summary cards

GET /api/v1/stats/summary
The six home-overview summary cards in one read: 24-hour message volume, active agents, total contacts, 24-hour API calls, today’s spend, and the overall success rate — each card carries its value plus the change versus the previous period where one is computed. Powers the top card row on the dashboard home. An always-on read — transient database availability degrades to zeroed cards (200) rather than an error.

Per-day usage timeline

GET /api/v1/stats/usage
Daily message-volume timeline across channels (SMS, WhatsApp, email, voice, agents) as rendered by the home-overview usage chart. Select the window with ?days= (default 30, max 365) or an explicit start_date / end_date pair — the explicit pair takes precedence. Each row carries date plus one counter key per channel. An always-on read — transient database availability degrades to an empty timeline (200) rather than an error.
integer
Trailing window in days (default 30, capped at 365). An explicit start_date / end_date pair takes precedence over days.
string
Window start date in YYYY-MM-DD. Must be used together with end_date.
string
Window end date in YYYY-MM-DD. Must be used together with start_date.

Voice call statistics

GET /api/v1/stats/voice
Aggregate voice statistics for the tenant: total calls split into inbound and outbound counts, plus the average call duration in seconds. Powers the Voice overview cards. Read-only; no query parameters.

WhatsApp channel statistics

GET /api/v1/stats/whatsapp
Aggregate WhatsApp statistics for the tenant: total conversations, sent and received message counts, the terminal delivery rate, and the read rate. Powers the WhatsApp workspace overview cards. Read-only; no query parameters.

Resolve a plain-English question to a governed widget

POST /api/v1/analytics/copilot/ask
Turns a natural-language question (body question, up to 500 chars) about messaging / voice / CDP data into a governed resolution: which dashboard-widget-catalog chart answers it and the resolved params to fetch it with. Deterministic — resolved to a pre-approved widget, never a synthesised query — so the answer always maps to an existing tenant-scoped read endpoint. Read-only (POST only because the question is a body); owner/admin/developer/viewer.

POST /api/v1/analytics/dashboards/share
Validates and normalises a draft dashboard layout, then signs it into an HMAC token delivering the layout snapshot inline, and returns the embed URL, the public JSON resolver URL, a copy-paste iframe snippet, and expiry. The unauthenticated public resolver renders the dashboard with the organization’s effective white-label branding — no Orbit session needed for recipients. Stateless; the two-week hard cap on ttl_days clamps the link lifetime. Body: the validate-layout shape, optionally wrapped as { layout, ttl_days, title }. Minting a public link to tenant analytics is gated to owner/admin.

Validate and normalise a dashboard layout

POST /api/v1/analytics/dashboards/validate
Stateless dry-run for the custom dashboard builder: validates a draft layout (name + widget placements) against the widget catalog, normalises grid coordinates, instance ids, and accepted widget params, and rejects out-of-catalog widgets, grid overflow, or excess widgets with 422. Use it for inline validation before a layout is saved or rendered. No write; read-only; owner/admin/developer/viewer.

Create a conversion goal

POST /api/v1/analytics/goals
Creates a conversion goal: give it a name and type (pixel_fire, webhook_hit, manual, tag_added, or custom_event), optionally a value per conversion, a lookback window (1-180 days, default 7), and an attribution model (last_touch default — also first_touch, linear, time_decay). For pixel_fire goals the response includes the signed pixel URL to embed. Owner/admin/developer role required.

Create backfill

POST /api/v1/analytics/goals/{id}/backfill
string
required
—

Record a conversion on a goal

POST /api/v1/analytics/goals/{id}/record
Fires a conversion on one goal. Server-to-server callers sign the contact id with HMAC-SHA256 (Authorization: HMAC <contact_id>:<signature>) — the signature is verified against the body’s contact id, otherwise the authenticated dashboard session supplies it. Optional body fields: contact_id, value_cents, metadata. Responds 401 when the HMAC check fails.
string
required
—

Create a KPI alert rule

POST /api/v1/analytics/kpi-alert-rules
Defines a self-serve alert over a cross-pillar KPI metric (csat, nps, ces, llm_spend, ai_containment). Body: { name, metric, mode, comparator?, threshold?, window_days?, notify_channels?, cooldown_hours?, enabled? }. Use mode: "threshold" for an explicit cutoff (needs comparator + threshold, e.g. < 80 on CSAT) or mode: "anomaly" to let the rule train on its own z-score baseline. Capped at 50 rules per organization (422 above that); the evaluator runs on a schedule and notifies via the requested channels. Owner/admin/developer role required; audit-logged. Returns the created rule (201).

Evaluate KPI alert rules on demand

POST /api/v1/analytics/kpi-alert-rules/evaluate
Runs every enabled KPI alert rule for this organization immediately instead of waiting for the scheduled evaluator tick — the “test my rule / re-check now” action behind the UI’s evaluate button. Resolves each enabled rule’s live metric value, fires notifications for breached rules that are past their cooldown, and returns the per-rule outcomes (status, current value) for the run. Owner/admin/developer role required.

Create a satisfaction goal

POST /api/v1/analytics/satisfaction-goals
Creates a satisfaction goal: a named target on one survey metric. Body: name (≤160 chars), metric (csat | nps | ces), target (range-checked against the metric’s native scale — CSAT 0–100, NPS −100..100, CES 0–10), optional survey_id (UUID; when set it must point at a LIVE survey whose type matches the metric, else 422 — a mismatched pointer would silently report zero forever; omit it for the tenant-wide aggregate over all surveys of that type), optional window_days (1–365, default 30) and enabled (default true). A tenant may hold at most 50 goals (they live on the org settings blob, not a table). The metric’s current value at creation is captured as the baseline — the progress origin. Requires owner / admin / developer; returns 201 with the created goal.

Create a scheduled analytics report

POST /api/v1/analytics/scheduled-reports
Schedules a recurring analytics report emailed to 1–50 recipients. Body: name (≤120 chars), type (messaging_volume | deliverability | top_contacts | spend | custom — custom runs the saved query in filters.saved_query, and filters.dataset may select a non-messaging dataset such as queue_performance), frequency (daily | weekly | monthly), recipients (array of emails or a single comma-separated string), optional filters, enabled (default true) and timezone (IANA zone the 09:00 cadence anchors to). The first send is scheduled on the next cadence tick. Requires owner/admin; returns 201 with the created report.

Send a scheduled report immediately

POST /api/v1/analytics/scheduled-reports/{id}/send-now
Marks one of the organization’s scheduled reports due NOW so the report dispatcher emails it to the recipient list on its next tick, instead of waiting for the next cadence tick — the UI polls last_sent_at to show delivery progress. The report is owned by the caller’s organization; returns 200 with { id, queued: true }, 404 when the id does not resolve. Supports the Idempotency-Key header. Requires owner/admin.
string
required
—

Update a goal

PATCH /api/v1/analytics/goals/{id}
Partially updates one conversion goal by id — name, type, config, value, lookback, attribution model, or enabled flag; at least one field is required. Body: name (1-160 chars), type (pixel_fire | webhook_hit | manual | tag_added | custom_event), config (free-form object; for tag_added goals it carries the tag that fires the goal), value_cents (non-negative integer minor units, or null to clear), lookback_days (1-180, the attribution window), attribution_model (last_touch | first_touch | linear | time_decay), enabled (boolean pause switch). The audit log records which keys changed. Responds 404 when the goal does not exist. Owner/admin/developer role required.
string
required
The goal id, as returned by POST /api/v1/analytics/goals.

Update a KPI alert rule

PATCH /api/v1/analytics/kpi-alert-rules/{id}
Partially updates one KPI alert rule (name, comparator, threshold, window_days, notify_channels, cooldown_hours, enabled). Any subset of fields may be sent, but a rule whose mode is “threshold” must keep a comparator and a finite threshold (422 otherwise); a bare empty body is rejected (422). Returns the updated rule DTO with registry display metadata. Owner/admin/developer role required; audit-logged.
string
required
—

Update a satisfaction goal

PATCH /api/v1/analytics/satisfaction-goals/{id}
Patches a satisfaction goal — name, target, survey_id, window_days and enabled are all optional but at least one must be provided. metric is immutable: a goal’s metric fixes its scale and the baseline captured at creation, so changing it would silently invalidate stored progress. The new target is range-checked against the STORED metric; a (re)pointed survey_id must resolve to a live survey of the same type, exactly as on create. Returns 404 for an unknown id. Requires owner / admin / developer; returns the updated goal with live progress.
string
required
—

Update a scheduled analytics report

PATCH /api/v1/analytics/scheduled-reports/{id}
Patches a scheduled report — every field of the create body (name, type, frequency, recipients, filters, enabled, timezone) is optional but at least one must be provided. Changing frequency re-anchors the cadence from the last send; the derived next tick can never land in the past. Requires owner/admin; returns the updated report.
string
required
—

Delete a goal

DELETE /api/v1/analytics/goals/{id}
Removes one conversion goal by id. The audit log records the deletion; existing conversion history on the goal’s other endpoints disappears with it. Responds 404 when the goal does not exist. Owner/admin/developer role required.
string
required
—

Delete a KPI alert rule

DELETE /api/v1/analytics/kpi-alert-rules/{id}
Removes one KPI alert rule by id; the evaluator stops evaluating it immediately and no further notifications fire for it. Returns { id, deleted: true } in the standard { data, meta } envelope, 404 when the id is unknown. Owner/admin/developer role required; audit-logged.
string
required
—

Delete a satisfaction goal

DELETE /api/v1/analytics/satisfaction-goals/{id}
Deletes a satisfaction goal so it stops tracking a CX target. Returns 200 with { id, deleted: true }; 404 when the id does not resolve to one of the org’s goals. Requires owner / admin / developer.
string
required
—

Delete a scheduled analytics report

DELETE /api/v1/analytics/scheduled-reports/{id}
Deletes a scheduled report owned by the caller’s organization so it stops emailing on its cadence. Returns 200 with { id, deleted: true }; 404 when the id does not resolve to one of the org’s reports. Requires owner/admin.
string
required
—

Worked sequences

The page above trims every operation past the fifteenth to cURL plus TypeScript. This section renders the first hero flow(s) past the cut in the full six-language group, so the operation a pipeline reaches next is copy-paste complete.

Aggregate conversion stats for one goal

Cross-channel customer-journey path (Sankey) analytics