> The index of all pages is at https://docs.afffast.com/llms.txt.

# Rate limits

How many requests a key can send, and how to read the limit headers.

The API limits the requests of each API key. The default limit is **100 requests in 60 seconds**. A request that is over the limit gets `429` and the error code [`rate_limit_exceeded`](https://docs.afffast.com/errors/rate-limit-exceeded.md).

The MCP server uses the same limit. A tool call counts as one request.

## The headers

Each response has these headers:

| Header                | Meaning                                                   |
| --------------------- | --------------------------------------------------------- |
| `RateLimit-Limit`     | The number of requests that the key can send in a window. |
| `RateLimit-Remaining` | The number of requests that the key can still send.       |
| `RateLimit-Reset`     | The number of seconds until the window resets.            |

A `429` response also has `Retry-After`. It is the number of seconds to wait.

## What to do when you get a 429

1. Stop sending requests.
2. Wait for `Retry-After` seconds.
3. Send the request again.

```js
async function request(url, options, attempt = 0) {
  const response = await fetch(url, options);
  if (response.status !== 429 || attempt >= 5) return response;
  const seconds = Number(response.headers.get("retry-after") ?? 1);
  await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
  return request(url, options, attempt + 1);
}
```

## Use fewer requests

- **Use conditional requests.** Each `GET` response has a weak `ETag`. Send it back in `If-None-Match`. When the data did not change, the API answers `304` with no body. A `304` does not count against the limit. This helps a lot when you poll.
- **Use webhooks** instead of polling. See [Webhooks](https://docs.afffast.com/docs/webhooks.md).
- **Use batch operations.** `POST /v1/links/batch` and `POST /v1/deeplinks` take up to 100 items in one request.
- **Use big pages.** Set `limit=100` on a list. See [Pagination](https://docs.afffast.com/docs/pagination.md).

## Other limits

- The postback endpoint has its own limit for each IP address and each token. See [Postbacks](https://docs.afffast.com/docs/postbacks.md).
- The plan limits of your workspace (connections, conversions and clicks) are separate. See [Plans and billing](https://docs.afffast.com/docs/plans.md). They never stop redirects or click logging.
