Skip to main content
All routes require a Bearer token and are scoped to the caller’s organization.

Get KB analytics

Returns the analytics dashboard for a knowledge base. Pass a section to fetch a specific view; omit it for the default dashboard (usage stats + top chunks).

Query parameters

string
Which view to return. One of:
  • trends — query volume + average relevance over time
  • agents — per-agent usage breakdown
  • gaps — low-relevance / never-used queries
  • content — per-document utilization
  • costs — embedding + vector-store cost attribution
  • resource-performance — per-document impressions, thumbs up/down, helpfulness tier (outcome attribution)
  • feedback-gaps — queries that retrieved from the KB but earned a thumbs down, ranked by failure count
  • funnel — impression → click → conversion funnel with CTR / conversion rate
  • learning — learning-loop readiness: weighted signal score, per-source breakdown, stage unlocks, prior state
Omit to return the default dashboard.
integer
default:"30"
Trailing look-back window, in days. Applies to every section except learning, including the default dashboard. Non-positive or unparseable values fall back to 30; the value is clamped to a maximum of 3650.content applies the predicate on its LEFT JOIN rather than in WHERE, so documents with zero retrievals in the window stay listed (with a retrieval count of 0) instead of disappearing.learning deliberately ignores days and returns cumulative state: stages are lifetime unlocks and priorActive reflects an engagement prior computed over all-time signal. Windowing it would let one payload contradict itself and misreport which ranking model is in effect. Clients must label the learning view as all-time rather than wiring it to a date-range control.
string
Absolute range start, ISO 8601 UTC instant (e.g. 2026-01-01T00:00:00.000Z). When both startDate and endDate are valid and startDate < endDate, the server uses the half-open interval [startDate, endDate) instead of days. The span is clamped to 3650 days; invalid or reversed pairs gracefully fall back to the trailing days path.
string
Absolute range end, ISO 8601 UTC instant. Must be after startDate to take precedence over days.
integer
default:"10"
Number of top chunks in the default dashboard.

Response (200) — section=learning

object
Other sections return a single key named after the view — e.g. resourcePerformance, feedbackGaps, conversionFunnel, queryTrends, agentUsageBreakdown, knowledgeGaps, contentUtilization, costAttribution.

Response (200) — section=costs

object[]

Toggle the learned ranking prior

Turn the engagement-based ranking boost on or off for a knowledge base. On by default. Requires edit access to the knowledge base.
boolean
required
true to apply learning to ranking; false to keep manual control (semantic
  • keyword relevance + content weights only).

Response (200)

boolean
The new state.

Recompute the engagement prior

Queue a recompute of the engagement prior for this knowledge base’s organization (it otherwise refreshes on a schedule). Requires edit access. The work is batch-sized — an aggregation over the organization’s retrieval history plus one write per document — so this endpoint accepts it and returns immediately; the refresh runs on the same worker the schedule uses, which processes one refresh at a time. It does not report what it recomputed.

Response (202)

string
Identifier of the queued refresh. Repeated calls queue repeated refreshes; they run serially.

Errors

Knowledge base not found.
string
error — engagement-prior refresh is disabled on this instance (LEARNING_PRIOR_ENABLED=false), so no worker exists to run the refresh. Nothing was queued.
The effect of a refresh is visible through the analytics above once the job has run.