# Rate Limits

Fixed 60-second window, per key, per endpoint category. Independent bucket accounting — read quota exhaustion never blocks trading, and vice versa. Every response on a limited endpoint carries `X-RateLimit-*` headers; a `429` adds `Retry-After` and the exact wait in `error.details.retry_after_ms`.

## Published limits

Each scope has a fixed per-minute budget, counted in a 60-second tumbling window per API key (an OAuth access token counts per app and account; a request without a credential counts per client IP address). **The limits are identical for every tier** — `sandbox`, `self_serve`, `read_live`, `trade_capped`, `trade_full`, `genesis` and `partner` all receive the same per-scope budget. Trust tiers raise your *notional* ceilings (per-order + daily), never your request rate. Sandbox keys (`tier=sandbox`) share the same host and the same limits — the $10 per-order + $100 daily notional caps handle safety, not throttling.

| Scope | Covers | Limit (per key · per minute) |
|---|---|---|
| `markets:read` | Market data reads — markets, orderbook, price history, `/v1/data/history`, quotes; `GET /v1/webhooks` and price-alert reads | 600 |
| `orders:read` | Order + fill reads | 300 |
| `orders:create` | Order placement. Each order in `POST /v1/orders/batch` counts as one, as does each quote in `POST /v1/mm/quotes` and each item in `POST /v1/rfq/batch` and `POST /v1/rfq/quotes/batch` | 30 |
| `orders:cancel` | Order cancellation (single + batch) | 60 |
| `portfolio:read` | Portfolio, positions, balances | 120 |
| `subaccounts:read` | Subaccount + trading-agent reads | 120 |
| `subaccounts:manage` | Subaccount create / delete / transfer, trading-agent revoke | 10 |
| `webhooks:manage` | Webhook register / update / delete / rotate-secret / test / replay; price-alert create / cancel | 20 |

