Skip to main content

Insights API

Insights endpoints exposed by the Devotel CPaaS API Base path: /api/v1/insights Endpoint count: 42

Worked insights queries

Every operation below is catalogued on this page, but the values you branch on — a spend spike’s driver, a containment trend, an anomaly scope — are easiest to learn as reader chains. The chains below answer a real operator question end to end and show the exact { data, meta } envelope at each step so you can slice the field path you actually need. Scope of this overlay:
  • Chains 1–6 cover the most-used reads head-first. Chains 7–11 pick up the GET operations those chains did not name — the remaining LLM-spend reads (overview, timeseries, top-conversations, by-feature, by-model, budget, model-caps), the agent comparison and per-language quality reads, and conversation P&L — each with the same send → envelope → drill-in shape.
  • All samples show cURL and TypeScript — the generated operations above show all six languages on the first 15 blocks, cURL and TypeScript on the rest.
  • Samples use a sandbox key (dv_test_sk_your_test_key_here). A test-prefixed key unconditionally runs in sandbox and deducts no credits; swap to your dv_live_sk_* key in production. See Sandbox.
  • All reads are tenant-scoped, read-only analytic aggregates over your own data. No provider account or compliance scope is touched; the tenant controls every filter, window, and scope parameter.
All Insights envelope responses share one shape: data carries the payload, meta.request_id and meta.timestamp identify the read. Chain on data, log meta.request_id when you report a discrepancy to support. The worked envelopes below use req_insights_* placeholders — a real response returns a server-issued id in the same shape.

1. Which model drove the LLM spend spike

Start from the period summary, drill into the breakdown by model, then confirm against cost-economics so you see spend in the same window as your other AI economics. GET /api/v1/insights/llm-spend/summary
200
Now drill into the driver. GET /api/v1/insights/llm-spend/by-model breaks spend per model; GET /api/v1/insights/llm-spend/by-feature breaks it per feature surface. Slice data.models[] (or data.features[]) for the rows that moved.
200
Put the spend in the same window as your AI economics: GET /api/v1/insights/cost-economics returns the platform side (provider and inference cost per conversation) so you can reconcile the spike against what those conversations actually cost the whole platform, not only the model tier.
200

2. Compare anomaly scopes and page history rollups

The anomaly surface answers “where did the spike come from?” — GET /api/v1/insights/anomaly-insights/by-scope ranks the affected scopes (feature, model, agent, channel) so you slice against the right dimension before paging the ledger.
200
Page the anomaly ledger — GET /api/v1/insights/anomaly-insights/history returns a cursor-paged list. Pass the previous page’s next token back as cursor until it comes back null.
200

3. Benchmark and QA sample queries

Score before/after comparisons on a benchmark — GET /api/v1/insights/ agent-benchmarks returns a ranked list of quality/funnel scores so you compare two AI agents, two model versions, or your agent against a human queue.
200
For QA follow-ups, the GET /api/v1/insights/agent-quality/by-language endpoint breaks the same score down per conversation language, and GET /api/v1/insights/language-quality ranks phrasing/coverage issues — slice data.rows[] to the sample conversations you want to re-check.

4. Attribution: funnel steps → journey paths → conversion goal

Attribution chains answer “which step dropped the funnel?” — GET /api/v1/insights/call-attribution attributes conversion credit to call and message touches, GET /api/v1/insights/automation-opportunities ranks the funnel steps where automation covers the drop, and GET /api/v1/insights/agent-roi/timeseries trends goal conversion over the window.
200
Drill into the step that dropped with GET /api/v1/insights/automation- opportunities — it returns candidate funnel steps ranked by the recoverable volume per step.
200
Trend the goal with GET /api/v1/insights/agent-roi/timeseries — data.points[] carries the per-bucket conversion so you can chart the recovery against the anomaly window you paged in chain 2.

5. Containment trend + talk ratio

Containment answers “how many conversations resolve without a human?” — GET /api/v1/insights/containment returns the current rate, then GET /api/v1/insights/containment/timeseries trends the same metric over the window so you see whether a prompt or KB change moved it.
200
200

