List Budgets
GET /budgets
GET /budgetsInteractive request editor loads with JavaScript.
Authorization
BearerAdminToken Organization-scoped admin token. Read operations require a valid token, and write operations require a token with write permission.
In: header
Response Body
application/json
application/json
curl -X GET "$AISIX_CP/budgets" \ -H "Authorization: Bearer $AISIX_TOKEN"OK
{
"data": [
{
"budget": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
"scope": "org",
"scope_ref": "string",
"display_name": "string",
"limit_cents": 0,
"period": "day",
"hard_stop": true,
"alert_thresholds": [
1
],
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
},
"state": {
"period_start": "2019-08-24T14:15:22Z",
"spent_cents": 0,
"crossed_75_at": "2019-08-24T14:15:22Z",
"crossed_90_at": "2019-08-24T14:15:22Z",
"crossed_100_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
}
]
}Missing or invalid bearer.
{
"error": {
"code": "UNAUTHENTICATED",
"message": "no org context"
}
}Complete operation details and schema variants
GET /budgets
List Budgets
List every budget in the organization, across all scopes, each
with its current-period spend state. Budgets whose spend is not
tracked as a single total (team_member) return a zero-seeded
state: the limit applies to each member of the team separately.
Parameters
Responses
-
200: OK -
data(array, required): Every budget in the organization. -
data[].budget(object, required): A spending cap on one target. Amounts are integer USD cents. -
data[].budget.id(string, required): Budget ID. -
data[].budget.org_id(string, required): Organization that owns this budget. -
data[].budget.scope(string, required): What a budget's spend counts.orgcaps the whole organization.environmentcaps one environment.api_keycaps one caller API key andprovider_keyone upstream credential.teamis a pool shared by every caller API key bound to the team.memberis organization-wide for one member: all caller API keys bound to that member, in any team.team_membergives every member of one team an individual allowance of the same size, counting only their spend through keys bound to both that team and that member. -
data[].budget.scope_ref(string, required): ID of the target the budget applies to, matchingscope: an environment ID, caller API key ID, provider key ID, team ID, or member ID.team_memberbudgets reference a team ID. Fororgbudgets this holds the organization's internal ID, which differs from the organization identifier used elsewhere in this API. Fixed at creation. -
data[].budget.display_name(string, required): Human-readable budget name. -
data[].budget.limit_cents(integer, required): Spending limit in USD cents. -
data[].budget.period(string, required): Calendar window the limit applies to, in UTC:dayresets at 00:00,weekon Monday 00:00,monthon the 1st at 00:00. -
data[].budget.hard_stop(boolean, required): Whether the gateway rejects matching traffic with429 budget_exceededonce the period's spend reaches the limit. Whenfalsethe budget only reports the over-limit state. -
data[].budget.alert_thresholds(array, optional): Percent-of-limit points at which abudget_thresholdnotification fires once per period, delivered to the organization's enabled notification channels.nullmeans the default ([80]). Values above100fire under either enforcement mode and flag overspend:hard_stoprejects new requests once the control plane observes spend at the limit, but it does not cap the cost of requests already admitted, so a hard-stopped budget can settle above100. -
data[].budget.created_at(string, required): Time when the budget was created. -
data[].budget.updated_at(string, required): Time when the budget was last updated. -
data[].state(object, required): Current-period spend. Seeded at zero when the budget is created. Forteam_memberbudgets it stays at the zero seed: spend is tracked per member of the team, not as one total. -
allOf variant 1
-
data[].state.period_start(string, required): Start of the period the totals cover. -
data[].state.spent_cents(integer, required): Spend accumulated in the period, in USD cents. -
data[].state.crossed_75_at(string, required): Time the period's spend first reached 75% of the limit.nullwhile below the threshold. -
data[].state.crossed_90_at(string, required): Time the period's spend first reached 90% of the limit.nullwhile below the threshold. -
data[].state.crossed_100_at(string, required): Time the period's spend first reached the limit.nullwhile below the limit. -
data[].state.updated_at(string, required): Time the totals were last refreshed. -
401: Missing or invalid bearer. -
error(object, required): Error details. -
error.code(string, required): Machine-readable identifier. Examples:UNAUTHENTICATED,INVALID_REQUEST,MASTER_KEY_UNSET,INTERNAL. -
error.message(string, required): Human-readable explanation; safe to surface to operators.
cURL
curl -X GET '$AISIX_CP/budgets' -H 'Authorization: Bearer $AISIX_TOKEN'