# Rate limits

> How many calls a key may make, the headers that say where you are, and what to do when you hit the limit.

On the web: https://www.aeyho.com/docs/api/rate-limits

## The limits

Each key has two limits a minute:

| Limit | Per key, per minute |
|---|---|
| All requests | 120 |
| Requests that change something (`POST`, `PATCH`, `DELETE`) | 30 |

A minute starts with the key's first request, and the counts start again 60 seconds later. Different keys have their own counts.

## The headers

Every answer to a call with a valid key carries:

| Header | What it says |
|---|---|
| `RateLimit-Limit` | The limit this request counted against: 120 for reads, 30 for changes. |
| `RateLimit-Remaining` | How many requests of that kind are left this minute. |
| `RateLimit-Reset` | Seconds until the counts start again. |

## When you hit a limit

The call answers `429` with the code [`rate_limited`](/docs/api/errors#rate_limited) and a `Retry-After` header in seconds. Wait that long, then go on.

To stay under the limits:

- Poll a reel every 10 to 15 seconds, not faster. Or use [webhooks](/docs/api/webhooks) and don't poll at all.
- Ask for bigger pages (`?limit=100`) instead of many small ones.
- Slow down when `RateLimit-Remaining` gets low.

## Try it

```bash
curl -i https://www.aeyho.com/api/v1/account \
  -H "Authorization: Bearer $AEYHO_KEY" | grep -i ratelimit
```
