Skip to main content

Statistics

Member statistics: totals, growth over time, role distribution and overlap across servers, with CSV and JSON export.

Cross-server member overlap

GET/api/admin/stats/cross-server

Members 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

StatusDescriptionBody
200Cross-server overlap statistics.any
401Authentication required.
403System Admin access required.

Open in Swagger (opens in a new tab)

Export a statistics report as CSV or JSON

GET/api/admin/stats/export

Exports 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

NameInTypeRequiredDescription
typequery"members" or "growth" or "roles" or "servers" or "cross-server"yesWhich statistics report to export
formatquery"csv" or "json"noExport format
serverIdquerystringnoServer to scope the export to. Required when type=roles; optional filter for members/growth.
dateRangequery"7d" or "30d" or "90d" or "1y"noWindow for members/growth exports

Responses

StatusDescriptionBody
200File download (CSV or JSON).
400Invalid query parameters, or missing serverId for type=roles.
401Authentication required.
403System Admin access required.

Open in Swagger (opens in a new tab)

Aggregate member statistics

GET/api/admin/stats/members

Aggregate 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

NameInTypeRequiredDescription
serverIdquerystringnoFilter all metrics to a single server
dateRangequery"7d" or "30d" or "90d" or "1y"noWindow for new-member / growth-rate metrics

Responses

StatusDescriptionBody
200Member statistics.any
400Invalid query parameters.
401Authentication required.
403System Admin access required.

Open in Swagger (opens in a new tab)

Member growth over time

GET/api/admin/stats/members/growth

New 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

NameInTypeRequiredDescription
serverIdquerystringnoFilter growth to a single server
periodquery"7d" or "30d" or "90d" or "1y"noTime window
granularityquery"daily" or "weekly" or "monthly"noBucket size

Responses

StatusDescriptionBody
200Growth series.any
400Invalid query parameters.
401Authentication required.
403System Admin access required.

Open in Swagger (opens in a new tab)

Role distribution (scoped or cross-server)

GET/api/admin/stats/roles

Member 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

NameInTypeRequiredDescription
serverIdquerystringnoServer ID to scope role distribution. Omit for cross-server aggregation.

Responses

StatusDescriptionBody
200Role distribution.any
400Invalid query parameters.
401Authentication required.
403System Admin access required.

Open in Swagger (opens in a new tab)

Server-level statistics

GET/api/admin/stats/servers

Per-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

StatusDescriptionBody
200Server statistics.any
401Authentication required.
403System Admin access required.

Open in Swagger (opens in a new tab)

Source: apps/api/openapi.json.