/v1/workspaces/{workspace_id}/statsAuthAuth stats for a workspace
Active end users over 1, 7 and 30 days, total and new end users, production app count, last end-user activity and a daily active-users series, for the workspace's **production** apps only. **Active** means the end user signed in successfully or refreshed a session. Customer backends verify access tokens locally against the JWKS, so use between two refreshes is invisible to ProductCraft; resolution is bounded by each app's access-token lifetime. Days are UTC. Counts only: no end-user identifiers. Cached for up to 60 seconds (`generated_at`).
Path parameters
workspace_id*string · uuidWorkspace id.
Query parameters
windowenum (3)Window for `in_window.new_end_users` and the length of `series`. The three `active_users_*` counts are always returned.
Response · 200 Auth stats.
window*objectWindow the counts cover.
Example: "30d"
generated_at*string · date-timeWhen these numbers were computed. Responses are cached for up to 60 seconds.
Example: "2026-10-07T09:00:00.000Z"
last_activity_at*string · date-timeMost recent end-user sign-in or session refresh across the workspace's production apps. Null when none is on record.
Example: "2026-10-07T08:41:12.000Z"
totals*objectAll-time counts.
in_window*objectActivity counts.
series*objectDaily active users.
by_app*arrayEvery production app in the workspace, busiest first: by `active_users_30d`, then `end_users`. Empty when the workspace has no production app.
Example
Request
GET https://api.auth.productcraft.co/v1/workspaces/{workspace_id}/stats
Authorization: Bearer YOUR_TOKENimport { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const authWorkspaceStats = await auth.stats.retrieve();auth.stats.retrieve(params?, options?): Auth.AuthWorkspaceStats
Response
{
"window": "30d",
"generated_at": "2026-10-07T09:00:00.000Z",
"last_activity_at": "2026-10-07T08:41:12.000Z",
"totals": {},
"in_window": {},
"series": {},
"by_app": [
{
"app_id": "5b1f0c2e-8a7d-4c2b-9f53-0d1e6f3a9b21",
"active_users_30d": 97,
"end_users": 1020
}
]
}