Skip to main content
GET
/
api
/
user
/
usage-history
Per-bucket credits spent for the calling user within an instance scope
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

x-access-token
string
header
required

JWT token passed in x-access-token header

Query Parameters

instanceId
string
required

Either the literal string personal (personal-scope usage) or the ObjectId of an institution the caller is a member of.

window
enum<integer>
default:30

Number of days of history to aggregate. Invalid values fall back to 30.

Available options:
7,
14,
30,
90,
180
interval
enum<string>

Bucket granularity. Invalid or omitted values fall back to a window-appropriate default (daily ≤30d, weekly otherwise).

Available options:
daily,
weekly,
monthly
scope
enum<string>
default:own

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.

Available options:
own,
all

Response

Bucketed usage payload

success
boolean
Example:

true

instanceId
string
Example:

"personal"

window
integer
Example:

30

interval
string
Example:

"daily"

scope
enum<string>

The EFFECTIVE scope applied (falls back to own if the caller isn't an institution admin).

Available options:
own,
all
Example:

"own"

currency
string
Example:

"usd"

buckets
object[]

One entry per granular bucket, ascending by start.

totals
object