Upstash · Method
ratelimit.limit
Upstash Ratelimit provides methods to check, wait for, inspect, and reset request limits. It also supports changing and reading a global dynamic limit at runtime.
Last updated
Syntax
ratelimit.limit(identifier: string, req?: { geo?: Geo; rate?: number; ip?: string; userAgent?: string; country?: string }): Promise<RatelimitResponse>
ratelimit.blockUntilReady(identifier: string, timeout: number): Promise<RatelimitResponse>
ratelimit.resetUsedTokens(identifier: string): Promise<void>
ratelimit.getRemaining(identifier: string): Promise<{ remaining: number; reset: number }>
ratelimit.setDynamicLimit(options: { limit: number | false }): Promise<void>
ratelimit.getDynamicLimit(): Promise<{ dynamicLimit: number | null }>In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
RatelimitResponseblockUntilReadyresetUsedTokensgetRemainingsetDynamicLimitgetDynamicLimitdynamicLimitspending