6. Quality eval scores

Voice and conversation quality evals answer “is the agent answering well?” — GET /api/v1/insights/sales-conversation-intelligence returns the latest scored conversations and their eval dimensions (rapport, coverage, objection handling). Pair with GET /api/v1/insights/containment from chain 5 to see whether a low eval score also pushed the transfer rate up. For segment-level eval detail, follow with GET /api/v1/insights/agent-quality/by-language (chain 8) — it breaks rubric pass-rate, containment, and sentiment down per detected language so you can isolate a quality gap to one locale.
200

7. Read the LLM-spend header, trend, and leaderboard

The LLM-spend header chain answers “where do I stand right now?” — the chain 1 aggregates answered “what drove the spike?”; this one reads the header cards, the trend buckets, and the expensive-conversation leaderboard that the overview page renders. Start with the header: GET /api/v1/insights/llm-spend/overview returns today’s spend, the month-to-date total with a month-end projection, and the trailing-7-day average — three fields intentionally return null when a value is not computable (no daily cap configured, no prior-period baseline, no spend history), so branch on null before you chart.
200
Trend it with GET /api/v1/insights/llm-spend/timeseries — bucketed hourly or daily, in the org’s billing timezone:
200
Find where the spend concentrates with GET /api/v1/insights/llm-spend/top-conversations — a per-conversation leaderboard for the window, cheapest drill for “one thread ate my budget”:
200
Slice the same window by feature/channel with GET /api/v1/insights/llm-spend/by-feature — it also returns your budget config and any per-channel threshold breaches in the same envelope:
200

8. Compare agents and isolate a quality gap by language

The comparison chain answers “which of my agents is the better value?” — GET /api/v1/insights/agent-comparison ranks two or more agents side by side against the org average on cost, attributed revenue, margin, containment, resolution, and escalation. Pass agentIds as a comma- separated list of at least two agents.
200
When the comparison shows a quality gap, drill per locale with GET /api/v1/insights/agent-quality/by-language (rubric eval pass-rate, containment, sentiment, CSAT per detected language) — or with the window-level GET /api/v1/insights/language-quality when you want the same segmentation without the per-agent filter (chain 3 named it; the worked envelope here applies to both):
200

9. Read the spend caps before you raise them

The config reads answer “what caps are in force?” — GET /api/v1/insights/ llm-spend/budget returns the persisted budget blob (monthly/daily caps, per-channel thresholds, the soft-alert percentage, and the automatic model downshift toggle), GET /api/v1/insights/llm-spend/model-caps returns the per-model spend caps, and GET /api/v1/insights/agent-roi/config / GET /api/v1/insights/conversation-pnl/config / GET /api/v1/insights/cost-economics/config return the per-surface config the PUT endpoints on this page write. Read the config before you compose a PUT body — every PUT on this page is a read-merge-write against its GET envelope.
200
200

10. Cost to serve: conversation P&L

GET /api/v1/insights/conversation-pnl blends telco, LLM, and human-agent labour into one cost-to-serve per conversation, per resolution, and per conversion — answer “what does a conversation actually cost me to run?” with a blended number, not a channel invoice. The labour rate comes from GET /api/v1/insights/conversation-pnl/config (the PUT on this page sets it), and the unit economics divide the SAME blended total by each volume denominator.
200

11. Platform-side economics to pair with spend

GET /api/v1/insights/cost-economics returns the platform cost side (provider telephony + inference per conversation) in the same window, so a margin report pairs the revenue surfaces (chains 4 and 10) against what the traffic costs the platform. Rate overwrites live under GET/PUT /api/v1/insights/cost-economics/config.
200

Pagination and envelope rules

  • Config writes echo the config. PUT on a */config route (and on the LLM-spend budget / model-caps routes) returns the new config object in the same shape GET reports, not an empty body — data.human_agent_cost_per_hour_cents, data.model_caps_cents, or the full data.config block. Some OpenAPI documenters show a 202 for an accepted PATCH/PUT with no payload; chain on data from the response shown on this page, which the generator fills from the route’s actual controller echo even when the spec carries only 2xx.
  • Cursor pages. Ledger-style list endpoints return data.items + data.next. Pass cursor=<next> to fetch the following page; null terminates the sequence. Page size defaults are stated on each operation; keep the same filters across pages.
  • Slice fields. Filter parameters are the tenant surface: window_days, metric, scope, goal, bucket. Chain 2 shows the cursor loop; every other chain shows the filter-slice.
  • The { data, meta } envelope. Branch on data; log meta.request_id when a value looks wrong — support can replay it.

