Skip to main content

Rate Limit

Rate Limit configuration allows Inigo's users to apply fine-grained traffic controls. Not all clients are the same; you may have authenticated and unauthenticated clients using your application. Using the rate limit capability of inigo, you can enforce rate limiting policies depending on the authentication and authorization context of your clients.


Sample Config

rate_limit.yaml
kind: RateLimit
name: demo
label: starwars
spec:
profiles:
- name: guest
path_calls:
- path: query.films
allowance: 5
period: 10m
- path: query.people
allowance: 10
period: 1h30m

Spec

This section defines the format of Inigo's RateLimit type configuration files. Fields marked as required must be specified if the parent is defined.

FieldTypeDescription
profile_default_valuesRateLimitProfileDefaultValues
profiles[RateLimitProfile]

RateLimitProfileDefaultValues

FieldTypeDescription
extension_outputbooleanAdds rate limit-related information to the extensions response JSON key named rate_limiter.
path_calls[RateLimitCallConfig]Adds rate limit based on path.
For example: "query.version.date"
type_calls[RateLimitCallConfig]Adds rate limit based on type + field.
For example: "Version.date"
credits[RateLimitCreditConfig]

RateLimitCallConfig

FieldTypeDescription
pathstring required
allowancestring | number requiredIt can be either a regular number or a string with one of the following suffixes 'k', 'M'.

Example: 1k, 20M.
periodstring requiredString represents the duration in the form "72h3m0.5s".
filterRateLimitFilter

RateLimitFilter

FieldTypeDescription
has_errorsboolean

RateLimitCallConfig

FieldTypeDescription
pathstring required
allowancestring | number requiredIt can be either a regular number or a string with one of the following suffixes 'k', 'M'.

Example: 1k, 20M.
periodstring requiredString represents the duration in the form "72h3m0.5s".
filterRateLimitFilter

RateLimitFilter

FieldTypeDescription
has_errorsboolean

RateLimitCreditConfig

FieldTypeDescription
periodstring requiredString represents the duration in the form "72h3m0.5s".
allowancestring | number requiredIt can be either a regular number or a string with one of the following suffixes 'k', 'M'.

Example: 1k, 20M.

RateLimitProfile

FieldTypeDescription
Namestring requiredName of the profile.
extension_outputbooleanAdds rate limit-related information to the extensions response JSON key named rate_limiter.
path_calls[RateLimitCallConfig]Adds rate limit based on path.
For example: "query.version.date"
type_calls[RateLimitCallConfig]Adds rate limit based on type + field.
For example: "Version.date"
credits[RateLimitCreditConfig]

RateLimitCallConfig

FieldTypeDescription
pathstring required
allowancestring | number requiredIt can be either a regular number or a string with one of the following suffixes 'k', 'M'.

Example: 1k, 20M.
periodstring requiredString represents the duration in the form "72h3m0.5s".
filterRateLimitFilter

RateLimitFilter

FieldTypeDescription
has_errorsboolean

RateLimitCallConfig

FieldTypeDescription
pathstring required
allowancestring | number requiredIt can be either a regular number or a string with one of the following suffixes 'k', 'M'.

Example: 1k, 20M.
periodstring requiredString represents the duration in the form "72h3m0.5s".
filterRateLimitFilter

RateLimitFilter

FieldTypeDescription
has_errorsboolean

RateLimitCreditConfig

FieldTypeDescription
periodstring requiredString represents the duration in the form "72h3m0.5s".
allowancestring | number requiredIt can be either a regular number or a string with one of the following suffixes 'k', 'M'.

Example: 1k, 20M.