Limit Policies

Update a limit policy

Changed on

Update the policy configuration. Immutable fields are ignored. Changing or deleting a policy needs the dashboard, or an API key explicitly granted the limit_policies permission; the * permission doesn't count. Any key can create policies.

patch/api/limit-policies/{id}/

Request

  • Base URL
    https://api.respan.ai
  • URL
    https://api.respan.ai/api/limit-policies/{id}/
  • Auth
    HTTP bearer

Path parameters

idstring uuid required

Limit policy id.

Request body

namestring
scopestring
priorityinteger
is_activeboolean

Response

The updated policy.

idstring uuid
namestring

Human label.

scopestring

Display category (e.g. API Key, Model). Not used for matching.

scope_valuestring

Identity to meter. For composites, a JSON list of values in compose order.

composestring[]

Empty for single-dimension policies. Members: organization_id, api_key_id, user_id, customer_identifier, model, endpoint.

metric'cost' | 'request_count' | 'token_count'

What the cap counts. cost is US dollars, token_count is total tokens, request_count is calls.

algorithm'balance_fixed_window'

balance_fixed_window is the shipped algorithm. token_bucket is reserved and not yet enforced.

periodstring nullable

Cadence. A named bucket (minute, hour, day, week, month), a positive integer of seconds as a string, or null for a cumulative (lifetime) cap that never resets.

anchor'calendar' | 'first_event' | 'explicit_ts'

When a recurring window aligns. calendar resets on the boundary (e.g. the 1st of the month).

anchor_atstring date-time nullable

Required when anchor is not calendar.

effective_atstring date-time nullable

Active-range start. null = live since forever.

expires_atstring date-time nullable

Active-range end. null = live until deactivated. Must be after effective_at.

priorityinteger

Higher is checked first.

is_activeboolean
threshold_valuenumber

First hard-rule threshold; falls back to the largest soft threshold.

meter_definition_idstring

Stable hash of the policy identity. Same identity resolves to the same id across recreations.

created_atstring date-time
updated_atstring date-time

Changes

    • breaking

      request body became required

    • breaking

      the response property became nullable for the status

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property became nullable for the status

    • breaking

      the response property became nullable for the status

    • breaking

      the response property became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the / response's property format changed from double to no format for status

    • breaking

      the response's property format changed from double to no format for status

    • info

      api operation id limitPolicies_update_limit_policy removed and replaced with update_limit_policy

    • info

      api tag Limit Policies added

    • info

      api tag limitPolicies removed

    • info

      the request property // became nullable

    • info

      the request property // became nullable

    • info

      the response optional property became read-only for the status

    • info

      the response optional property became read-only for the status

    • info

      the response optional property became read-only for the status

    • info

      the response optional property became read-only for the status

    • info

      the response optional property became read-only for the status

    • breaking

      the response property // became nullable for the status

    • info

      the request property // became nullable

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status