Enterprise

Budget Controls

Configure organization budgets against recorded spend. Understand supported scopes, refusals, accounting limits, and safe retry.

Enterprise feature

Budget controls are available on Enterprise plans.

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

ScopeDescription
orgRecorded spend for the authenticated organization
app / keyUnsupported: 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.

POST
/api/v1/budgets

Create a spending budget. Requires admin role.

bash
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

GET
/api/v1/budgets

List all budgets for the current org.

GET
/api/v1/budgets/:id

Get a specific budget.

PUT
/api/v1/budgets/:id

Update soft/hard limits.

DELETE
/api/v1/budgets/:id

Delete a budget.

GET
/api/v1/budgets/:id/status

Get current spend, remaining balance, and utilization.

Budget Status Response

jsonResponse
{
  "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:

json402 Response
{
  "error": "budget limit exceeded",
  "error_code": "budget_exceeded",
  "budget_id": "...",
  "scope": "org",
  "current_spend": 1002.50,
  "hard_limit": 1000
}
OutcomeMeaning
503 budget_unavailableBudget state or spend cannot be read reliably; no downstream execution. Retry-After: 1
408 request_canceledThe parent request was canceled before downstream execution
No matching budgetSuccessful lookups allow the request; no spend counter is read

Recorded spend is not a guaranteed charge ceiling

A budget check does not reserve an in-flight request's cost. Asynchronous recording and concurrent requests can exceed a limit. Unknown prices, dropped logs, or failed accounting can leave costs unrecorded. A missing Redis counter means zero recorded spend, not proof of zero real spending. A soft log warning does not guarantee webhook, email, or Slack delivery.

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.