rate limit

This block is part of the redis group and was last modified in core v15.0.0.

Redis Key Selection Required

This block relies on a Redis key to perform its redis releated actions. You must manually select the Redis key you want to use in the flow in the blueprint using the Redis key selector modal. To access the modal, click the white button on the block.

rate limit v15.0.0

Counts calls per registered key and reports whether this one is still within the limit. Replaces the incr-key + ttl + condition chain every API blueprint used to build by hand: pick a key that identifies the caller (for example one with a {ip:value} placeholder), a limit, and a window. Rejected calls count towards the limit as well.

In pins 3 + flow
  • flow
    flow
  • limit required
    number

    How many calls are allowed within the window.

  • window
    number

    Length of the window in seconds.

    Default 60

  • sliding window
    condition

    When true the previous window is weighted by how much of it still overlaps, so a caller can't spend the whole budget twice around a window boundary. Costs one extra Redis read.

    Default false

Out pins 5 + flow
  • flow
    flow
  • allowed
    condition

    False when this call is over the limit. Simulated runs always report true and consume nothing.

  • remaining
    number

    Calls left in the current window, never below zero.

  • retry after
    number

    Seconds until the window resets. Zero while the call is allowed : use it for the Retry-After header on a 429.

  • key
    value

    The resolved key the counter is kept under.

  • error
    value

    NO_KEY or INVALID_LIMIT when the block is misconfigured, or the Redis error when the counter could not be read. On a Redis failure the call is allowed through rather than blocking the endpoint.

rate limit
throttle
quota
too many requests

A typical wiring for rate limit: number feeds the limit pin; the flow out pin feeds branch; the allowed out pin feeds AND.

Studio canvas example for the rate limit block: typical wiring for rate limit.

Commonly used with

In production blueprints, this block is most often wired together with:

  • number: feeds into this block. Generates a valid number from the filled custom value in the blueprint.
  • branch: this block feeds into it.
  • create: feeds into this block. Creates a new function that can be executed using the given name.
  • get guid: feeds into this block. Returns the guid (field: _meta.guid) of the given user.
  • AND: this block feeds into it. operator for a set of boolean operands will be true if and only if all the operands are true.
  • rate limit: wired in both directions with this block. Counts calls per registered key and reports whether this one is still within the limit. Replaces the incr-key + ttl + condition chain every API blueprint used to build by hand: pick a key that identifies the caller (for example one with a {ip:value} placeholder), a limit, and a window. Rejected calls count towards the limit as well.

Version history

Introduced in v15.0.0.


Back to redis Return to the main group to view all sub-groups Back to redis Return to the group to view all blocks within this group