The problem with code-defined ratelimits is that managing different limits per user is not really feasable. You’d need to keep a list of identifiers hardcoded in your code and redeploy your application whenever one of them changes.

With unkey you can add custom overrides dynamically and we’ll roll them out to every edge location quickly.

Overriding limits for an identifier


Head over to your namespace page

Click “Ratelimit” in the sidebar > select your namespace > Overrides


Create a new override

Enter the identifier to override, a custom limit and custom duration.



Click Create to roll out the override globally. It may take up to 60s at most but is usually done in just a few seconds.

From now on, when the specified identifier gets ratelimited, it’ll use the custom limits, rather than what is defined in your code.

Wildcard Rules

You can use wildcards (*) in your override to match multiple identifiers. Exact override matches take precedence over wildcard matches, but there’s no guarantee of order between multiple wildcard matches yet.

Example: Given a base limit of 10/60s and these overrides:

  • * 20/60s
  • 100/s

This would result in the following applied ratelimits:

requested identifiermatchused ratelimit

Here’s an example of setting higher limits for all emails from the domain.


invite:*invite:abc, invite:hello world