Skip to main content
Deploying applications on Unkey is in public beta. To try it, select Projects in the dashboard sidebar and create a project. Deployed resources are free until August 1, 2026. We’re eager for feedback, so let us know what you think on Discord, X, or email support@unkey.com.
The rate limiting policy enforces request limits on any route that matches the policy’s match expressions. Requests that exceed a configured limit receive a 429 response, protecting your app from traffic spikes and abuse. Each rate limit policy specifies a maximum number of requests within a time window (for example, 100 requests per 60 seconds) and an identifier that determines how the gateway groups requests for counting. Rate limit state is managed by Unkey’s distributed rate limiting service, so limits are consistent across multiple gateway instances.

Configuration

You can create and manage rate limit policies in your project’s policy settings in the dashboard. Each policy requires:
  • Limit: the maximum number of requests allowed in the window
  • Window: the time window in which the limit applies (for example, 60 seconds)
  • Identifier: how the gateway determines which requests share a rate limit bucket
  • Match conditions: which requests the policy applies to (optional, an empty match list applies to all requests)
Place authentication policies before rate limit policies in your policy list if you want to use an authenticated identifier (such as the authenticated subject or a principal field).

Identifiers

The identifier determines how the gateway groups requests for counting:

Response headers

When the gateway evaluates a rate limit, it includes the rate limit state in the response headers: These headers appear on both successful and rate-limited responses, so your clients can monitor their usage proactively. When multiple policies write rate limit headers (for example, a per-key limit from API key authentication and a standalone rate limit policy), the gateway keeps the most restrictive values.

Exceeded rate limit behavior

When a rate limit is exceeded, the gateway returns HTTP status 429 Too Many Requests with the Retry-After header and a JSON error body:
Your app never sees rate-limited requests.
Last modified on June 24, 2026