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.
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
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’snextCursor back as
cursor, and stop when it comes back null.
GET /api/v1/analytics/goals
200
cursor=cur_8Kw2mQ1z; when this page’s nextCursor is null
you have the full set:
200
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
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 returns422 VALIDATION_ERROR
with error.details.issues listing each rejected field — for example a
group_by outside the allowed set (hour / day / week / month):
422
403 INSUFFICIENT_PERMISSIONS and a message naming the accepted roles:
403
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 baredata 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 reportsdelivered 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 aprogress 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-goalsreturns{ 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-goalscreates a goal — body:name,metric(csat|nps|ces),targetwithin the metric’s scale, optionalsurvey_id,window_days(1–365, default 30),enabled— and returns201with the goal object; the baseline is captured from live responses at creation.PATCH /api/v1/analytics/satisfaction-goals/{id}updates any ofname,target,survey_id,window_days,enabled(at least one;metricis immutable) and returns200with the recomputed goal object.DELETE /api/v1/analytics/satisfaction-goals/{id}stops tracking the target and returns200with:
200
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/attributionfirst_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/benchmarkschannel, 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/carbonstart_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/exporttext/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-reasonswindow, 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-conversationstart / 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/costsstart_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/widgetssource 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/deliverabilitychannel (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-centerissues 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-waterfallgroup (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-reasonsstep: 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.
List conversion goals
GET /api/v1/analytics/goalslimit (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}pixel_fire goals — the signed pixel URL to embed on your site. Responds 404 when the goal does not exist. Read-only.
List a goal’s conversions
GET /api/v1/analytics/goals/{id}/conversionslimit (1-500, default 100). Use it to inspect exactly which conversions a goal recorded instead of only the aggregated counts. Read-only.
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}/statswindow_days (1-365, default 30). Use it to see which of your sends actually drive conversions. Read-only.
Cross-channel customer-journey path (Sankey) analytics
GET /api/v1/analytics/journey-pathsnodes (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{ data, meta } envelope with data.items + data.total.
List fired KPI alert events
GET /api/v1/analytics/kpi-alert-rules/events{ data, meta } envelope with data.items + data.total.
Aggregate message delivery metrics with time series
GET /api/v1/analytics/messagesstart_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-channelphone_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-countrychannel 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/errorschannel filter. Use this to triage quality issues before they become a deliverability problem.
Account-level messaging health score
GET /api/v1/analytics/messaging-health-scoreinsufficient 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-insightschannel (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-deliverybuckets 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-deliverymetadata._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-anomalyprovider × 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-sloprovider × 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-goalswindow_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}analytics:read scope.
List scheduled analytics reports
GET /api/v1/analytics/scheduled-reportslast_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/sentimenttotals 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-throughgroup (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/telegramtotals (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-intelligencecurrent_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-anomaliesspike 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?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.
Agent and conversation statistics
GET /api/v1/stats/agentsAdvanced message analytics
GET /api/v1/stats/analytics?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.
Trailing window in days (default 30, capped at 365). An explicit
start_date / end_date pair takes precedence over days.Per-channel analytics breakdown
GET /api/v1/stats/analytics/channels?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.
Trailing window in days (default 30, capped at 365). An explicit
start_date / end_date pair takes precedence over days.Delivery funnel for the window
GET /api/v1/stats/analytics/delivery?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.
Trailing window in days (default 30, capped at 365). An explicit
start_date / end_date pair takes precedence over days.Analytics summary for the window
GET /api/v1/stats/analytics/summary?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.
Trailing window in days (default 30, capped at 365). An explicit
start_date / end_date pair takes precedence over days.Daily message volume timeline
GET /api/v1/stats/analytics/volume?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.
Trailing window in days (default 30, capped at 365). An explicit
start_date / end_date pair takes precedence over days.Per-channel operational health
GET /api/v1/stats/channel-healthContact count and growth statistics
GET /api/v1/stats/contactsConversation intelligence analytics
GET /api/v1/stats/conversation-intelligence?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.
Unified home-overview dashboard
GET /api/v1/stats/dashboard?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.
Flow execution statistics
GET /api/v1/stats/flowsSMS gateway operational health
GET /api/v1/stats/gateway/smsPhone number inventory statistics
GET /api/v1/stats/numbersAPI request logs for the tenant
GET /api/v1/stats/request-logsmethod, 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.
Trailing window in days (capped at 365). An explicit
start_date / end_date pair takes precedence.SMS channel statistics
GET /api/v1/stats/smsDashboard summary cards
GET /api/v1/stats/summaryPer-day usage timeline
GET /api/v1/stats/usage?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.
Trailing window in days (default 30, capped at 365). An explicit
start_date / end_date pair takes precedence over days.Voice call statistics
GET /api/v1/stats/voiceWhatsApp channel statistics
GET /api/v1/stats/whatsappResolve a plain-English question to a governed widget
POST /api/v1/analytics/copilot/askquestion, 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.
Mint a signed embeddable dashboard share link
POST /api/v1/analytics/dashboards/sharettl_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/validateCreate a conversion goal
POST /api/v1/analytics/goalspixel_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}/backfillRecord a conversion on a goal
POST /api/v1/analytics/goals/{id}/recordAuthorization: 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.
Create a KPI alert rule
POST /api/v1/analytics/kpi-alert-rules{ 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/evaluateCreate a satisfaction goal
POST /api/v1/analytics/satisfaction-goalsname (≤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-reportsname (≤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-nowlast_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.
Update a goal
PATCH /api/v1/analytics/goals/{id}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.
Update a KPI alert rule
PATCH /api/v1/analytics/kpi-alert-rules/{id}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.
Update a satisfaction goal
PATCH /api/v1/analytics/satisfaction-goals/{id}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.
Update a scheduled analytics report
PATCH /api/v1/analytics/scheduled-reports/{id}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.
Delete a goal
DELETE /api/v1/analytics/goals/{id}Delete a KPI alert rule
DELETE /api/v1/analytics/kpi-alert-rules/{id}{ id, deleted: true } in the standard { data, meta } envelope, 404 when the id is unknown. Owner/admin/developer role required; audit-logged.
Delete a satisfaction goal
DELETE /api/v1/analytics/satisfaction-goals/{id}{ id, deleted: true }; 404 when the id does not resolve to one of the org’s goals. Requires owner / admin / developer.
Delete a scheduled analytics report
DELETE /api/v1/analytics/scheduled-reports/{id}{ id, deleted: true }; 404 when the id does not resolve to one of the org’s reports. Requires owner/admin.