API Reference
Log In
API Reference

Update a Cost Control (partial)

PATCH — only fields present in the request body are applied. Passing filters (including an empty list) replaces the full filter set; omit filters to leave it unchanged. Same replacement semantics apply to notificationChannelIds. Nullable scalar fields (description, denyMessage, warnThreshold, hardLimit, groupBy) use the Patchable<T> tri-state contract: omit the field to leave the persisted value unchanged; pass explicit JSON null to clear a previously-set value; pass a non-null value to set it.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
string
required

Revenium-generated identifier of the cost control

Body Params

Cost control configuration for cost enforcement. Shadow mode evaluates without blocking; non-shadow rules block AI transactions when the threshold is crossed within the rolling window.

string | null
required

Display name for this rule

description
required

Optional human-readable description of the rule's purpose. PATCH semantics: omit the field to leave the persisted value unchanged; pass explicit JSON null to clear a previously-set description; pass a string to set it.

denyMessage
required

Optional customer-authored template shown to the AI agent when this rule blocks or warns on a request. The server stores and serves this string as-is — it is never interpolated server-side; the local budget-gate client renders the following template variables before display: {model}, {spent}, {limit}, {window}, {percentUsed}, {ruleName}. Only the developer/policy text is customer-authored — the action directive shown alongside it is composed by the client, not this field. PATCH semantics: omit the field to leave the persisted value unchanged; pass explicit JSON null to clear a previously-set message; pass a string to set it.

string | null
required

The Revenium-generated identifier of the team that owns this rule

string | null
enum
required

The AI metric the rule evaluates against

warnThreshold
required

Optional soft threshold that triggers a warning without blocking. Unit matches hardLimit: dollars for TOTAL_COST, whole counts for token/error metrics. PATCH semantics: omit the field to leave the persisted value unchanged; pass explicit JSON null to clear a previously-set threshold; pass a numeric value to set it.

hardLimit
required

Hard enforcement threshold in the metric's native unit: dollars for metricType=TOTAL_COST (e.g. 10 = $10/window), or a whole count for metricType=TOKEN_COUNT / ERROR_COUNT / etc. When crossed and the rule is not in shadow mode, the declared action is executed. PATCH semantics: omit the field to leave the persisted value unchanged; pass explicit JSON null to clear a previously-set limit; pass a numeric value to set it.

string | null
enum
required

Rolling window over which usage is accumulated

Allowed:
string | null
enum
required

Enforcement action taken when hardLimit is crossed (and rule is not in shadow mode). Only BLOCK and WARN_ONLY are currently accepted on create/update.

Allowed:
boolean | null

When true, the rule evaluates without actually blocking — used to validate limits before enforcing them

boolean | null

Whether the rule is active. Disabled rules are kept for history but skipped at evaluation time.

groupBy
required

Optional dimension to partition the rule evaluation (per-model, per-provider, etc.). PATCH semantics: omit the field to leave the persisted value unchanged; pass explicit JSON null to clear a previously-set dimension; pass an enum value to set it.

filters
array of objects | null

Optional filter predicates narrowing which AI metric events the rule applies to. PATCH: passing an empty list clears all filters; passing a non-empty list replaces the set.

filters
notificationChannelIds
array of strings | null

Optional notification channels that receive alerts when the rule fires. Each entry is a type-prefixed identifier — slack:<hashedId> resolves to a Slack configuration; webhook:<hashedId> resolves to a webhook export configuration. PATCH: passing an empty list clears all channels; passing a non-empty list replaces the set; omitting the field leaves the persisted set unchanged.

notificationChannelIds
_links
object
Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
*/*