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

# Rate Limits and Access Tiers

> Mainnet access rules for DerivaDEX: DDX-based trading tiers, collateral caps, and public IP-based API and WebSocket limits.

DerivaDEX mainnet is open to a limited number of qualified users. This release uses DDX-based trading tiers together with IP-based gateway limits on the public APIs and WebSocket endpoints.

## At a glance

| Item              | Value                               | Notes                                                                              |
| ----------------- | ----------------------------------- | ---------------------------------------------------------------------------------- |
| Mainnet access    | Limited number of qualified users   | Mainnet onboarding is not fully open.                                              |
| Trading tiers     | Based on DDX deposited on DerivaDEX | Tiers use the trader's exchange-side DDX balance, not an external wallet snapshot. |
| Collateral cap    | Also based on deposited DDX         | The same DDX balance determines the current collateral cap.                        |
| Public API limits | Based on public IP                  | The tables below describe the public, non-whitelisted limits only.                 |

## Trading request tiers

These limits apply to authenticated trading requests submitted to `POST /v2/request`.

| Tier   |        Deposited DDX balance | Per-trader request limit | Per-trader burst |    Collateral cap |
| ------ | ---------------------------: | -----------------------: | ---------------: | ----------------: |
| Tier 0 |                    `< 1,000` |               `900/hour` |              `1` |     `10,000 USDC` |
| Tier 1 | `>= 1,000` and `< 1,000,000` |             `1,800/hour` |              `5` |     `10,000 USDC` |
| Tier 2 |               `>= 1,000,000` |           `180,000/hour` |             `50` | `10,000,000 USDC` |

Deposits are capped at the strategy level. DDX withdrawals are checked against the trader's total margin across strategies, so a withdrawal that would move the trader into a lower DDX band is rejected if the trader's aggregate margin would exceed the new cap.

## Trading requests

| Applies to            |                        Limit |                        Burst | Notes                                                                                   |
| --------------------- | ---------------------------: | ---------------------------: | --------------------------------------------------------------------------------------- |
| Shared public IP pool |                    `3000r/m` |                         `50` | Applied before the trader-level bucket.                                                 |
| Per public IP         |                      `30r/m` |                          `5` | Main public-IP gate for trading requests.                                               |
| Trader address        | See trading tier table above | See trading tier table above | Enforced after the gateway checks. Exceeding the trader bucket returns `429 RateLimit`. |

Public trading requests must clear both the IP-based gateway limit and the trader-address bucket.

## Trading request examples

| Situation                                                                           | Outcome                                                                                                                                 |
| ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| A trader with `< 1,000 DDX` sends one request after sitting idle                    | Accepted. Tier 0 allows a single-request burst.                                                                                         |
| The same trader immediately sends a second request                                  | The trader bucket is rate-limited. Tier 0 has burst `1`, so requests have to be paced.                                                  |
| A trader with `>= 1,000` and `< 1,000,000 DDX` sends five requests in a short burst | Accepted. Tier 1 allows burst `5`.                                                                                                      |
| The same Tier 1 trader immediately sends a sixth request without waiting            | The trader bucket is rate-limited until capacity refills.                                                                               |
| A trader with `>= 1,000,000 DDX` sends a short burst of 20 trading requests         | Accepted by the trader bucket. Tier 2 allows much higher steady-state throughput and a burst up to `50`.                                |
| Many traders share one public IP and that IP crosses `30r/m` on `POST /v2/request`  | Further requests from that IP are gated at the public-IP layer even if some individual traders are still within their own trader tiers. |

## Public REST endpoints

| Endpoint class                            |                                                     Limit |                   Burst | Notes                                                                                                                                                                       |
| ----------------------------------------- | --------------------------------------------------------: | ----------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Public Stats REST API (`/stats/api/v1/*`) | `10r/s` per public IP, plus shared frontend pool `100r/s` | `5` per IP, `30` shared | Covers trader and strategy lookups, aggregations, market snapshots, and system/status endpoints published in `/api-docs`. These limits are enforced at the webserver layer. |

## Realtime connections

| Applies to                                                      |                   Limit |                     Burst | Notes                                                                                     |
| --------------------------------------------------------------- | ----------------------: | ------------------------: | ----------------------------------------------------------------------------------------- |
| Upgrade requests per public IP                                  |                 `20r/m` | default (`0` extra burst) | Applies to connection attempts at the webserver layer.                                    |
| Shared frontend pool                                            |                `100r/s` |                      `30` | Shared with other frontend traffic.                                                       |
| Open sockets per public IP                                      |                    `10` |                       n/a | Enforced with `limit_conn` at the webserver layer.                                        |
| WebSocket messages on `wss://testnet.derivadex.io/realtime-api` | No active app-layer cap |                       n/a | No application-level WebSocket message rate limit is currently enforced on this endpoint. |

## Realtime examples

| Situation                                                                                    | Outcome                                                                                 |
| -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| One public IP opens a few websocket connections to `wss://testnet.derivadex.io/realtime-api` | Accepted, as long as the IP stays within the connection-attempt and open-socket limits. |
| One public IP tries to open more than `10` concurrent realtime sockets                       | Additional connections are refused by the concurrent-socket limit.                      |
| One public IP repeatedly reconnects and exceeds `20` upgrade attempts per minute             | Further connection attempts are rate-limited at the websocket-upgrade layer.            |

## When a limit is hit

| Condition                                                                              | Public outcome                                            |
| -------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| Trader exceeds the trading request bucket                                              | `429 RateLimit`                                           |
| Public IP exceeds a gateway request limit on trading, stats, or realtime upgrade paths | `503`                                                     |
| Public IP exceeds the concurrent realtime socket limit                                 | `503`                                                     |
| Trader is denied access by policy                                                      | `422 SafetyFailure` with `AccessDenied`                   |
| DDX withdrawal would leave too much collateral for the new tranche                     | `422 SafetyFailure` with `TooMuchCollateralToWithdrawDDX` |

Mainnet currently uses the collateral caps shown above.

## Related references

* [Error Reference](/reference-public/error-reference)
* [Product and Trading Specifications](/reference-public/product-and-trading-specifications)
* [Signed Private Requests](/api-reference/rest/signed-requests)
* [REST API](/api-reference/rest)
