v4

latestOpenAPI 3.1.02026-08-01207318738.7 KB
AI

Read individual users' AI credit usage

Read individual users' AI credit usage for the current billing period. Names the users by userId (the user's membership id in this organization); each id must be a member of the organization. Returns each user's credits used, in request order, plus the billing-period bounds. A user with no usage yet reports 0. At most 1000 ids per request; each userId may appear at most once. An unknown userId fails the whole request with a 404 naming it. This is a read, so it works even when credit-controls editing is disabled; it requires the same manage-user-attributes permission and per-user credit-limit feature flag as the per-user limit endpoints.

post/api/v1/ai/credit-usage/users

Request body

userIdsstring[] required

Users to read usage for, at most 1000 per request. Each entry is a user's id within this organization.

Example request

{
  "userIds": [
    "f4a2b3c8-0d1e-4f5a-9b6c-7d8e9f0a1b2c"
  ]
}

Response

Each requested user's credit usage for the current billing period, in request order.

periodEndinteger required

End of the current billing period as a Unix ms timestamp (UTC calendar-month boundary).

periodStartinteger required

Start of the current billing period as a Unix ms timestamp (UTC calendar-month boundary).

Example response

{
  "users": [
    {
      "creditsUsed": 42,
      "userId": "f4a2b3c8-0d1e-4f5a-9b6c-7d8e9f0a1b2c"
    }
  ]
}