# Rate limits

> Limits on the REST API, gateway, webhooks, slash commands and installs.

Rate limits keep Lamma fast for everyone. Each limit below is counted separately, and the server's own slowmode still applies on top unless the bot has **Bypass slowmode**.

## REST API

| Limit | Value |
| --- | --- |
| Requests per token | 50 a second |
| Messages per bot per channel | 5 every 5 seconds |
| Request body | 64 KB |

Every `/v1` response carries `RateLimit` and `RateLimit-Policy` headers (IETF draft 8), so you can slow down before you hit a limit. Going over answers:

```http
HTTP/1.1 429 Too Many Requests
Content-Type: application/json

{ "error": "rate_limit", "retry_after": 1250 }
```

> [!NOTE]
> On `/v1`, `retry_after` is in **milliseconds**. The SDKs wait and retry for you, up to three times by default.

## Gateway

| Limit | Value |
| --- | --- |
| Connections per bot | 1 (a new one replaces the old) |
| Connection attempts | 30 a minute per address |
| Identify | 2 every 5 seconds per token, and 20 a minute per address |
| Message from the client | 8 KB |

Going over the identify limit closes the connection with code `4008`. Wait a few seconds before you connect again, and use backoff that grows on each failure.

## Webhooks

| Limit | Value |
| --- | --- |
| Per webhook | 5 requests every 2 seconds |
| Per channel | 30 a minute |
| Request body | 64 KB |

Only requests with a valid secret count, so nobody without the URL can use up its allowance. Going over answers `429` with `retry_after` in **seconds** (as on Discord) and a `Retry-After` header.

## Slash commands

People can use commands 10 times every 10 seconds each. Registering commands counts toward the normal REST limit.

## Installs

Each person can install apps 10 times an hour.
