Scoped budgets
List the scoped budgets in the caller's organization, optionally filtered to one scope.
Enter your API key here (sent as Otari-Key header).
0100Successful Response
One scoped ceiling and its live counters.
Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is
enforced against current_spend + reserved_spend, so there is no rollup
over users to compute.
Every limit, along with budget_duration_sec and reset_alignment, is
read off the budget rather than stored here, and carried on the wire so a
caller can render a ceiling without fetching every budget to resolve one id.
Validation Error
GET /api/v1/scoped-budgets HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
[
{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"current_requests": 1,
"current_spend": 1,
"current_tokens": 1,
"id": "text",
"max_budget": 1,
"name": "text",
"period_end": "text",
"period_start": "text",
"provider_key_id": "text",
"request_limit": 1,
"reserved_requests": 1,
"reserved_spend": 1,
"reserved_tokens": 1,
"reset_alignment": "text",
"scope_id": "text",
"scope_type": "text",
"token_limit": 1,
"updated_at": "text"
}
]Create a scoped budget.
Answers 404 when the scope names nothing, rather than creating a ceiling that can never bind.
Enter your API key here (sent as Otari-Key header).
Request model for creating a scoped budget.
The budget this ceiling enforces; its limit and period are read through it
Admin-facing label for this ceiling
Narrow the cap to one provider instance; omit or null to cap spend across every provider. A blank value would store a ceiling that never binds, so it is refused; this does not check that the value names a configured provider instance
^\S+$Id of the capped identity: an organization, workspace, membership row, or API key
Which kind of identity this ceiling caps
Successful Response
One scoped ceiling and its live counters.
Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is
enforced against current_spend + reserved_spend, so there is no rollup
over users to compute.
Every limit, along with budget_duration_sec and reset_alignment, is
read off the budget rather than stored here, and carried on the wire so a
caller can render a ceiling without fetching every budget to resolve one id.
Validation Error
POST /api/v1/scoped-budgets HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 105
{
"budget_id": "text",
"name": "text",
"provider_key_id": "text",
"scope_id": "text",
"scope_type": "organization"
}{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"current_requests": 1,
"current_spend": 1,
"current_tokens": 1,
"id": "text",
"max_budget": 1,
"name": "text",
"period_end": "text",
"period_start": "text",
"provider_key_id": "text",
"request_limit": 1,
"reserved_requests": 1,
"reserved_spend": 1,
"reserved_tokens": 1,
"reset_alignment": "text",
"scope_id": "text",
"scope_type": "text",
"token_limit": 1,
"updated_at": "text"
}Get one scoped budget.
Enter your API key here (sent as Otari-Key header).
Successful Response
One scoped ceiling and its live counters.
Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is
enforced against current_spend + reserved_spend, so there is no rollup
over users to compute.
Every limit, along with budget_duration_sec and reset_alignment, is
read off the budget rather than stored here, and carried on the wire so a
caller can render a ceiling without fetching every budget to resolve one id.
Validation Error
GET /api/v1/scoped-budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"current_requests": 1,
"current_spend": 1,
"current_tokens": 1,
"id": "text",
"max_budget": 1,
"name": "text",
"period_end": "text",
"period_start": "text",
"provider_key_id": "text",
"request_limit": 1,
"reserved_requests": 1,
"reserved_spend": 1,
"reserved_tokens": 1,
"reset_alignment": "text",
"scope_id": "text",
"scope_type": "text",
"token_limit": 1,
"updated_at": "text"
}Relabel a ceiling, or point it at a different budget.
The scope and the provider narrowing are not editable: changing either would move the ceiling to a different identity while carrying its spend, which is a delete and a create, not an update.
There is no limit or period to set here any more. Both are properties of the budget, so changing what a ceiling allows is either editing that budget, which moves every ceiling naming it, or naming a different one.
Enter your API key here (sent as Otari-Key header).
Request model for updating a scoped budget.
Successful Response
One scoped ceiling and its live counters.
Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is
enforced against current_spend + reserved_spend, so there is no rollup
over users to compute.
Every limit, along with budget_duration_sec and reset_alignment, is
read off the budget rather than stored here, and carried on the wire so a
caller can render a ceiling without fetching every budget to resolve one id.
Validation Error
PATCH /api/v1/scoped-budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 34
{
"budget_id": "text",
"name": "text"
}{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"current_requests": 1,
"current_spend": 1,
"current_tokens": 1,
"id": "text",
"max_budget": 1,
"name": "text",
"period_end": "text",
"period_start": "text",
"provider_key_id": "text",
"request_limit": 1,
"reserved_requests": 1,
"reserved_spend": 1,
"reserved_tokens": 1,
"reset_alignment": "text",
"scope_id": "text",
"scope_type": "text",
"token_limit": 1,
"updated_at": "text"
}Delete a scoped budget.
A request holding a reservation against it settles into nothing afterwards, which is the right outcome: the ceiling no longer exists to be credited.
Enter your API key here (sent as Otari-Key header).
Successful Response
No content
Validation Error
DELETE /api/v1/scoped-budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
No content
Last updated
Was this helpful?
