Documentation Index
Fetch the complete documentation index at: https://mintlify.com/get-convex/rate-limiter/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Thereset() method removes a rate limit from the database, resetting it to its initial state. The next request will start fresh with full capacity.
Method Signature
Parameters
The context object from a mutation, including
runMutation. Only the runMutation property is used, so you can destructure it: { runMutation }.The name of the rate limit to reset. This will reset all shards for this rate limit name.
Optional arguments to specify which rate limit instance to reset.
If provided, resets only the rate limit for this specific key (e.g., a specific user). If not provided, resets the shared global rate limit for this name.
Return Type
Returns a promise that resolves when the reset is complete. No value is returned.
When to Use
Thereset() method is useful in several scenarios:
- User upgrades - Reset limits when a user upgrades to a premium plan
- Administrative actions - Manually clear rate limits for support purposes
- Testing - Reset limits between test runs
- Abuse mitigation - Clear limits after resolving a security incident
- Forgiveness - Give users a fresh start after explaining the limits
Examples
Reset Global Rate Limit
Reset User-Specific Rate Limit
Reset on Subscription Upgrade
Admin Tool with Key Selection
Testing Utility
Side Effects
For fixed window rate limits without a specified
start time, resetting will cause the new window to begin at a random time. The window alignment will be different after the reset.The
reset() method affects all shards for the specified rate limit name. With sharded rate limits, all shards are deleted and will be recreated on the next request.Notes
Resetting a rate limit that doesn’t exist (never been used) is a no-op. It doesn’t throw an error.
Related Methods
limit()- Enforce rate limitsgetValue()- Check current state before resettingcheck()- Verify reset was successful