Statistics
Member statistics: totals, growth over time, role distribution and overlap across servers, with CSV and JSON export.
Cross-server member overlap
/api/admin/stats/cross-serverMembers present in more than one managed server, plus pairwise overlap counts between every pair of servers. Results are cached for 5 minutes.
Authentication: Admin session token (Authorization: Bearer <token>)
Responses
| Status | Description | Body |
|---|---|---|
200 | Cross-server overlap statistics. | any |
401 | Authentication required. | |
403 | System Admin access required. |
Open in Swagger (opens in a new tab)
Export a statistics report as CSV or JSON
/api/admin/stats/exportExports the same data as the corresponding read endpoint (members, growth, roles, servers, cross-server) as a file download. serverId is required when type=roles.
Authentication: Admin session token (Authorization: Bearer <token>)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | query | "members" or "growth" or "roles" or "servers" or "cross-server" | yes | Which statistics report to export |
format | query | "csv" or "json" | no | Export format |
serverId | query | string | no | Server to scope the export to. Required when type=roles; optional filter for members/growth. |
dateRange | query | "7d" or "30d" or "90d" or "1y" | no | Window for members/growth exports |
Responses
| Status | Description | Body |
|---|---|---|
200 | File download (CSV or JSON). | |
400 | Invalid query parameters, or missing serverId for type=roles. | |
401 | Authentication required. | |
403 | System Admin access required. |
Open in Swagger (opens in a new tab)
Aggregate member statistics
/api/admin/stats/membersAggregate counts only, never individual member data. activeMembers counts members whose server presence was reconfirmed by sync (or, absent that, who joined) within activityThresholdDays (configurable via MEMBER_ACTIVITY_THRESHOLD_DAYS, default 30). growthRate = newMembersThisPeriod / (totalMembers - newMembersThisPeriod) * 100. Results are cached for 5 minutes.
Authentication: Admin session token (Authorization: Bearer <token>)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
serverId | query | string | no | Filter all metrics to a single server |
dateRange | query | "7d" or "30d" or "90d" or "1y" | no | Window for new-member / growth-rate metrics |
Responses
| Status | Description | Body |
|---|---|---|
200 | Member statistics. | any |
400 | Invalid query parameters. | |
401 | Authentication required. | |
403 | System Admin access required. |
Open in Swagger (opens in a new tab)
Member growth over time
/api/admin/stats/members/growthNew members are bucketed by createdAt (when the record entered the system); departures are bucketed by leftAt; count is the cumulative member total at each bucket. trend compares the second half of the series against the first half. Results are cached for 5 minutes.
Authentication: Admin session token (Authorization: Bearer <token>)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
serverId | query | string | no | Filter growth to a single server |
period | query | "7d" or "30d" or "90d" or "1y" | no | Time window |
granularity | query | "daily" or "weekly" or "monthly" | no | Bucket size |
Responses
| Status | Description | Body |
|---|---|---|
200 | Growth series. | any |
400 | Invalid query parameters. | |
401 | Authentication required. | |
403 | System Admin access required. |
Open in Swagger (opens in a new tab)
Role distribution (scoped or cross-server)
/api/admin/stats/rolesMember count per role for the given server (when serverId is provided, ordered by position), or aggregated across all servers merged by role name (when serverId is omitted). For a server scope, percentage is memberCount / totalMembers * 100. Results are cached for 5 minutes.
Authentication: Admin session token (Authorization: Bearer <token>)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
serverId | query | string | no | Server ID to scope role distribution. Omit for cross-server aggregation. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Role distribution. | any |
400 | Invalid query parameters. | |
401 | Authentication required. | |
403 | System Admin access required. |
Open in Swagger (opens in a new tab)
Server-level statistics
/api/admin/stats/serversPer-server member/active/role counts, sync status, and bot health. lastSync is the last successful sync (may lag behind syncStatus if the most recent attempt failed); lastSyncError is populated only when the most recent attempt failed. botStatus reflects live bot connectivity at computation time. Results are cached for 5 minutes, satisfying the near-real-time (≤5 min) health requirement.
Authentication: Admin session token (Authorization: Bearer <token>)
Responses
| Status | Description | Body |
|---|---|---|
200 | Server statistics. | any |
401 | Authentication required. | |
403 | System Admin access required. |
Open in Swagger (opens in a new tab)
Source: apps/api/openapi.json.