Skip to main content

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:
  • The chains cover six questions against the Insights catalogue; each one starts from the broad read, then narrows with a follow-up call. Where a dashboard guide exists, the overlay links it rather than repeat it.
  • 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.
  • 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.

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/timeseriesdata.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.
200

Pagination and envelope rules

  • 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.
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.