curl --request GET \
--url https://pria.praxislxp.com/api/user/usage-history \
--header 'x-access-token: <api-key>'{
"success": true,
"instanceId": "personal",
"window": 30,
"interval": "daily",
"scope": "own",
"currency": "usd",
"buckets": [
{
"start": "2026-05-01T00:00:00.000Z",
"credits": 12,
"messages": 4,
"users": 7
}
],
"totals": {
"credits": 120,
"messages": 48,
"users": 47
}
}Per-bucket credits spent for the calling user within an instance scope
Returns time-bucketed credits and message counts for the authenticated user, scoped either to personal usage (History rows with no institution) or to a single institution the caller belongs to. The aggregation is DocumentDB-safe (no $facet, no $dateTrunc, no .collation()); buckets are padded with zero-value entries so the chart renders contiguous bars. Results are cached in-memory for 60 seconds per user × instance × window × interval × scope (see the X-Cache response header). Consumed by the Usage tab in the Pricing pane. When the effective scope is all, buckets and totals additionally carry distinct active-user counts.
curl --request GET \
--url https://pria.praxislxp.com/api/user/usage-history \
--header 'x-access-token: <api-key>'{
"success": true,
"instanceId": "personal",
"window": 30,
"interval": "daily",
"scope": "own",
"currency": "usd",
"buckets": [
{
"start": "2026-05-01T00:00:00.000Z",
"credits": 12,
"messages": 4,
"users": 7
}
],
"totals": {
"credits": 120,
"messages": 48,
"users": 47
}
}Authorizations
JWT token passed in x-access-token header
Query Parameters
Either the literal string personal (personal-scope usage) or the ObjectId of an institution the caller is a member of.
Number of days of history to aggregate. Invalid values fall back to 30.
7, 14, 30, 90, 180 Bucket granularity. Invalid or omitted values fall back to a window-appropriate default (daily ≤30d, weekly otherwise).
daily, weekly, monthly own (default) returns the calling user's own usage for the instance. all returns aggregated usage for ALL users of the institution — but is honored ONLY when the caller is an admin of that institution (super, or admin with institutions.edit). For non-admins, or for personal scope, it silently falls back to own (never leaks other users' data). The EFFECTIVE scope is echoed in the response scope field. The 60s TTL cache key includes the effective scope, so own and all-users payloads never collide.
own, all Response
Bucketed usage payload
true
"personal"
30
"daily"
The EFFECTIVE scope applied (falls back to own if the caller isn't an institution admin).
own, all "own"
"usd"
One entry per granular bucket, ascending by start.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?