Budgets

Cap a customer's spend, hard or soft

A budget caps a customer’s spend over a reset period. HARD blocks requests once the limit is exhausted (returning 402); SOFT alerts but keeps serving. A customer has one budget at a time; a second create returns 409.

Path: /v1/customers/{customer_id}/budgets.

Fields

FieldDescriptionType
idMerge UUIDstring
spending_limitLimit in USDnumber
reset_periodDAILY, WEEKLY, MONTHLY, QUARTERLY, or YEARLYenum
spending_limit_typeHARD blocks over-budget requests, SOFT alerts onlyenum
created_at, modified_atTimestampsdatetime

Set a budget

cURL
$curl -X POST https://api-gateway.merge.dev/v1/customers/{customer_id}/budgets \
> -H "Authorization: Bearer mg_<your_production_key>" \
> -H "Content-Type: application/json" \
> -d '{ "spending_limit": 50, "reset_period": "MONTHLY", "spending_limit_type": "HARD" }'

When a HARD budget is exhausted, that customer’s requests return 402 budget_exceeded until the next reset period. Raise the limit or switch to SOFT to resume serving.