# Rate limits

> Per key: a limit a minute and a quota a day.


| | Default | Set by |
|---|---|---|
| Requests a minute, per key | 60 | SiteSwap, when it approves the key (up to 1,200) |
| Requests a day (UTC), per key | 10,000 | SiteSwap, when it approves the key |
| Requests a minute, per sign-in token | 120 | |
| Wrong keys from one address | 30 a minute | |
| Sign-in tries | 12 every 15 minutes per address | |

The limits hold across all of SiteSwap's servers: they are counted in the database, not in one server's memory.

Over the minute limit, a call answers `429 rate_limited` with `Retry-After` in seconds. Over the day's quota it answers `429 daily_quota` until midnight UTC. The usual form limits still apply on top, for example how many listings a company may post a day (`429 daily_limit`).

```javascript
async function call(url, init) {
  for (let i = 0; i < 5; i++) {
    const res = await fetch(url, init);
    if (res.status !== 429) return res;
    await new Promise((r) => setTimeout(r, Number(res.headers.get("Retry-After") || 60) * 1000));
  }
  throw new Error("still rate limited");
}
```
