Skip to main content
RateLimit defines gateway-level rate limiting with configurable key sources. 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.
key
RateLimitKey
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,
        "key": { "remote_ip": {} }
      }
    }
  ]
}

Key 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_claimNamed claim from the Principal’s claims map (for example, org_id for per-organization limits).