Api Limit Policies Create

POST handler with superadmin-only field protection.

Strips superadmin-only fields from non-superadmin requests before delegating to OrganizationInjectionMixin.post() for org injection.

Authentication

AuthorizationBearer
JWT access token or Respan API key

Request

This endpoint expects an object.
scope_valuestringRequired1-1024 characters
projectstring or nullOptional>=1 character
namestringOptional<=255 characters
scopestringOptional<=64 characters
composeanyOptional
metricenumOptional
  • cost - Cost
  • request_count - Request count
  • token_count - Token count
algorithmenumOptional
  • balance_fixed_window - Balance fixed window
  • token_bucket - Token bucket
periodstring or nullOptional<=32 characters
effective_atdatetime or nullOptional
expires_atdatetime or nullOptional
anchorenumOptional
  • calendar - Calendar
  • first_event - First event
  • explicit_ts - Explicit timestamp
anchor_atdatetime or nullOptional
refill_ratedouble or nullOptional
rulesanyOptional
priorityintegerOptional-2147483648-2147483647
is_activebooleanOptional
include_existing_usagebooleanOptionalDefaults to false

When true on creation, SUMs matching CHLogV3 history into the live counter so the cap starts at the historical total. For lifetime policies (period=null) the SUM covers all history up to creation time. For rolling policies the SUM covers only the current window — when the window rolls over the seeded counter naturally ages out and the next window starts fresh. Idempotent via the row’s seeded_at audit column.

Response

idstringRead-only
namestringRead-only
scopestringRead-only
scope_valuestringRead-only
composeanyRead-only
metricenum
  • cost - Cost
  • request_count - Request count
  • token_count - Token count
algorithmenum
  • balance_fixed_window - Balance fixed window
  • token_bucket - Token bucket
periodstring or nullRead-only
effective_atdatetime or nullRead-only
expires_atdatetime or nullRead-only
priorityintegerRead-only
is_activebooleanRead-only
threshold_valuedoubleRead-only
meter_definition_idstringRead-only
updated_byobject
created_atdatetimeRead-only
updated_atdatetimeRead-only
current_stateobject

Live counter state for the policy’s current window. Sourced from Redis (same key apply_limits evaluates against). Populated by the view’s bulk prefetch on list responses; falls back to a single HGET on detail.

tagslist of objectsRead-only

GenericTag rows assigned to this policy. Managed via /api/tag-assignments/limit_policies/... — read-only here.

rulesanyRead-only
anchorenum
  • calendar - Calendar
  • first_event - First event
  • explicit_ts - Explicit timestamp
anchor_atdatetime or nullRead-only
refill_ratedouble or nullRead-only