Endpoints outside these eight buckets have no per-key request budget; a few public endpoints have their own per-IP limit ([below](https://docs.predictasiax.com/rate-limits#ip-limit)). Exceeding a scope returns `429 RATE_LIMITED` with the message `scope <name> limit <n>/min exceeded`; the budget in force is in `error.details.limit`.

## Batches count each item

A batch uses as much of the `orders:create` budget as it has items: a 20-order `POST /v1/orders/batch` uses 20 of the 30 a minute. A request that would take the window past its limit is refused whole with `429 RATE_LIMITED` and is not counted, so a refused batch does not use up the rest of the window and smaller requests still go through. Its message ends `(this request counts <n>)`, and `error.details` adds `cost` (the items in the request) and `used` (the window's count before it). Size batches to `X-RateLimit-Remaining`. A `POST /v1/orders/batch` with no orders or more than 20 is rejected with `400 VALIDATION_FAILED` before anything is counted.

## Under heavy load

When the platform is under heavy load, every per-key limit can be halved for a while, never below 20 a minute, so a full 20-order batch still fits in one window. `X-RateLimit-Limit`, `error.details.limit` and `GET /v1/rate-limits` always show the limit in force, and it returns to the value in the table on its own. Pace on `X-RateLimit-Remaining` rather than on the table.

## Response headers

Windows are fixed 60-second buckets aligned to the minute (UTC), counted per API key and per scope. Every response from an endpoint in one of the buckets above carries:

| Header | Meaning |
|---|---|
| `X-RateLimit-Limit` | The scope's budget per window |
| `X-RateLimit-Remaining` | Requests left in the current window |
| `X-RateLimit-Reset` | Unix time (seconds) when the current window ends |

If a request counts against more than one scope, the headers describe the one with the fewest requests left. Browser clients can read them: they are listed in `Access-Control-Expose-Headers`.

### The 429 response

A rejected request gets `Retry-After` (whole seconds, rounded up) next to the same headers, and the wait in milliseconds in the body:

```
HTTP/2 429
Retry-After: 14
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1795876260

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "scope orders:create limit 30/min exceeded",
    "details": { "scope": "orders:create", "limit": 30, "retry_after_ms": 13250 },
    "trace_id": "…"
  }
}
```

`Retry-After` and `retry_after_ms` are the time until the current window resets. Pace on `X-RateLimit-Remaining` to stay under the cap instead of waiting for a 429.

## Checking your limits

`GET /v1/rate-limits` returns, for the key or OAuth token that calls it, every budget on this page and where it stands right now, so a client can plan its traffic instead of discovering a limit with a 429. Any credential works; the call itself counts against `markets:read`. Without a credential it reports the `markets:read` budget of your IP address, and `trading` is `null`.

```
curl https://api.predictasiax.com/v1/rate-limits \
  -H "Authorization: Bearer sk_live_..."

{
  "data": {
    "scheme": "api_key",
    "api_key_id": "api_7Hq2...",
    "window_seconds": 60,
    "rate_limits": [
      { "scope": "markets:read",  "limit": 600, "used": 42, "remaining": 558, "resets_at_ms": 1796115840000 },
      { "scope": "orders:read",   "limit": 300, "used": 0,  "remaining": 300, "resets_at_ms": 1796115840000 },
      { "scope": "orders:create", "limit": 30,  "used": 3,  "remaining": 27,  "resets_at_ms": 1796115840000 },
      …
    ],
    "trading": {
      "tier": "trade_capped",
      "can_place_orders": true,
      "simulated": false,
      "max_order_usdt": "100",
      "daily_notional_usdt": "1000",
      "used_today_usdt": "312.5",
      "remaining_today_usdt": "687.5",
      "resets_at_ms": 1796169600000
    }
  },
  "meta": { "ts_ms": 1796115806606, "trace_id": "…" }
}
```

- `rate_limits` — one entry per scope in the [table above](https://docs.predictasiax.com/rate-limits#limits): `limit` per minute, `used` in the current window (this request included), `remaining` and `resets_at_ms`, the end of the window. The numbers come from the same counters that enforce the limits. If a counter cannot be read, `used` and `remaining` are `null`.
- `trading` — the notional caps of the credential's tier ([below](https://docs.predictasiax.com/rate-limits#upgrade)), with any lower cap set on the key itself: `max_order_usdt` per order and `daily_notional_usdt` per UTC day (`null` = no cap), the notional `used_today_usdt` and `remaining_today_usdt`, and `resets_at_ms`, when the daily window ends. Without a daily cap nothing is metered, so the usage fields are `null`. `can_place_orders` is false for `read_live` and for credentials without `orders:create`; `simulated` is true for sandbox keys.

For an API key of a builder account, the daily notional counts what the account *takes*: the notional of its fills on the side that took liquidity, per UTC day, across the builder account, its subaccounts and all of its keys. Fills of your resting orders (the maker side) do not count, and neither do orders that are cancelled, expire or are rejected without a fill. A post-only order or a market-maker quote never takes liquidity, so it is not checked against the daily cap; the per-order cap still applies. An order that could take liquidity is refused with `TIER_LIMIT_EXCEEDED` when what the account took today plus the order's notional (limit price × size; size for a market order) would exceed the cap. RFQs, block trades and combos are checked the same way, and a combo's stake counts once it is placed. If the count cannot be read, such an order is refused with `503 SERVICE_UNAVAILABLE`: send it again shortly.

Other credentials (OAuth access tokens, sandbox keys, and API keys of a predictasiax.com trading account) count each order's notional when it is placed. For them, an order answered with `503 SERVICE_UNAVAILABLE` may have been placed, so its notional stays counted in `used_today_usdt`. Send it again with the same `client_order_id`: it is counted once, and if the first order was not placed after all, its notional is given back. This applies to `POST /v1/orders` and to each order in `POST /v1/orders/batch`.

## Moving up a tier

You never request a tier upgrade — every step is granted automatically from your 30-day volume: fills routed through your integration plus your own accounts' fills (see [How tiers work](https://docs.predictasiax.com/how-tiers-work)). Keep routing volume and the graduation cron moves your key up on its own. **Tiers do not change your request rate** — the published limits above apply to every tier. What each rung lifts is your per-order and daily *notional* ceiling:

| Tier | Notional cap | How it's reached |
|---|---|---|
| **Sandbox** (`tier=sandbox`) | $10 / order · $100 / day | Anonymous mint via `POST /v1/sandbox-keys` — no review, 30-day key expiry |
| **Read-live** | Read-only — cannot place orders | Auto-graduated at $100 30-day volume — no application needed |
| **Trade-capped** | $100 / order · $1,000 / day | Auto-graduated at $1,000 30-day volume |
| **Trade-full** | Uncapped | Auto-graduated at $50,000 30-day volume |
| **Genesis** (live top 20) | Uncapped | Automatic — the live top-20 by 30-day attributed volume. Granted and revoked by the ranking cron, never by application or human review. |
| **Partner** | Uncapped | Auto-graduated at $1,000,000 30-day volume. No signed agreement. (`institutional` is an application label on this same automatic ladder.) |

## Requests without a key

Public market data needs no key: the market list and detail, order books, price history, trades, holders, open interest, events, categories, movers, market-maker quotes, fee estimates, leaderboards and the audit trail. Without a key these reads count against the same `markets:read` budget (600 a minute), in a bucket per client IP address (IPv6 per /64) instead of per key, and carry the same `X-RateLimit-*` headers. Account endpoints (orders, positions, balances, subaccounts, webhooks) need a key and return `401` without one.

These public endpoints have a stricter limit per IP address (IPv6 per /64), over a sliding window:

| Endpoint | Limit per IP |
|---|---|
| `GET /v1/builders/public` | 60 / minute |
| `GET /v1/audit/anchor/{id}/raw` | 60 / minute |
| `POST /v1/access-requests` | 5 / hour (also per browser fingerprint) |
| `GET /v1/access-requests/{id}` | 30 / hour |
| `POST /v1/apply` | 5 / hour (also per browser fingerprint) |
| `GET /v1/apply/{ba_id}` | 30 / hour |
| `POST /v1/builder-credentials/signin-link/inspect` | 30 / hour |
| `POST /v1/builder-credentials/signin-link/redeem` | 10 / hour |
| `POST /v1/sandbox-keys` | 1 / day (also per browser fingerprint) |

A browser fingerprint is the client's network (its ASN and IPv4 /16 or IPv6 /32) together with its `User-Agent`, `Accept-Language` and `Accept-Encoding` headers, so the same client software on different networks is counted separately.

Rejected hits count toward the window. A `429` from these endpoints carries `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining: 0` and `X-RateLimit-Reset`, with `retry_after_ms` in the body; successful responses carry no rate-limit headers.

To get onto the per-key budget, mint a key with `POST /v1/sandbox-keys`, no email required. The minted key is `tier=sandbox`; because the per-scope limits are identical at every tier, that one step is the whole rate-limit upgrade — later graduations lift notional caps, not request rate.

## Backoff code (Python)

```
import time, requests

def retry_with_backoff(fn, max_tries=5):
    for attempt in range(max_tries):
        r = fn()
        if r.status_code == 429:
            wait = float(r.headers.get("Retry-After", 2 ** attempt))
            time.sleep(wait)
            continue
        return r
    raise RuntimeError("max retries exhausted")

r = retry_with_backoff(lambda: requests.get(
    "https://api.predictasiax.com/v1/markets",
    headers={"Authorization": "Bearer sk_live_ABC123"}
))
print(r.json())
```

## Orders on the WebSocket

An API key of a builder account, at any tier that places real orders (every tier but `sandbox` and `read_live`), can place and cancel orders on `wss://predictasiax.com/ws` instead of the REST endpoints, with `PLACE_ORDER`, `PLACE_ORDERS` (1 to 20 orders), `CANCEL_ORDER` and `CANCEL_ALL`. Sign the socket in with a token from `POST /v1/ws/token` requested with that API key (an OAuth access token does not qualify). The `authenticated` reply then carries `order_entry` with your limits, or `available: false` with a `code` and the reason. These commands do not use the per-minute budget above; they have per-second limits set by your account's traded volume over the last 30 days:

| Rate tier | 30-day volume (USDT) | Orders per second (burst) | Cancels per second (burst) | Open orders |
|---|---|---|---|---|
| `t0` | below 100,000 | 10 (20) | 20 (40) | 200 |
| `t1` | 100,000 | 20 (40) | 40 (80) | 500 |
| `t2` | 1,000,000 | 40 (80) | 80 (160) | 1,000 |
| `t3` | 10,000,000 | 80 (160) | 160 (320) | 2,000 |

Every account at the same volume gets the same limits, and the tier changes on its own: you move up as soon as your 30-day volume reaches the next threshold, and down only once it falls below 80% of your current tier's threshold. Each order in `PLACE_ORDERS` counts as one; a batch that does not fit is refused whole. Cancels have their own limit, twice the order rate, so placing orders never uses up your ability to cancel; `CANCEL_ALL` counts one for each order it cancels. A request over a limit is refused with `RATE_LIMITED` and `retry_after_ms`, `OPEN_ORDER_LIMIT` (cancel some orders first) or, when the platform as a whole is at its order intake limit, `PLATFORM_BUSY` with `retry_after_ms`. A refused request is not counted. The key's per-order notional cap still applies, and so does its daily cap: an order that could take liquidity is refused with `TIER_LIMIT_EXCEEDED` when it would take the account past it (see [how the daily notional is counted](https://docs.predictasiax.com/rate-limits#daily-count)).

A socket can have 64 requests in flight. Replies can arrive in a different order from the requests, so match them by `req_id`. A sign-in can place orders for 24 hours (`SESSION_EXPIRED` after that: open a new socket with a new token), and revoking the key stops order entry on open sockets within about 10 seconds (`KEY_REVOKED`). Sending the same order again with the same `client_order_id` within 24 hours returns the first result with `replay: true` and does not place a second order. `on_behalf_of` is not supported on the socket; use `POST /v1/orders` for that. Message schemas: [WebSocket API](https://docs.predictasiax.com/asyncapi).

Every request gets its reply. If your socket is not read fast enough to take a reply within 5 seconds, it is closed with code `4010`. Reconnect, send unanswered orders again with the same `client_order_id` to get their results, and check unanswered cancels with `GET /v1/orders/{id}`. An order answered with `SERVICE_UNAVAILABLE` may or may not have been placed: send it again with the same `client_order_id`. It is never placed twice, and if the first one was placed, the reply is that order with `replay: true`.

## WebSocket message throttle

Server-to-client messages have no rate cap. Client-to-server messages count against a per-minute budget by connection tier (anonymous 240/min; signed-in accounts 240/min and up by VIP tier), and each connection has a subscription cap (anonymous 100). `ping` and the order commands ([above](https://docs.predictasiax.com/rate-limits#ws-orders)) do not count against the message budget. Your exact limits are in the `authenticated` reply. A message over the budget is dropped, and the socket gets a `rate_limit` message with `code` `tier_max_msgs`, at most one a second. Batch subscriptions into a single SUBSCRIBE call:

```
# Good:
{"method":"SUBSCRIBE","params":["fast_tick","ticker","market_delta","orderbook"]}

# Bad (4 messages instead of 1):
{"method":"SUBSCRIBE","params":["fast_tick"]}
{"method":"SUBSCRIBE","params":["ticker"]}
{"method":"SUBSCRIBE","params":["market_delta"]}
{"method":"SUBSCRIBE","params":["orderbook"]}
```

**Don't retry on 4xx (except 429).** A `400 MISSING_FIELD` won't fix itself with retry — you'll just waste quota. See [Retry policy](https://docs.predictasiax.com/errors#retry-policy).

Source: https://docs.predictasiax.com/rate-limits
