> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trdrs.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate limits

> Stay inside the market data rate limit, and wait the time a 429 gives you before you retry.

The market data routes, `/api/market/*`, are rate limited per IP address. The limit is sized so an
ordinary client never meets it. Use this page if you see a `429`, or before you build something
that makes many market data calls at once.

The limit is a token bucket:

| | |
| - | - |
| Burst | 120 requests, which you can spend at once |
| Refill | 30 requests per second |

A chart's first load, a long scroll back through history and several panels polling quotes all fit
inside the burst. If you're being limited, you're probably retrying in a tight loop or turning one
user action into many requests.

## Handle a 429

Over the limit, the answer is `429` with a `Retry-After` header and a `retryAfterSec` field in the
body, both in seconds:

```json theme={null}
{ "error": "rate_limited", "retryAfterSec": 2 }
```

Wait that long, then send the same request again. Don't retry sooner: the bucket refills at a fixed
rate, so extra requests only push your own recovery back.

```ts theme={null}
if (res.status === 429) {
  const wait = Number(res.headers.get('Retry-After') ?? 1)
  await new Promise((r) => setTimeout(r, wait * 1000))
  // Then send the same request again.
}
```

Trading and account routes have no bucket. They're protected by [idempotency](/api/idempotency) and
risk checks instead, which is the protection those routes need.
