学习

速率限制和配额

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

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

答复标题

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

退后

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

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