Automated Overrides
Manage dynamic overrides programmatically
Unkey’s ratelimit override API allows you to manage dynamic overrides in response to events in your system. For example when your customer upgrades to an enterprise plan, you might want to create overrides for them to give them higher quotas.
Let’s look at common scenarios and how to implement them using our @unkey/api SDK.
Our application has a ratelimit namespace called email.send
, which ratelimits users from sending OTP emails during login.
As identifier we’re using their email address.
Set Override
In this example, we’ll set an override for all users of our fictional customer calendso.com
.
How you detect a change is up to you, typically it’s either through a user or admin action, or some form of incoming webhook from your billing or auth provider.
Now, when we’re ratelimiting tim@calendso.com
, it will use the override settings and ratelimit them to 10 per minute.
Get Override
Retrieve a single override for an identifier within a namespace.
List Overrides
You can list all of the configured overirdes for a namespace to build your own dashboards.
Delete Override
Once they downgrade their plan, we can revoke any overrides:
Was this page helpful?