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 e.g. 1s
for 1
second, 1h45m
for 1 hour and 45 minutes, 1d
for 1 day.
Valid string time units are:
s
for seconds.m
for minutes.h
for hours.d
for 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 will be 60 seconds.
For tokenBucket
, the time interval for the refill rate (see below). For
example, if you set the interval to 60
and the refill rate to 10
, the bucket
will refill 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 e.g. 1s
for 1 second, 1h45m
for 1 hour and
45 minutes, 1d
for 1 day.
Valid string time units are:
s
for seconds.m
for minutes.h
for hours.d
for days.
Refill rate
Section titled “Refill rate”Type: int
(required)
Algorithms: tokenBucket
.
The number of tokens to add to the bucket at each interval (see above). 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 will refill 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 will refill until
it hits the capacity. This is an integer value ranging from 0
to
4,294,967,295
.