GET

Get a user's usage

One end user's sessions and AI credits in this billing period.

View as Markdown
GEThttps://api.muzekit.com/v1/users/{id}/usage
curl https://api.muzekit.com/v1/users/user_42/usage \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY"

{id} is the user's usr_… id or your own id for them, URL-encoded, as in Get a user.

The counts are for the editor's current billing period (period), in this key's environment:

  • sessions: editor sessions the user opened, each counted once however often they reloaded it, plus the sessions their AI app worked in.
  • ai_credits_used: AI credits their AI actions spent. ai_credits_limit is what one user may spend a period (50 by default); past it their AI actions are refused with 402 ai_user_limit_reached.

Renders aren't counted per user. For the whole editor's use, read Get the workspace (this period's pools) and Get usage (per day).

Examples

Warn a user before their AI credits run out

Check what is left before you show your own upgrade prompt, or turn AI features off in their next session's features.

curl -s https://api.muzekit.com/v1/users/user_42/usage \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  | jq '.ai_credits_limit - .ai_credits_used'

Bill your heaviest users

Read each user's sessions at the end of the period, for example to charge per seat or per session in your own pricing. Use period.end to know when the counts start again.

for id in user_42 user_43; do
  curl -s "https://api.muzekit.com/v1/users/$id/usage" \
    -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
    | jq -r '[.external_id, .sessions] | @tsv'
done

Response

JSON
{
  "object": "user_usage",
  "user": "usr_8fK2mQ1xZpR",
  "external_id": "user_42",
  "environment": "live",
  "period": {
    "start": "2026-11-01T00:00:00.000Z",
    "end": "2026-12-01T00:00:00.000Z"
  },
  "sessions": 14,
  "ai_credits_used": 32,
  "ai_credits_limit": 50
}

period.end is null when the editor has no billing period yet; the counts then start on the first of the month (UTC).