KPI aggregate for the users list stats strip
VIEWER+. Four KPIs scoped to the caller's active org: total tracked users, online now, active in last 24 h, new this week. Single SQL round-trip via `$queryRaw` with conditional aggregation + a `LATERAL` join to resolve `MAX(Session.endedAt)` per user.
/api/tracked-users/summaryVIEWER+. Four KPIs scoped to the caller's active org: total tracked users, online now, active in last 24 h, new this week. Single SQL round-trip via $queryRaw with conditional aggregation + a LATERAL join to resolve MAX(Session.endedAt) per user.
Response Body
application/json
curl -X GET "https://loading/api/tracked-users/summary"{
"total": 312,
"onlineNow": 8,
"active24h": 47,
"newThisWeek": 21
}Sessions timeline in a rolling window GET
VIEWER+. `?range=` matches the activity histogram (`6h` / `24h` / `7d`). Server computes `from = now - windowMs` itself — sending raw ISO from the client would shift the TanStack Query key on every render. Sessions overlap the window if they `startedAt ≤ to AND (endedAt ≥ from OR endedAt IS NULL)`.
Signed-in user's full profile GET
Returns name + email + avatar + linked OAuth accounts + registered passkeys. Powers the settings page's connect / disconnect / rename affordances.