Skip to content

A workspace's budget: its monthly spend limit (amount_micros; automatic is true while the owners have not set one, and it is then $200 or twice last month's spend), what was charged this month (spent_micros), the most the owners may set it to themselves (max_amount_micros), its alerts (percent of the limit, each emailed to the owners once a month), whether usage pauses at the limit (pause_at_limit), the webhook told of each alert, and state: ok, warning or stopped, with a message when work is stopped or close to it.

GET/workspaces/{workspace}/budget

Members of the workspace only.

All amounts are whole millionths of a dollar: 500000000 is $500. max_amount_micros is null for g1t’s own workspaces, which have no ceiling. When state is stopped, new sandboxes, builds and app requests wait until the limit is raised or the month closes.

  • Authentication: Required. Send an access token as Authorization: Bearer.
  • MCP tool: billing with action budget, and the same inputs
  • Scope: An access token needs billing:read.
Name Type Required Description
workspace string Yes The workspace’s slug, e.g. “flagon-io”.
curl https://api.g1t.sh/workspaces/flagon-io/budget \
-H "Authorization: Bearer $G1T_TOKEN"

A successful request answers 200 with:

{
"workspace": "flagon-io",
"amount_micros": 500000000,
"automatic": false,
"spent_micros": 132450000,
"max_amount_micros": 2000000000,
"alerts": [
50,
75,
90,
100
],
"pause_at_limit": true,
"webhook": "https://ops.example.com/g1t/budget",
"state": "ok",
"message": null
}

A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.

Status Code When
401 unauthenticated A token is required, or the one sent is not valid.
403 forbidden The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository.
404 not_found It does not exist, or you cannot see it.
422 invalid The input is not valid. message says which field and why.