v2
latestOpenAPI 3.1.02026-08-05267431678.1 KBGet Workspace Metrics
Return KPI metrics for the monitoring page.
Aggregates inference rows over the selected window and the immediately preceding window of equal length (for trend deltas), plus an all-time count for the caption. scope selects per-user vs active-team aggregation; the service explicitly filters inferences/requests by user_id or team_id — the service_role async engine bypasses Postgres RLS, so RLS cannot be relied on for tenant isolation.
Args: window: Rolling window key driven by the monitoring page picker. scope: personal (per-user) or team (active team) aggregation. auth: Authentication result carrying the user id used to scope every aggregate.
Returns: WorkspaceMetrics populated with current / previous / all-time counts, p99 / median latency, spend, and the open-issue tally. For window='all' the previous-window aggregates run against the same unbounded all-time range, so each *_previous field equals its current counterpart.
Query parameters
Rolling window for the KPI rollup, used only when since is omitted. 24h/7d/30d/90d produce a current window of that length plus a previous window of equal length for trend deltas. all runs both the current and previous aggregates against the unbounded all-time window.
Rolling window for the KPI rollup, used only when since is omitted. 24h/7d/30d/90d produce a current window of that length plus a previous window of equal length for trend deltas. all runs both the current and previous aggregates against the unbounded all-time window.
personal aggregates the requesting user's inferences; team aggregates the user's active team (every member sees the same totals). A team request from a user with no team degrades to personal scope rather than erroring.
personal aggregates the requesting user's inferences; team aggregates the user's active team (every member sees the same totals). A team request from a user with no team degrades to personal scope rather than erroring.
Inclusive start of an explicit custom window (UTC). When provided it overrides window; the previous window is the immediately preceding window of equal length.
Inclusive start of an explicit custom window (UTC). When provided it overrides window; the previous window is the immediately preceding window of equal length.
Exclusive end of the explicit window (UTC). Defaults to now.
Exclusive end of the explicit window (UTC). Defaults to now.
Response
Successful Response