> ## Documentation Index
> Fetch the complete documentation index at: https://humain.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate limits

> Humain applies rate limits at two levels — per-credential burst protection and per-session sustained limits — to keep the platform stable for all customers.

## Two layers of rate limiting

### Burst protection (per credential)

A short sliding window of **10 seconds** caps the number of requests any single credential can send.
When exceeded, the credential is blocked for **60 seconds** and the API returns `429 RATE_LIMITED`
with `retry_after_seconds: 60`. This protects against runaway devices and credential misuse.

### Sustained rate limit (per session)

A guardrail rule (configured per kiosk in the admin panel) limits the number of messages per minute
within a single session. This is the primary tool for controlling cost and preventing abuse by end
users.

## Rate limit response

> [!NOTE]
>
> This HTTP error shape applies to `POST /v1/sessions` and other REST calls. If the sustained
> limit is hit mid-conversation, the WebSocket instead sends
> `{"type":"error","code":"TURN_ERROR","message":"RATE_LIMITED: ..."}` — see
> [WebSocket streaming](https://humain.mintlify.site/connections/websocket-streaming.md#error-frames).

When either limit is hit over HTTP, the API returns:

```http theme={null}
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 60

{
  "error": "RATE_LIMITED",
  "message": "Rate limit exceeded.",
  "details": {
    "retry_after_seconds": 60
  }
}
```

The response includes both a standard `Retry-After` HTTP header and `details.retry_after_seconds`
in the body — they carry the same value. Standard HTTP clients (curl, many libraries) can read
the header directly. Read either source and wait at least that many seconds before retrying.

## Retry strategy

**1. Check the status code**

`429` is the only retriable rate limit response. Do not retry `400`, `401`, or `403` —
those indicate a problem that retrying will not fix.

**2. Read retry\_after\_seconds**

Use the value from `details.retry_after_seconds`. If absent, default to 5 seconds.

**3. Add jitter**

When multiple devices share a credential, add random jitter (0–2 s) to prevent a
thundering-herd of retries at exactly the same moment.

**4. Cap your retries**

Retry at most 3 times. If still rate-limited after 3 attempts, surface an error to the
user rather than spinning indefinitely.

## Configuring limits

Sustained session rate limits are set in the admin panel:

1. Open your workspace.
2. Navigate to **Kiosk → Guardrails → Rate limit**.
3. Set **Max messages per minute** and **Max tokens per turn**.

> [!NOTE]
>
> Burst limits are fixed per plan and cannot be configured. Contact support if your legitimate
> traffic pattern regularly hits the burst limit.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.