Skip to content
Skip to Content
Coder Docs

Get user AI spend

GET
/api/v2/users/{user}/ai/spend

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

user*string

User ID, username, or me

Response Body

OK

application/json
  1. response
current_spend_micros?integer

CurrentSpendMicros is the user's spend on their effective group over the current budget period.

effective_budget?

EffectiveBudget is the spend limit that applies to the user, whether it came from a group budget or a user override. Null when no budget applies, leaving the user's spend unlimited.

effective_group_id?string

EffectiveGroupID is the group the spend is attributed to, falling back to the Everyone group when no budget applies. Null only when the user has no organization membership.

Formatuuid
period_end?string

PeriodEnd is the exclusive upper bound of the current budget period.

Formatdate-time
period_start?string

PeriodStart is the inclusive lower bound of the current budget period.

Formatdate-time
user_id?string
Formatuuid

The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.

curl -X GET \	"$CODER_URL/api/v2/users/{user}/ai/spend" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN"
Example Response200
{  "current_spend_micros": 0,  "effective_budget": {    "limit_source": "user_override",    "spend_limit_micros": 0  },  "effective_group_id": "85e2b926-ddfb-4c66-b68e-b66e5acec6c0",  "period_end": "2019-08-24T14:15:22Z",  "period_start": "2019-08-24T14:15:22Z",  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"}