Limit the rate of access to a specified resource
Table 1. Supported parameters
| Parameter |
Required |
Data type |
Details |
| limits |
Yes |
array |
A list of rate limits to be applied, each with an operation |
| name |
Yes |
string |
The name of the rate limit action. Required. Identifies the action in log and error messages
and helps ensure that every inline limit in the action is unique within the assembly |
| target |
No |
object |
Client type that this action will apply to |
Table 2. Options for limits
| Parameter |
Required |
Data type |
Details |
| inline |
Yes |
object |
A limit that is defined in the action, in the definition field |
| ref |
Yes |
object |
A reference to a rate limit defined in the gateway configuration |
| alias |
Yes |
object |
A reference to a limit alias declared in the rateLimitMap of a plan |
Table 3. Nested properties inside
inline
| Parameter |
Required |
Data type |
Details |
| definition |
Yes |
object |
The parameters of this limit |
| name |
Yes |
string |
The name of this limit. Should be unique within this action |
| operation |
No |
object |
The operation to apply to this limit |
Table 4. Nested properties inside
definition
| Parameter |
Required |
Data type |
Details |
| dynamicValue |
No |
string or null |
JSONata expression for string to be added to the limit key |
| exceedAction |
No |
object |
Action to take when rate limit is exceeded. Applies only to rate limit operations that return
a LimitExceeded error: Consume, Check. |
| intervalLen |
Yes |
integer |
Interval length. Value must be greater than or equal to 1 |
| intervalOffset |
No |
integer |
Cause interval to start at an offset other than the default. Valid values: 0 (default) = no
change, -1 = interval will start at an arbitrary offset. Value must be greater than or equal to -1
and lesser than or equal to 0 |
| intervalUnit |
Yes |
enum (of string) |
Interval units. Must be one of: second, minute, hour, day. |
| max |
Yes |
integer |
Max allowed for this rate limit during each interval. A value of 0 means "unlimited" (any
number of calls are allowed). Value must be greater than or equal to 0. |
| weightExpr |
No |
string or null |
JSONata expression for the weight of a call (i.e., the amount by which the remaining count is
consumed or replenished). Must evaluate to a positive integer. If not set, the weight defaults to
1. |
Table 5. Options for
exceedAction
| Parameter |
Required |
Data type |
Details |
| return429 |
No |
enum (of string) |
Default: return LimitExceeded error with HTTP status 429 Too Many
Requests. |
| return500 |
No |
enum (of string) |
Return LimitExceeded error with HTTP status 500 Internal Server
Error. |
| continue |
No |
enum (of string) |
Continue transaction when limit exceeded; do not return an error |
Table 6. Options for operation
| Parameter |
Required |
Data type |
Details |
| consume |
No |
enum (of string) |
Default. Reduce the remaining count by the evaluated weight, unless limit is exceeded (in
which case count is unchanged, and action returns |
| replenish |
No |
enum (of string) |
Increase the remaining count by the evaluated weight, regardless of whether limit is
exceeded |
| check |
No |
enum (of string) |
Check and return count remaining, but do not change it. Return LimitExceeded
error if count remaining is less then evaluated weight. |
| update |
No |
enum (of string) |
Unconditionally update the count remaining with evaluated weight, regardless of whether limit
is exceeded. Does not check or return remaining count. Never returns a LimitExceeded error. |
Table 7. Nested properties inside
ref
| Parameter |
Required |
Data type |
Details |
| name |
Yes |
string |
The name of a limit defined in the components. rateLimits section of the gateway
configuration |
| operation |
No |
object |
The operation to apply to this limit. |
Table 8. Nested properties inside
alias
| Parameter |
Required |
Data type |
Details |
| name |
Yes |
string |
The name of a key in the rateLimit map of a plan |
| operation |
No |
object |
The operation to apply to this limit |
Table 9. Options for target
| Parameter |
Required |
Data type |
Details |
| all |
No |
enum (of string) |
Apply to all clients. all is default |
| subscribed |
No |
enum (of string) |
Apply to subscribed clients only |
| non-subscribed |
No |
enum (of string) |
Apply to non-subscribed clients only |
| specified |
No |
enum (of string) |
Apply only to clients with a listed groupId. All items must be unique. |