Budget Controls
Configure organization budgets against recorded spend. Understand supported scopes, refusals, accounting limits, and safe retry.
Enterprise feature
Overview
New budgets support organization scope only. A soft limit emits a log warning; a matched hard limit blocks a proxy request when already-recorded spend reaches it. The current API and legacy enforcement require PostgreSQL, Redis, and thebudget_controls entitlement. A Free plan skips this enforcement.
Budget Scopes
| Scope | Description |
|---|---|
org | Recorded spend for the authenticated organization |
app / key | Unsupported: creation returns HTTP 400 unsupported_budget_scope without creating a budget |
Create a Budget
Use your API host, an authenticated admin session, and that session's organization UUID. Provider credentials are not needed to create a budget. Save the returned budget ID; a duplicate definition returns 409 budget_conflict.
/api/v1/budgetsCreate a spending budget. Requires admin role.
curl --fail-with-body --write-out '\nHTTP %{http_code}\n' -X POST "$INGATE_BASE_URL/api/v1/budgets" \
-H "Authorization: Bearer $INGATE_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"scope": "org",
"scope_id": "YOUR_ORG_UUID",
"soft_limit_usd": 500,
"hard_limit_usd": 1000,
"period_type": "monthly"
}'Replace YOUR_ORG_UUID before running. Invalid or foreign IDs return400 invalid_budget_scope_id. Limits accept at most six decimal places; the hard limit must be positive and the soft limit must not exceed it. These refusals leave stored definitions unchanged.
API Endpoints
/api/v1/budgetsList all budgets for the current org.
/api/v1/budgets/:idGet a specific budget.
/api/v1/budgets/:idUpdate soft/hard limits.
/api/v1/budgets/:idDelete a budget.
/api/v1/budgets/:id/statusGet current spend, remaining balance, and utilization.
Budget Status Response
{
"budget": {
"id": "...",
"scope": "org",
"soft_limit_usd": 500,
"hard_limit_usd": 1000,
"period_type": "monthly"
},
"current_spend": 347.82,
"remaining": 652.18,
"utilization": 0.348
}Enforcement
Enabled legacy enforcement checks recorded spend before downstream execution. When a matched hard limit is reached, it returns 402 budget_exceeded:
{
"error": "budget limit exceeded",
"error_code": "budget_exceeded",
"budget_id": "...",
"scope": "org",
"current_spend": 1002.50,
"hard_limit": 1000
}| Outcome | Meaning |
|---|---|
503 budget_unavailable | Budget state or spend cannot be read reliably; no downstream execution. Retry-After: 1 |
408 request_canceled | The parent request was canceled before downstream execution |
| No matching budget | Successful lookups allow the request; no spend counter is read |
Recorded spend is not a guaranteed charge ceiling
Partial progress and retry
Read the saved budget ID and its status before changing limits or repeating a create. Existing accounting control can refuse legacy create, update, or delete with409 budget_accounting_controlled; do not remove controls to bypass it. An uncertain mutation returns 503 budget_outcome_unknown with the budget ID. Read that identity to resolve state; do not assume rollback or automatically retry a mutation. A refused request is not evidence that earlier provider work was undone.