Rate limit configuration
Each Arcjet rate limit rule has its own configuration depending on the algorithm used.
Type: int (required)
Algorithms: fixedWindow, slidingWindow.
The maximum number of requests allowed in the time window. This is an integer
value ranging from 0 to 4,294,967,295.
Window
Section titled “Window”Type: string | int (required)
Algorithms: fixedWindow.
The time window the rate limit applies to. Can be an int specifying the window
size in seconds ranging from 0 to 4,294,967,295. Alternatively, you can use
a string with a sequence of numbers, each with a unit suffix, such as 1s for
1 second, 1h45m for 1 hour and 45 minutes, 1d for 1 day.
The following string time units are valid:
sfor seconds.mfor minutes.hfor hours.dfor days.
Interval
Section titled “Interval”Type: string | int (required)
Algorithms: slidingWindow, tokenBucket.
For slidingWindow, the time interval for the rate limit. For example, if you
set the interval to 60 the sliding window is 60 seconds.
For tokenBucket, the time interval for the refill rate (described later on
this page). For example, if you set the interval to 60 and the refill rate to
10, the bucket refills 10 tokens every 60 seconds.
In both cases, the value can be an int in seconds ranging from 0 to
4,294,967,295. Alternatively, you can use a string with a sequence of
numbers, each with a unit suffix, such as 1s for 1 second, 1h45m for 1 hour
and 45 minutes, 1d for 1 day.
The following string time units are valid:
sfor seconds.mfor minutes.hfor hours.dfor days.
Refill rate
Section titled “Refill rate”Type: int (required)
Algorithms: tokenBucket.
The number of tokens to add to the bucket at each interval (described earlier on
this page). This is an integer value ranging from 0 to 4,294,967,295. For
example, if you set the interval to 60 and the refill rate to 10, the bucket
refills 10 tokens every 60 seconds.
Capacity
Section titled “Capacity”Type: int (required)
Algorithms: tokenBucket.
The maximum number of tokens the bucket can hold. The bucket refills until it
hits the capacity. This is an integer value ranging from 0 to 4,294,967,295.