Error shapes: scope gap vs parameter issue

Failures come back in the { error, meta } envelope — branch on error.code, and quote meta.request_id when you escalate. Two non-success shapes recur across every Insights operation:
403
422
The dashboard views and per-surface readings live in Insight dashboards, Real-time analytics, Insight costs, and the LLM spend guide. This overlay is envelope-accurate: request, response, and the drill-in call — nothing else.
For the dashboard-side walkthrough of the surfaces these endpoints feed, see the Insights guides. Compliance notes: every filter and scope on this page is a tenant-owned control — nothing here touches provider account scope or sends traffic.

Benchmark agents against the org population

GET /api/v1/insights/agent-benchmarks
Returns per-metric percentile, rank, and performance band for each AI agent versus the organisation’s agent population (cost, attributed revenue, margin, containment, resolution, escalation). The window defaults to the last 30 days (from/to, max 365 days); pass agentIds to restrict the comparison population.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Compare AI agents side by side

GET /api/v1/insights/agent-comparison
Ranks two or more AI agents against each other and the organisation average on the KPIs already computed per agent (cost, attributed revenue, margin, containment, resolution, escalation). Pass agentIds as a comma-separated list of at least two agents; the window defaults to the last 30 days and from/to accept ISO 8601 datetimes bounded to 365 days.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Agent quality segmented by detected language

GET /api/v1/insights/agent-quality/by-language
Segments the AI-agent quality signals (containment, resolution, rubric eval pass-rate, CSAT, sentiment) by the conversation’s detected language, so a multilingual team can spot the locale the bot handles worse than English. The window defaults to the last 30 days (from/to, max 365 days); limit bounds the displayed language rows (totals are always computed across the full set).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get per-agent ROI summary

GET /api/v1/insights/agent-roi
Joins LLM cost and outcome-evaluation data into a per-agent return-on-investment table: cost, attributed revenue (from configurable per-outcome values), and margin. All money fields are integer cents. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days); limit caps the agent rows (≤200).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get ROI attribution configuration

GET /api/v1/insights/agent-roi/config
Returns the outcome-value attribution configuration the per-agent ROI table is computed with: the default value of one resolved conversation and any per-rubric overrides (integer cents). Workspaces that never configured these see the defaults (null default, empty overrides), so a settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get the daily ROI trend

GET /api/v1/insights/agent-roi/timeseries
Returns the daily cost, attributed revenue, and margin trend (integer cents) for the ROI dashboard chart. Defaults to the last 30 days (from/to ISO datetimes, max 365 days); pass agentId to scope the trend to one agent instead of the org-wide aggregate.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Aggregate anomaly ledger by scope

