> For the complete documentation index, see [llms.txt](https://ocx.gitbook.io/ocx-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ocx.gitbook.io/ocx-doc/ocx/reference/rate-limits.md).

# rate limits

OCX rate-limits order-path endpoints per user to protect the book and ensure fair access. Public read endpoints (markets, orderbook, OHLC, oracle prices) are **not** rate-limited.

## Which endpoints are limited?

The limit applies to the **order path**:

* `POST /orders` and `POST /orders/:id/cancel`
* `POST /orders/cancel-all`
* `POST /quotes`, `POST /quotes/bulk`
* `POST /orders/:id/modify`
* `POST /perps/orders` and its cancel / modify variants
* `POST /perps/quotes`, `POST /perps/quotes/bulk`

Account reads (`GET /perps/positions`, `GET /wallet/balance`, etc.), public market data, and SSE / WebSocket subscriptions are not rate-limited.

## Default limits

| Tier         | Limit                                                    |
| ------------ | -------------------------------------------------------- |
| Standard     | 120 order-path requests / minute                         |
| Market maker | Negotiated separately — typically 10× standard or higher |

Limits are enforced per user ID, across all credentials belonging to that user (session, JWT, and every API key the user has minted).

## Response when rate-limited

HTTP status: `429 Too Many Requests`.

```json
{
  "error":        "RateLimitError",
  "code":         "ORDER_RATE_LIMIT",
  "message":      "Order rate limit exceeded",
  "retryAfterMs": 1000
}
```

`retryAfterMs` is the minimum time to wait before retrying. A `Retry-After` HTTP header with the value in seconds is also set.

## Best practices

* **Backoff on 429.** Respect `retryAfterMs` and add jitter when multiple workers share a credential.
* **Prefer bulk endpoints.** A single `POST /quotes/bulk` with 20 quotes counts as one request. Issuing 20 separate `POST /quotes` calls counts as 20.
* **Batch cancels.** `POST /orders/cancel-all` with filters is one request; looping over individual cancels is `N` requests.
* **Maintain a local book.** Subscribe to the orderbook stream and compute quote targets locally instead of polling public snapshots.

## Per-key rate pools (roadmap)

Per-API-key rate pools are on the roadmap — a single user will be able to allocate slices of their overall limit to specific keys. Until then, all of a user's keys share the user-level pool.


---

# 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:

```
GET https://ocx.gitbook.io/ocx-doc/ocx/reference/rate-limits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
