err:frontline:client:rate_limited429 Too Many Requests.
Example response
If you’re calling an API hosted on Unkey
Wait, then retry with backoff. Don’t retry in a tight loop. The response headers tell you how long to wait:Retry-After: seconds to wait before you retry, never lower than 1.X-RateLimit-Limit: how many requests the window allows.X-RateLimit-Remaining: how many you have left.X-RateLimit-Reset: when the window resets, as a Unix timestamp in seconds.
X-RateLimit-* headers are on successful responses too, so you can slow down before you hit the limit. If several limits apply, they describe the most restrictive one.
If you own this API
Two kinds of policy return this code. A key-auth policy withratelimits entries limits each key the same way keys.verifyKey does. A rate limit policy has its own limit and windowMs, and counts requests by one or more identifiers: the client IP, a header, the path, the authenticated subject, or a field of the principal. Common causes:
- The limit is too low for your real traffic.
- The identifier is too broad, so unrelated callers share one counter.
- The policy counts by a header that callers don’t send. When none of a policy’s identifiers are on a request, the request is rejected, so every request without that header gets this 429.
How to fix
- Raise
limitor shortenwindowMson the policy, or count by a more specific identifier. - For per-key limits, change the limit on the key or identity, or the
ratelimitsentry in the policy (name, and optionallylimit,duration, andcost). - Make sure the identifier you count by is on every request the policy matches.
- Create a new deployment. Policy changes only apply to deployments created after the change.
Related errors
err:frontline:client:usage_exceeded: the key ran out of credits rather than requests per window.err:frontline:client:invalid_key: the key failed verification before limits were checked.