GET /api/v1/insights/anomaly-insights/by-scope
Rolls the spend-forensics anomaly ledger (wallet-burn and webhook anomalies) up per scope group — wallet, webhook, and all-total — with open and severity counts. Filter with ?scope=wallet|webhook; the window defaults to the last 30 days (days, or from/to ISO datetimes, up to 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

List anomaly ledger items

GET /api/v1/insights/anomaly-insights/history
Returns the individual spend-forensics anomaly items (category, severity, status, summary, detection time) for the forensic drill-down table, newest first. Filter with ?scope=wallet|webhook and page with ?limit (≤100 per page); the window defaults to the last 30 days (days, or from/to ISO datetimes, up to 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Anomaly counts over time

GET /api/v1/insights/anomaly-insights/timeseries
Buckets the spend-forensics anomaly ledger into a zero-filled per-day histogram (one count per UTC day per requested scope) for the dashboard trendline. Filter with ?scope=wallet|webhook; the window defaults to the last 30 days (days, or from/to ISO datetimes, up to 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

List ranked automation opportunities

GET /api/v1/insights/automation-opportunities
Mines the organisation’s cross-channel conversation corpus and ranks the contact reasons worth automating next — each with a projected deflection volume, projected monthly savings (integer cents), and a scaffold suggestion ready for a one-click build. Tune the ROI assumptions via /automation-opportunities/config. The window defaults to the last 30 days (from/to, max 365 days); limit caps the returned opportunity count.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get automation ROI assumptions

GET /api/v1/insights/automation-opportunities/config
Returns the ROI assumptions the Automation Opportunity Miner uses to project savings: human agent cost per hour, automation cost per contact, target deflection rate, default handle time, and the minimum monthly volume a reason needs to qualify. Workspaces that never configured these see the defaults, so the settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get inbound-call marketing attribution

GET /api/v1/insights/call-attribution
Rolls inbound calls, answer rate, and duration up by marketing source by joining the organisation’s call-tracking pools to inbound call logs at read time — the CallRail/Invoca-style ‘which campaign drove this call’ report. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get AI-agent containment summary

GET /api/v1/insights/containment
Reports the share of AI-agent conversations the bot handled without a human handoff (containment) and the share that reached a resolved status or passed a rubric outcome (resolution), per agent and org-wide. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days); limit caps the agent rows (≤200).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get the daily containment trend

GET /api/v1/insights/containment/timeseries
Returns the daily containment and resolution trend for the dashboard chart. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days); pass agentId to scope the trend to one agent instead of the org-wide aggregate.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get blended cost-to-serve summary

GET /api/v1/insights/conversation-pnl
Joins telco spend (call/message price), AI-agent LLM spend, and human-agent handle time priced at a configurable hourly rate into one cost-to-serve figure, then divides by conversations, resolutions, and conversions. All money fields are integer cents. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get P&L labour-rate configuration

GET /api/v1/insights/conversation-pnl/config
Returns the human-agent hourly rate (integer cents) used to price handle time in the cost-to-serve roll-up. Workspaces that never configured a rate see null, meaning the platform default applies, so the settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get cross-channel unit economics

GET /api/v1/insights/cost-economics
Rolls per-message (SMS/WhatsApp), per-minute (voice/video), and per-1k-token (AI) usage into one margin and unit-economics view across the organisation’s channels. Money is integer cents; per-unit ratios read null when the channel’s volume is zero. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get cost-economics rate configuration

GET /api/v1/insights/cost-economics/config
Returns the per-unit rate overrides configured for the cost-economics view — SMS/WhatsApp per message, voice/video per minute, AI per 1,000 tokens (all integer cents, each nullable). Fields the workspace never set come back null, meaning the platform reference rate applies.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get KB auto-draft configuration

GET /api/v1/insights/kb-auto-draft/config
Returns the closed-loop knowledge-base auto-draft settings: whether the miner is enabled and the maximum drafts filed per run. Workspaces that never opted in see the defaults, so the settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get language-segmented quality summary

GET /api/v1/insights/language-quality
Segments the containment, resolution/escalation, sentiment, and CSAT quality signals by the conversation’s detected language so a multilingual team can find the locale the bot handles worse than another. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get AI budget configuration

GET /api/v1/insights/llm-spend/budget
Returns the workspace’s AI-spend guardrails — monthly and daily caps (integer cents, nullable), the alert threshold percentage, per-channel thresholds, and the configured automatic model-downshift policy. Workspaces that never set a config see their stored defaults, so the settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get AI spend by feature

GET /api/v1/insights/llm-spend/by-feature
Aggregates AI spend per feature channel (calls, messaging, agents, and other AI surfaces) so operators can see which product area is driving cost, alongside the org’s budget config and any threshold breaches — the whole panel in one roundtrip. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get AI spend by model

GET /api/v1/insights/llm-spend/by-model
Aggregates AI spend per model with what each model costs Devotel (COGS) versus what the workspace is billed, exposing per-model margin, alongside the org’s per-model cap config and any cap breaches — the whole panel in one roundtrip. All money fields are integer cents. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get per-model spend caps

GET /api/v1/insights/llm-spend/model-caps
Returns the per-model AI-spend cap map (model id → integer cents). A workspace that never set model-level caps gets an empty map, so the settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get AI-spend headline stats

GET /api/v1/insights/llm-spend/overview
Returns the LLM-spend dashboard header — total spend, per-day trend, and the configured daily/monthly cap so the panel can render the cap-progress ring and percentage-used badge. All money fields are integer cents.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get grouped AI-spend summary

GET /api/v1/insights/llm-spend/summary
Aggregates AI spend over a window grouped by agent, model, or conversation. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days); groupBy picks the grouping (default agent) and limit (≤200) caps the group rows. All money fields are integer cents.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get AI-spend trend buckets

