Update a gateway policy
Partially updates a gateway policy. Only fields present in
the request body are applied; absent fields are left
unchanged. policy_type is immutable — to change a
policy’s type, delete it and create a new one.
config if supplied must match the policy’s type:
- spend-cap:
{"window": ..., "limit_usd": ...} - guard:
{"version": 1, "detect": {...}, "timeout_seconds": <number>, "timeout_action": "allow"|"block"} - rate-limit:
{"version": 1, "limits": [{"metric": "requests"|"tokens", "window": "minute"|"hour", "value": <integer>}]}Mismatched shapes are rejected with 400.
default cascade: editing a default_spend_cap or
default_rate_limit updates the config/action/enabled/priority
on every attached child policy so the template stays the source
of truth across rollouts.
Authorizations
Path Parameters
Policy ID
Body
Response
OK
CurrentSpendUSD is the spend in the policy's current window. Set for any spend_cap policy regardless of enabled state — disabled policies still surface usage so users can see what would have been counted. Nil for non-spend_cap policies or when the spend lookup failed.
CurrentUsage is the consumed units in each configured limit's current window. Set for any rate_limit policy regardless of enabled state, one entry per limit in the config. Nil for non-rate_limit policies or when the usage lookup failed.
ParentPolicyID is set on materialized children of a default_spend_cap to the default's id. An explicit Update or a Create with the same matchers clears the link and takes ownership of the materialized row. Delete on the parent cascade-soft-deletes children still attached.

