Skip to main content

Documentation Index

Fetch the complete documentation index at: https://engineering.unkey.com/llms.txt

Use this file to discover all available pages before exploring further.

RateLimit defines gateway-level rate limiting with configurable identifiers. Sentinel delegates rate limit state to Unkey’s distributed rate limiting service, providing consistent counts across multiple sentinel instances.
RateLimit is defined in the policy schema but is not executed by the sentinel engine yet.

Fields

limit
int64
Maximum number of requests allowed in the time window.
window_ms
int64
Time window in milliseconds. For example, limit: 100 with window_ms: 60000 means 100 requests per minute.
identifier
RateLimitIdentifier
Determines how requests are bucketed for rate limiting.

Examples

{
  "policies": [
    {
      "id": "global-ratelimit",
      "name": "Rate limit by IP",
      "enabled": true,
      "match": [],
      "ratelimit": {
        "limit": 1000,
        "window_ms": 60000,
        "identifier": { "remote_ip": {} }
      }
    }
  ]
}

Identifier sources

SourceDescription
remote_ipClient IP address. Effective for anonymous traffic, but can over-limit behind shared NATs.
headerValue of a named request header. Only use behind trusted proxies that set the header.
authenticated_subjectPrincipal subject from an upstream auth policy. Most accurate for authenticated APIs.
pathRequest URL path. Creates a separate bucket per endpoint.
principal_fieldValue resolved from a dotted path into the Principal JSON (for example, source.key.meta.org_id for per-organization limits).