GET /api/v1/insights/llm-spend/timeseries
Returns AI spend bucketed for the dashboard chart. Hour-grain buckets are capped to a 14-day window; switch to granularity=day for longer ranges (max 365 days). The window defaults to 30 days at day-grain or 7 days at hour-grain. All money fields are integer cents.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get top-spending conversations

GET /api/v1/insights/llm-spend/top-conversations
Ranks the most expensive AI conversations over the window so operators can drill into outlier conversations driving the org’s AI spend. The window defaults to the last 30 days (from/to ISO datetimes, max 365 days); limit (≤50) caps the returned rows. All money fields are integer cents.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get no-match miner configuration

GET /api/v1/insights/no-match-questions/config
Returns the no-match query miner’s per-workspace settings: whether the miner is enabled, the conversation volume a mapped reason must reach before it surfaces, the transcript count an unknown-topic cluster needs, and the maximum suggestions per run. Workspaces that never opted in see the defaults (enabled: false), so the settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get sales conversation intelligence summary

GET /api/v1/insights/sales-conversation-intelligence
Rolls the post-call sales-intelligence analysis up across voice calls: average rep talk-ratio, the deal-risk band distribution, top competitor mentions, and the at-risk deal rollup per contact with the latest next steps. Tune the lookback with ?days (1–90, default 30). Configure the feature flag and competitor tracker terms via /sales-conversation-intelligence/config.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Get sales intelligence configuration

GET /api/v1/insights/sales-conversation-intelligence/config
Returns the sales conversation intelligence settings: whether the per-call analyzer is enabled and the competitor tracker terms matched against call transcripts. Workspaces that never configured the feature see the defaults, so the settings form always renders a stable shape.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Run the KB auto-draft miner

POST /api/v1/insights/kb-auto-draft/run
Triggers the knowledge-base auto-draft miner immediately (independent of the schedule). Draft articles are built from real mined conversation excerpts and filed as pending documents in the draft knowledge base awaiting human approval. Returns the run report. Requires the owner, admin, or developer role.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Run the no-match query miner

POST /api/v1/insights/no-match-questions/run
Triggers the no-match query miner for this workspace immediately (independent of the schedule). Mined coverage gaps become draft KB articles filed to the pending-approval pool plus exemplar-candidate and unknown-topic advisories; an explicit run counts as the opt-in consent the scheduled gate requires. Returns the run report. Requires the owner, admin, or developer role.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Update ROI attribution configuration

PUT /api/v1/insights/agent-roi/config
Replaces the outcome-value attribution configuration used by the per-agent ROI table. Fields are optional and merged with the current values (read-merge-write); pass default_outcome_value_cents: null to clear the default and per_rubric_value_cents as a rubric-id → integer-cents map (≤500 overrides). No money moves on this call — the values only change how outcome revenue is attributed. The updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
integer
Default attributed value of one resolved outcome, in integer cents (null clears the default).
object
Per-rubric attributed values in integer cents, keyed by rubric id (at most 500 overrides).

Update automation ROI assumptions

PUT /api/v1/insights/automation-opportunities/config
Replaces the ROI assumptions the Automation Opportunity Miner uses to project savings. Send a partial body with at least one field; omitted fields keep their current values and the updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
integer
Human agent cost per hour, integer cents.
integer
Automation cost per handled contact, integer cents.
number
Target deflection rate as a fraction between 0 and 1.
integer
Default average handle time in seconds used when no measured value exists.
integer
Minimum monthly contact volume a reason needs to qualify as an opportunity.

