---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# EdgeRateLimiter.prototype.checkRate

Increment an entry in the rate counter and check if the entry has exceeded some average number of requests per second (RPS) over the given window.
If the entry is over the RPS limit for the window, add to the penaltybox for the given `timeToLive`.

Valid `timeToLive` is 1 minute to 60 minutes and `timeToLive` value is truncated to the nearest minute.

## Syntax
```js
checkRate(entry, delta, window, limit, timeToLive)
```

### Parameters

- `entry` _: string_
  - The name of the entry to increment and check
- `delta` _: number_
  - The amount to increment the `entry` by
- `window` _: number_
  - The time period to check across, has to be either 1 second, 10 seconds, or 60 seconds
- `limit` _: number_
  - The requests-per-second limit
- `timeToLive` _: number_
  - In minutes, how long the entry should be added into the penalty-box
  - Valid `timeToLive` is 1 minute to 60 minutes and `timeToLive` value is truncated to the nearest minute.


### Return value

Returns `true` if the entry has exceeded the average RPS for the window, otherwise returns `false`.

### Exceptions

- `TypeError`
  - Thrown if the provided `name` value can not be coerced into a string
  - Thrown if the provided `delta` value is not a positive finite number.
  - Thrown if the provided `window` value is not either, 1, 10, or 60.
  - Thrown if the provided `limit` value is not a positive finite number.
  - Thrown if the provided `timeToLive` value is not either, a number between 1 and 60 inclusively.

