> For the complete documentation index, see [llms.txt](https://www.boxhero.io/docs/llms.txt). Every page is available as Markdown by appending `.md` to its URL; this page is [Markdown](https://www.boxhero.io/docs/zh-cn/developers/api/rate-limiting.md).

# 速率限制

> 了解 BoxHero API 如何按团队限制请求速率，以及如何退避和重试。

为了让所有用户都能稳定使用服务，BoxHero API 会限制每个团队可以发送的请求数量。

## 按团队限制

属于同一团队的所有 API 令牌共享相同的限制。在一个团队中签发更多令牌并不会提高限制。

## 达到限制时

API 会返回 `429` 和 `type` 为 `/errors/too-many-requests` 的[错误信封](https://www.boxhero.io/docs/zh-cn/developers/api/errors.md)。响应头会告诉您何时可以重试：

| 请求头 | 说明 |
| --- | --- |
| `Retry-After` | 重试前需要等待的秒数 |
| `RateLimit`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` | 当前限制、剩余请求数以及限制重置的时间 |

请等待 `Retry-After` 中指定的时间后再重试。如果需要连续发送大量请求，请将其分散发送，而不要一次性全部发送。

> **Note**
>
> 限制可能会变化。请从响应头中读取限制，而不要在客户端中硬编码速率。