Update P&L labour-rate configuration

PUT /api/v1/insights/conversation-pnl/config
Replaces the human-agent hourly rate used to price handle time in the conversation P&L roll-up. Send a partial body; omitted fields keep their current values, and null clears the override back to the platform default. The updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
integer
Hourly rate used to price human-agent handle time, in integer cents (null clears the override).

Update cost-economics rate configuration

PUT /api/v1/insights/cost-economics/config
Replaces the per-unit rate overrides used by the cost-economics view. Send a partial body; omitted fields keep their current values and any field set to null falls back to the platform reference rate. The updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
integer
SMS cost per message, integer cents (null clears the override).
integer
WhatsApp cost per message, integer cents (null clears the override).
integer
Voice cost per minute, integer cents (null clears the override).
integer
AI cost per 1,000 tokens, integer cents (null clears the override).
integer
Video cost per minute, integer cents (null clears the override).

Update KB auto-draft configuration

PUT /api/v1/insights/kb-auto-draft/config
Replaces the knowledge-base auto-draft settings. Send a partial body with at least one field — enabled to toggle the miner, max_drafts_per_run to bound the drafts per run; omitted fields keep their current values and the updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
boolean
Whether the auto-draft miner runs for this workspace.
integer
Maximum draft articles filed per run.

Update AI budget configuration

PUT /api/v1/insights/llm-spend/budget
Replaces AI-spend guardrails: monthly/daily caps (integer cents, use null to remove a cap), alert threshold percentage, and the automatic model-downshift policy. Send a partial body; omitted fields keep their current values (read-merge-write). The updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
integer
Monthly AI-spend cap in integer cents (null removes the cap).
integer
Daily AI-spend cap in integer cents (null removes the cap).
integer
Advisory monthly cap for speech-to-text spend, integer cents (null removes it).
object
Per-channel threshold map (channel name → integer cents).
integer
Percentage of cap at which an alert trips (1–100).
object
—
number
required
Hard daily spend ceiling in USD cents. Refuses LLM enqueue past the threshold; 200 = $2.00/day.
number
Optional monthly ceiling in USD cents (resets on the 1st). When omitted, only the daily cap applies.
number
Percent (10–99) at which a budget-exhausting advisory webhook fires before the hard cap.

Update per-model spend caps

PUT /api/v1/insights/llm-spend/model-caps
Replaces the per-model AI-spend cap map. Send a partial body; when model_caps_cents is omitted the currently persisted caps are kept (read-merge-write). The updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
object
Map of model id → cap in integer cents. Omitted keeps the current caps.

Update no-match miner configuration

PUT /api/v1/insights/no-match-questions/config
Replaces the no-match query miner’s settings. Send a partial body with at least one field — enabled toggles the scheduled miner, min_volume and min_cluster_volume set the floors a no-match reason or unknown-topic cluster must reach to surface, max_suggestions (≤50) bounds the results per run; omitted fields keep their current values and the updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
boolean
Whether the no-match miner runs for this workspace (default false).
integer
Conversation volume a mapped reason must reach before it surfaces.
integer
Distinct transcripts an unknown-topic cluster needs before it surfaces.
integer
Maximum clusters and suggestions returned per run (≤50).

Update sales intelligence configuration

PUT /api/v1/insights/sales-conversation-intelligence/config
Replaces the sales conversation intelligence settings. Send a partial body with at least one field — enabled toggles the per-call analyzer, competitor_trackers is the list of competitor terms matched against transcripts (≤50 terms, ≤64 characters each); omitted fields keep their current values and the updated, persisted configuration is returned.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests — see Test mode explained for the full credential-header matrix and worked samples. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
boolean
Whether the per-call sales-intelligence analyzer runs for this workspace.
string[]
Competitor tracker terms matched against call transcripts (≤50 terms, ≤64 characters each).

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.

Get P&L labour-rate configuration

Get cross-channel unit economics