Skip to content

Rate limits API

GET /api/v1/admin/rate-policies/status · operation currentRatePolicyStatus

Omitted status_version or1 preserves legacy UTC minute counters. Explicit2 reports each eligible active legacy/model policy with its own limit/window/reset and captured configuration version; dynamically per-end-user counters remain omitted instead of being presented as aggregate headroom. V2 observed_at is the database time when rate_limits is on, otherwise null with an empty shared-counter list and optional local concurrency. Current UTC minute counters for active RPM policies, read from shared PostgreSQL using its clock. Rejected attempts do not consume slots; policy subject or limit changes reset the current counter. With concurrency_limits, concurrency also lists what the answering replica holds of each max_concurrent cap (T135); another replica holds its own. Global admin and viewer only. Requires rate_limits or concurrency_limits; without rate_limits, items is empty and window_start/resets_at carry the zero time.

Authentication: adminSession

Parameters

Name In Type Description
status_version query integer, one of 1, 2, default 1 Omitted/default1 is exact legacy minute/concurrency status. Explicit2 adds canonical model/key_model fixed-window rows with per-item boundaries and a captured configuration version. Duplicate/unsupported selectors are refused.

Responses

Status Description Body
200 Admitted requests, remaining slots and reset time for each active RPM policy, and the replica’s in-flight count for each concurrency cap application/json: RatePolicyStatus or RatePolicyStatusV2
400 Invalid input application/json: Error
401 Missing or invalid bearer key application/json: Error
403 Model not allowed application/json: Error
404 Feature disabled application/json: Error
503 Shared counter storage unavailable —

Response 200 fields:

PUT /api/v1/admin/rate-policies/{id} · operation upsertRatePolicy

T168 (organization_admins): an organization admin may also write (and DELETE) a team, key, key_model or end_user policy whose subject belongs to its organization before and after the write, never a tenant, model or YAML policy (403 organization_forbidden), and admitting at most the requests per minute of its tenant rate ceilings (422 exceeds_tenant_ceiling). Create or override a legacy key/team/end_user RPM policy, applicable concurrency cap, or flagged canonical model/key_model request-window policy. Uses the current shared control version and feature-aware licensed writes. Model references are canonical exact aliases; a key must be an active managed or declared identity. New-subject effective RPM/concurrency is zero. Old-client omission cannot silently erase a new profile: deliberate conversion to legacy supplies requests_per_window:0, window:“”, model_id:“” with the intended legacy cap. Stale versions, denied licenses and invalid payloads do not mutate configuration/audit/cipher state.

Authentication: adminSession

Parameters

Name In Type Description
id path string, required Stable rate policy ID
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Request body (required)

  • application/json: object
    • version (integer (int64), required)
    • policy (RatePolicy, required)

Responses

Status Description Body
200 Policy saved and active control version returned —
400 Invalid input application/json: Error
401 Missing or invalid bearer key application/json: Error
403 Model not allowed application/json: Error
409 Control version conflict —
422 Invalid policy or unknown subject —

DELETE /api/v1/admin/rate-policies/{id} · operation deleteRatePolicyOverride

Delete a console policy or revert a YAML-owned policy to its base declaration.

Authentication: adminSession

Parameters

Name In Type Description
id path string, required Stable rate policy ID
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Request body (required)

  • application/json: object
    • version (integer (int64), required)

Responses

Status Description Body
204 Policy deleted or YAML declaration restored —
404 No console override exists —
409 Control version conflict —

m7gtwcontact@m7gtw.com