List budget balances
Changed onReturns a page of the balances of the organization's limit budgets, highest consumed share first unless the request sets sort. Exemptions have no balance.
- A limit budget without each has one balance for its whole scope, with value set to null.
- A limit budget with each has one balance for every value of the each field with usage in the budget window.
- A value that an eq or in predicate on the each field selects has a balance even without usage.
filter[budget.id] narrows the list to some budgets, and filter[scope.subject] and filter[scope.group] to the balances of one entity. budget is a reference unless the request sends expand=budget, which renders the full budget. For a caller whose access covers only particular principals or groups, the list holds the balances of the budgets that the budget list shows that caller. For a budget that the caller sees only through their own derived budget, it holds that one balance, even without usage.
evaluated_at fixes every budget window for every page, unless a budget's window changes, but not the usage: usage that arrives while a client reads the pages can change the amounts. A zero limit has no consumed share, and its balances sort as the highest share.
Request
- Base URLhttps://global.api.konghq.com
- Auth
- HTTP bearer
- or HTTP bearer
- or HTTP bearer
- or HTTP bearer
Query parameters
Filters on the balances' fields. Every filter must match, and a bare value means eq.
- budget.id: eq, neq, and oeq.
- scope.subject, scope.group, and scope.team: eq and oeq, with complete typed references: subjects as principal/{uuid}, consumer/{uuid}, or oidc/{sub}, groups as principal/{uuid}, consumer_group/{uuid}, or oidc/{group}, and teams as principal/{uuid}, where {uuid} is never the nil UUID. A Kong Identity group goes under scope.group, and a Kong Identity team under scope.team. A budget matches when a branch of its scope names a listed reference in a subject, group, or team predicate with eq or in, or when a listed reference is one of its derived values: a subject on a budget whose each is subject or subject_id, a group on a budget whose each is group, or a team on a budget whose each is team. A pooled budget whose scope names no subject, group, or team, such as an organization-wide budget, never matches. oeq can't list a reference that contains a comma.
A budget that scope.subject, scope.group, or scope.team matches through a listed derived value lists only the balances of the listed values it admits, with zero spend without usage. Every other matching budget lists all its balances.
Any other filter key fails with 400. UUIDs compare case-insensitively.
Filter using one of the following operators: eq, oeq, neq
Filter using one of the following operators: eq, oeq
Filter using one of the following operators: eq, oeq
Filter using one of the following operators: eq, oeq
Narrows the list. Each filter has the form filter[field][operator]=value, or filter[field]=value for eq. An operator that takes no value, such as exists, leaves out =value.
A request can combine several filters, and every filter must match.
The order of the results, as a comma-separated list of fields in priority order. Each field can be followed by a space and asc or desc, and sorts in ascending order without one. The service breaks ties so that the order is unique.
Sortable fields: consumed_share, consumed, value. Defaults to consumed_share desc.
The number of results on each page.
1 to 100. Defaults to 20.
A cursor for the page after an earlier response's page. Clients take it from that response's meta.page.next link, which also carries the request's other parameters, and don't build or change it.
A request can't send both page[after] and page[before].
A cursor for the page before an earlier response's page. Clients take it from that response's meta.page.previous link, which also carries the request's other parameters, and don't build or change it.
A request can't send both page[after] and page[before].
The references to render as full resources, as a comma-separated list of paths. Accepts budget. Without it, a reference renders as an object with the resource's id.
The time to calculate the balances for, as an RFC 3339 timestamp in UTC. It selects the budget window. The amounts still count all usage stored when the request runs. A request that passes an earlier read's evaluated_at gets the same budget window, unless the budget's window changed in between.
A time in the future isn't accepted. Defaults to the time of the request.
Response
A page of balances.
The balances on this page, in sort order: one for each limit budget without each, and one for each derived budget of a limit budget with each. A value that an eq or in predicate on the each field selects appears even without usage, with zero spend.
What every balance on the page shares: the time of the calculation, with the page links and the total.
Example response
{
"data": [
{
"budget": {
"id": "5f9fd312-a987-4628-b4c5-bb4f4fddd5f7",
"labels": {
"env": "test"
},
"managed_by": {
"owner": "terraform"
},
"created_at": "2022-11-04T20:10:06.927Z",
"updated_at": "2022-11-04T20:10:06.927Z"
}
}
],
"meta": {
"page": {
"size": 10
}
}
}Changes
- info
endpoint added
- info