# On Rate-Limiting (/api/using-the-api/on-rate-limiting)

Per-IP limits for reads, writes, and batches, and how to back off.

The Connect API is rate-limited per source IP, at the edge, before a request
reaches the application. Exceed a limit and the request is rejected with
`429 Too Many Requests`. That rejection happens ahead of the API, so it carries
no JSON body: match on the status code, not on an error `code`.

The limits are:

| Requests                           | Limit         |
| ---------------------------------- | ------------- |
| Reads (`GET`)                      | 10 per second |
| Writes (`POST`, `PATCH`, `DELETE`) | 5 per second  |
| `POST /orders:import`              | 10 per minute |
| `POST /orders:submit`              | 10 per minute |

`:import` and `:submit` are counted in their own separate buckets, and each
request carries up to 100 orders, so each endpoint tops out at 1000 orders per
minute. That is the reason to prefer the batch endpoints over a loop of
single-resource calls: importing 100 orders spends one request against the
per-minute budget, where 100 creates spend 100 requests against the
5-per-second write budget. Every batch endpoint caps the array at 100 and
rejects a longer one with `400 Bad Request` before processing any item, so size
your batches accordingly.

Keep breaching a limit and the ban lengthens: sustained breach over roughly
three minutes triggers a temporary block of about twenty minutes, so a client
that keeps hammering after a `429` locks itself out for longer than it would
have waited. Handle a `429` by backing off instead:

- Wait and retry, using
  [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff).
- Add a random delay to each attempt, so a fleet of your own workers does not
  retry in lockstep and cause a
  [thundering herd](https://en.wikipedia.org/wiki/Thundering_herd_problem).
- Do not retry a `4xx` other than `429`. Those describe the request itself, and
  resending it unchanged fails the same way.

Raising a limit is a backwards-compatible change under the
[versioning policy](/versioning), so the numbers can go up without a new API
version. If you have a use case that needs sustained higher throughput, tell us
about it before you build it and we will size the limits around it.