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

# Rate limits

> Per-key and per-IP limits, X-RateLimit headers and 429 answers.

There are two limits, and a `429` can come from either.

**Per API key** (the application). Each API key has its own quota: by default **120 requests
per minute**, in a fixed window aligned to the clock minute. Every key counts on its own, also
two keys of the same tenant, and partner keys (`cufea_partner_`) have their own quota too. A
request counts once its key authenticates, whatever the answer; a replay of an
`Idempotency-Key` also counts. A missing or invalid key gets `401` and uses no quota.

Every response of a route that takes a key, errors included (except that `401`), carries:

| Header | Value |
| - | - |
| `X-RateLimit-Limit` | Requests the key may make in the window (`120`). |
| `X-RateLimit-Remaining` | Requests left in the current window. |
| `X-RateLimit-Reset` | Whole seconds until the window restarts (at least `1`). |

Over the quota the answer is `429` with code `rate_limited`, the three headers
(`X-RateLimit-Remaining: 0`) and `Retry-After`, equal to `X-RateLimit-Reset`. `/v1/health` and
`/openapi.json` take no key and carry none of these headers.

```http theme={null}
HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json
Retry-After: 17
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 17
```

**Per client IP** (the edge, before the application). By default 600 requests per minute per
client IP, over a sliding window, to stop abuse without a key. Its `429` carries only
`Retry-After`, without `X-RateLimit-*` headers or a problem body from the API.

Both limits are deployment settings and can change; read the headers instead of hard-coding
the numbers. `Retry-After` is in **integer seconds** (RFC 9110 `delay-seconds`, not
milliseconds): wait at least that long before the next request, rather than a fixed delay.
To avoid the `429` altogether, slow down when `X-RateLimit-Remaining` gets low. Retrying a
create or a send after a `429` is safe with its `Idempotency-Key`.


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