# 速率限制和配额

> 您可以发送多少,以及如何保持在限额内。

| 限制 | 免费计划 |
| --- | --- |
| 每月电子邮件 | 3,000 |
| 每天电子邮件 | 100 |
| 每秒请求数 | 每个工作空间 10 个 |
| 每封电子邮件的收件人 | 50 |

## 答复标题

| 頭條 | 意义 |
| --- | --- |
| X-速率限制 | 每秒允许的请求数 |
| X-速率限制留存 | 当前第二次会议剩余的请求 |
| 重试后 | 等待秒数,每 429 次发送 |

## 退后

```
async function send(body, attempt = 0) {
  const res = await fetch("https://sendtern.com/emails", { method: "POST", headers, body });
  if (res.status === 429 && attempt < 5) {
    const wait = Number(res.headers.get("Retry-After") || 2 ** attempt);
    await new Promise((r) => setTimeout(r, wait * 1000));
    return send(body, attempt + 1);
  }
  return res.json();
}
```

> **note:** 每日和每月配额在 UTC 时间 00:00 重置。当配额用完时,发送返回 `429` 与 `daily_quota_exceeded` 或 `monthly_quota_exceeded`。
