Rate limit configuration for a contract.
This type is used in contract metadata to configure rate limiting behavior.
const getTodoContract = c .get("/api/todos/:id", "getTodo") .pathParams(z.object({ id: z.string() })) .meta({ auth: "required", rateLimit: { max: 60, windowSec: 60, scope: "user", }, }) .responses({ 200: z.object({ id: z.string(), name: z.string() }) }); Copy
const getTodoContract = c .get("/api/todos/:id", "getTodo") .pathParams(z.object({ id: z.string() })) .meta({ auth: "required", rateLimit: { max: 60, windowSec: 60, scope: "user", }, }) .responses({ 200: z.object({ id: z.string(), name: z.string() }) });
Maximum number of allowed hits within the window.
Optional
Scope for identifying the rate limit key.
Default: "global".
Length of the window in seconds.
Rate limit configuration for a contract.
This type is used in contract metadata to configure rate limiting behavior.
Example