> For the complete documentation index, see [llms.txt](https://docs.nexus.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexus.xyz/exchange/apis-and-rates/rate-limits.md).

# Rate-Limits

The gateway enforces per-API-key rate limits with a token-bucket limiter, plus a per-IP request limit and a WebSocket connection cap. Limits are tiered to support both general programmatic use and high-throughput market-making.

### Request rate (per API key)

| Tier         | Request limit | WebSocket connections | Assignment           |
| ------------ | ------------- | --------------------- | -------------------- |
| Pro          | 20 req/s      | 5                     | Default for all keys |
| Market Maker | 2,000 req/s   | 100                   | Admin-assigned       |

A per-IP limit of **50 req/s** applies in addition to the per-key limit.

When you exceed your limit, the gateway returns **HTTP 429** with a `Retry-After` header. Every response also carries `X-RateLimit-*` headers reporting your tier's ceiling and current usage, so you can pace clients without tripping the limiter.

### WebSocket connections

* **Pro keys: up to 5** active WebSocket connections; **Market Maker: up to 100**.
* Connections beyond the cap are rejected.

### Other limits

| Limit                      | Value                          |
| -------------------------- | ------------------------------ |
| HMAC timestamp window      | ±30s of server time            |
| WebSocket token lifetime   | 60s, single-use                |
| Session token lifetime     | 24h                            |
| Faucet (`/account/credit`) | 500 USDX/day per key (testnet) |

### Designing for the limits

* Batch order placement with `POST /orders/batch` instead of issuing many single `POST /orders` calls.
* Prefer WebSocket streams over REST polling for order book and trade data — it is both faster and far cheaper against your rate budget.
* Cache market metadata (`GET /markets`) rather than re-fetching it on every cycle.
* Pace from the `X-RateLimit-*` headers rather than retrying blindly after a 429.

> **Status:** testnet preview. Tier ceilings are configurable and may change as the tier system is finalized across release gates. Rate-limit state is currently in-memory at the gateway and resets on restart.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexus.xyz/exchange/apis-and-rates/rate-limits.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
