Cascade

Operations

All WebSocket request and reply payloads grouped by operation.

Authenticate the WebSocket connection#

Must be called before accessing protected subscriptions (position, order, createorder, cancelorder)

Channel:WEBSOCKET
Tag:
Authentication

Authenticate the WebSocket connection with JWT token

Parameters

bearerstring

JWT authentication token

Payload
{
  "jsonrpc": "2.0",
  "method": "auth",
  "params": {
    "bearer": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9..."
  },
  "id": 1
}

Authentication success response

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Authenticated successfully"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 1
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to trade/fill notifications for a symbol#

Primary WebSocket channel for all market data and order management.

Channel:WEBSOCKET
Tag:
Market Data

Request to subscribe to trade/fill notifications

Parameters

sourcestring

Must be 'trade'

symbolsarray

Array of market symbols to subscribe to (e.g., ['BTC-USD-PERP', 'ETH-USD-PERP', 'SOL-USD-PERP']) or empty array [] for all markets

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "trade",
    "symbols": [
      "ETH-USD-PERP"
    ]
  },
  "id": 2
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

trade#

REPLY

Published each time a fill occurs in the specified market. Wrapped with type field to identify the message type.

Parameters

symbolstring

Market symbol for this fill

pricestring

Fill price as decimal string

quantitystring

Signed quantity - positive indicates buy, negative indicates sell, as decimal string

timeinteger

Timestamp when fill occurred in milliseconds

Payload
{
  "type": "Trade",
  "data": {
    "symbol": "BTC-USD-PERP",
    "price": "106012.450000",
    "quantity": "0.050000",
    "time": 1751793781000
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to order book updates at specified precision#

Primary WebSocket channel for all market data and order management.

Channel:WEBSOCKET
Tag:
Market Data

Request to subscribe to order book updates

Parameters

sourcestring

Must be 'book'

symbolstring

Market symbol for which order book data is desired

tickSize?number

Optional price tick size for order aggregation (e.g., 0.01, 0.02, 0.05). Must be base_tick_size * multiplier (1x, 2x, 5x, 10x, 100x, 1000x). Defaults to base tick size if not specified.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "book",
    "symbol": "SOL-USD-PERP",
    "tickSize": 0.01
  },
  "id": 3
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Published on subscription with initial snapshot, then delta updates on changes. Wrapped with type field to identify the message type.

Parameters

feedIdstring

Feed ID as a fixed 32-byte hex string (preserves leading zeros)

tickSizeinteger

Price tick size used for aggregation as raw u64 value

bidsarray

For snapshots: All buy orders sorted by price descending. For deltas: Changed buy orders (quantity 0 means removed).

asksarray

For snapshots: All sell orders sorted by price ascending. For deltas: Changed sell orders (quantity 0 means removed).

timeinteger

Timestamp in milliseconds

sequenceNumberinteger

Monotonic sequence number for this feed's order updates

Payload
{
  "type": "Book Snapshot",
  "data": {
    "feedId": "0x0000000000000000000000000000000000000000000000000000000000000001",
    "tickSize": 10000,
    "bids": [
      {
        "price": "150.371000",
        "quantity": "0.581222"
      },
      {
        "price": "150.370000",
        "quantity": "0.250000"
      }
    ],
    "asks": [
      {
        "price": "150.372000",
        "quantity": "0.450000"
      },
      {
        "price": "150.373000",
        "quantity": "0.333334"
      }
    ],
    "time": 1752798506000,
    "sequenceNumber": 12345
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to OHLCV candle data at specified interval#

Primary WebSocket channel for all market data and order management.

Channel:WEBSOCKET
Tag:
Market Data

Request to subscribe to OHLCV candle data

Parameters

sourcestring

Must be 'candle'

symbolsarray

Array of market symbols for which OHLCV data is desired (e.g., ['BTC-USD-PERP', 'ETH-USD-PERP']) or empty array [] for all markets

intervalstring

Candle interval - accepts either string format or seconds

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "candle",
    "symbols": [
      "ETH-USD-PERP"
    ],
    "interval": "1m"
  },
  "id": 4
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

candle#

REPLY

Published once per interval for the subscribed symbol and interval. Wrapped with type field to identify the message type.

Parameters

symbolstring

Market symbol for this candle

openstring

Opening price as decimal string

highstring

Highest price during the candle period as decimal string

lowstring

Lowest price during the candle period as decimal string

closestring

Closing price as decimal string

volumestring

Total volume traded during the candle period as decimal string

timeinteger

Starting timestamp of the candle period in milliseconds

fundingRatestring

Funding rate for the candle period as signed decimal string

Payload
{
  "type": "Candle Update",
  "data": {
    "symbol": "ETH-USD-PERP",
    "open": "2498.123470",
    "high": "2532.678942",
    "low": "2487.234511",
    "close": "2517.982130",
    "volume": "987.543290",
    "time": 1751932800000,
    "fundingRate": "0.000125"
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to price updates for one or more symbols#

Subscribe to real-time price updates for specified symbols. When subscribing to all symbols (empty symbols array), updates are batched at the configured throttle interval (`ws_price_update_throttle_interval_ms`). At each interval, the handler sends the latest price update for each symbol that has changed since the last batch. CASH_ASSET and CASH_DEBT feeds are excluded from price subscriptions as they are internal system feeds.

Channel:WEBSOCKET
Tag:
Market Data

Request to subscribe to price updates

Parameters

sourcestring

Must be 'price'

symbolsarray

Array of market symbols for which price data is desired (e.g., ['BTC-USD-PERP', 'ETH-USD-PERP']) or empty array [] for all markets. CASH_ASSET and CASH_DEBT feeds are excluded from subscriptions.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "price",
    "symbols": [
      "BTC-USD-PERP",
      "ETH-USD-PERP"
    ]
  },
  "id": 5
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

price#

REPLY

Published on subscription with initial snapshots for all subscribed symbols, then updates as prices change. When subscribing to all symbols (empty symbols array), updates are batched at the configured throttle interval. At each interval, the handler sends the latest price update for each symbol that has changed since the last batch. CASH_ASSET and CASH_DEBT feeds are excluded from price subscriptions. Wrapped with type field to identify the message type.

Parameters

symbolstring

Market symbol for this price

bestBidstring

Best bid price from order book as decimal string

midpointstring

Midpoint price (average of best bid and best offer) as decimal string

bestOfferstring

Best offer (ask) price from order book as decimal string

markstring

Derived fair mark price used for execution and risk checks

indexstring

Reference index price (spot/EMA fallback) used for deviation and funding basis

timeinteger

Timestamp when price was last updated in milliseconds

Payload
{
  "type": "Price Snapshot",
  "data": {
    "symbol": "BTC-USD-PERP",
    "bestBid": "105998.25",
    "midpoint": "106001.125",
    "bestOffer": "106004.00",
    "mark": "106001.50",
    "index": "106000.50",
    "time": 1752798506000
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to summary updates for one or more symbols#

Subscribe to real-time market summary updates (24h volume, open interest, funding rate, best bid/offer, etc.) for specified symbols. When subscribing to all symbols (empty symbols array), updates are batched at the same throttle interval as price (`ws_price_update_throttle_interval_ms`). CASH_ASSET and CASH_DEBT feeds are excluded.

Channel:WEBSOCKET
Tag:
Market Data

Request to subscribe to summary updates

Parameters

sourcestring

Must be 'summary'

symbolsarray

Array of market symbols for which summary data is desired (e.g. ['BTC-USD-PERP', 'ETH-USD-PERP']) or empty array [] for all markets. CASH_ASSET and CASH_DEBT feeds are excluded.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "summary",
    "symbols": [
      "BTC-USD-PERP",
      "ETH-USD-PERP"
    ]
  },
  "id": 7
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Published on subscription with initial snapshots for all subscribed symbols, then updates as feed/summary data changes. When subscribing to all symbols (empty symbols array), updates are batched at the same throttle interval as price. CASH_ASSET and CASH_DEBT feeds are excluded. Wrapped with type field to identify the message type.

Parameters

symbolstring

Market symbol for this summary

bestBidobject
bestOfferobject
price24hAgostring

Mark price 24 hours ago (UFixed6 decimal string); empty when unavailable

fundingRatestring

Funding rate as decimal string (positive = longs pay shorts, negative = shorts pay longs)

openIntereststring

Open interest for the market as decimal string

volumestring

Trading activity in the past 24 hours as decimal string

timeinteger

Timestamp of this snapshot in milliseconds

Payload
{
  "type": "Summary Snapshot",
  "data": {
    "symbol": "ETH-USD-PERP",
    "bestBid": {
      "price": "3660.02",
      "quantity": "0.12"
    },
    "bestOffer": {
      "price": "3660.13",
      "quantity": "0.075"
    },
    "price24hAgo": "3587.5",
    "fundingRate": "-0.00032",
    "openInterest": "1508712.3429",
    "volume": "387267.23",
    "time": 1752798506000
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to position updates for an account (requires authentication, supports delegation)#

Primary WebSocket channel for all market data and order management.

Channel:WEBSOCKET
Tag:
Account

Request to subscribe to position updates (requires authentication)

Parameters

sourcestring

Must be 'position'

accountstring

Ethereum address of the account (must match authenticated user or user must be a delegate)

subaccountIndicesarray

Array of subaccount indices. - Empty array []: Subscribes to ALL subaccounts (owner only - delegation not allowed) - Non-empty array: Subscribes to the specified subaccounts (delegation allowed) For delegated access, delegation is checked for ALL specified subaccounts. Subscription fails if user lacks delegation for any subaccount in the array.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "position",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndices": []
  },
  "id": 5
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Published each time a position is created or updated for the subscribed account. Wrapped with type field to identify the message type.

Parameters

accountstring

Ethereum address of the account

subaccountIndexinteger

Subaccount index

symbolstring

Market symbol for this position

quantitystring

Signed decimal string - positive for long, negative for short

basisstring

Signed notional cost basis as decimal string

feesstring

Accumulated trade fees as unsigned decimal string

fundingstring

Accumulated funding fees as signed decimal string

marginstring

Collateral amount reserved for this position as unsigned decimal string

upnlstring

Unrealized profit and loss for this position as signed decimal string

updatedAtinteger

Timestamp when position was last updated in milliseconds

Payload
{
  "type": "Position",
  "data": {
    "account": "0xc2cbbb5bea8fdefb1f441feaf017a0df72e89c9f",
    "subaccountIndex": 0,
    "symbol": "ETH-USD-PERP",
    "quantity": "1.5",
    "basis": "3720.226",
    "fees": "1.323667",
    "funding": "87.382478",
    "margin": "558.621108",
    "upnl": "125.50",
    "updatedAt": 1752846925000
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}
Channel:WEBSOCKET
Tag:
Orders

Request to subscribe to order updates (requires authentication)

Parameters

sourcestring

Must be 'order'

accountstring

Ethereum address of the account (must match authenticated user or user must be a delegate)

symbolsarray

Array of market symbols to filter orders (e.g., ['BTC-USD-PERP', 'ETH-USD-PERP']) or empty array [] for all markets

orderType?string

Optional order type to filter subscriptions - 'Limit' for limit orders, 'TWAP' for time-weighted average price orders, 'TakeProfit' for take profit orders, 'StopLoss' for stop loss orders, or 'ALL' for all order types. Defaults to ALL if not specified.

subaccountIndicesarray

Array of subaccount indices. - Empty array []: Subscribes to ALL subaccounts (owner only - delegation not allowed) - Non-empty array: Subscribes to the specified subaccounts (delegation allowed) For delegated access, delegation is checked for ALL specified subaccounts. Subscription fails if user lacks delegation for any subaccount in the array.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "order",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "symbols": [
      "BTC-USD-PERP"
    ],
    "orderType": "Limit",
    "subaccountIndices": []
  },
  "id": 6
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

order#

REPLY

Published each time an order is created, updated, filled, or cancelled for the subscribed account and symbol. Wrapped with type field to identify the message type.

Parameters

accountstring

Ethereum address of the account

subaccountIndexinteger

Subaccount index

orderIdstring

Unique 64-character hex identifier for this order

clientIdstring

Client-provided identifier (empty string if not provided)

groupIdstring

Assigned to conditional orders created in batch (such as TWAP). "0" means the order is not part of a group

orderTypestring

Disambiguates regular limit orders from conditional orders

quantitystring

Signed decimal string - positive for long/buy, negative for short/sell

expiresAtinteger

Order expiration timestamp in milliseconds

symbolstring

Market symbol

nonceinteger

Order nonce

lastUpdateSequenceNumberinteger

Last update sequence number for the order

pricestring

Limit price as decimal string

flagsobject
originatorstring

Address to whom the originator fee shall be awarded (may be zero address)

originatorFeeinteger

Additional priority fee to be paid to the originator (may be zero)

period?integer

For TWAP orders only, the time interval in milliseconds between submission of orders

triggerPrice?string

For TakeProfit and StopLoss orders only, the price at which the order is activated

trailingPercent?string

For TrailingStop orders only, the percentage by which the trigger price follows the market price

parentOrderId?string

Optional for TakeProfit and StopLoss orders, enables this order upon execution of the specified parent

statusstring

Order status: new (just submitted), open (active on order book), scheduled (conditional order scheduled for submission), submitted (conditional order triggered and submitted), filled (completely filled), pendingCancel (cancellation requested but not yet processed), cancelled (user cancelled), expired (past expiration), rejected (validation failed)

remainingstring

Unfilled quantity as unsigned decimal string

settledstring

Filled quantity as unsigned decimal string

createdAt?integer

Timestamp when order was created in milliseconds (null for new orders not yet processed)

updatedAt?integer

Timestamp when order was last updated in milliseconds (null for new orders not yet processed)

reason?string

Optional text field giving reason for rejection or cancellation

Payload
{
  "type": "Order",
  "data": {
    "account": "0xc2cbbb5bea8fdefb1f441feaf017a0df72e89c9f",
    "subaccountIndex": 0,
    "orderId": "a6e139432b47a2dece7734777fc6df8cab8a6a933daa26821c9185020f7f6a10",
    "clientId": "20250709-3481323",
    "groupId": "0",
    "orderType": "limit",
    "quantity": "-0.5",
    "expiresAt": 1968707400000,
    "symbol": "BTC-USD-PERP",
    "nonce": 388,
    "lastUpdateSequenceNumber": 12345,
    "price": "109912.25",
    "flags": {
      "reduceOnly": false,
      "postOnly": true,
      "ioc": false,
      "selfTradeExpire": null
    },
    "originator": "0x0000000000000000000000000000000000000000",
    "originatorFee": 0,
    "status": "filled",
    "remaining": "0",
    "settled": "0.5",
    "createdAt": 1720615381000,
    "updatedAt": 1720620000000
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}
Channel:WEBSOCKET
Tag:
Account

Request to subscribe to fill updates (requires authentication, supports delegation)

Parameters

sourcestring

Must be 'fill'

accountstring

Ethereum address of the account (must match authenticated user or user must be a delegate)

subaccountIndexinteger

Subaccount index to subscribe to fills for

symbolsarray

Array of market symbols to filter fills (e.g., ['BTC-USD-PERP', 'ETH-USD-PERP']) or empty array [] for all markets

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "fill",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndex": 0,
    "symbols": [
      "ETH-USD-PERP"
    ]
  },
  "id": 8
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

fill#

REPLY

Published each time a fill occurs for the subscribed account and subaccount. Includes realized PnL, exposure, and funding. Wrapped with type field to identify the message type.

Parameters

symbolstring

Market symbol for this fill

pricestring

Fill price as decimal string

quantitystring

Signed quantity - positive indicates buy, negative indicates sell, as decimal string

timeinteger

Timestamp when fill occurred in milliseconds

orderIdstring

64-character hex string identifying the order that was filled

realizedExposurestring

Realized exposure from this fill as signed decimal string

realizedFundingstring

Realized funding from this fill as signed decimal string

realizedPnlstring

Realized PnL from this fill (exposure + funding - fees) as signed decimal string

Payload
{
  "type": "Fill",
  "data": {
    "symbol": "ETH-USD-PERP",
    "price": "2511.120000",
    "quantity": "1.500000",
    "time": 1751793781000,
    "orderId": "a6e139432b47a2dece7734777fc6df8cab8a6a933daa26821c9185020f7f6a10",
    "realizedExposure": "3766.680000",
    "realizedFunding": "0.000000",
    "realizedPnl": "3766.680000"
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to account stats (requires authentication, supports delegation)#

Subscribe to account statistics (UPnL, cross leverage, maintenance margin, account value, free collateral, etc.). Updates are published at a fixed interval (every 5 seconds). Supports delegation - users can subscribe to accounts they are delegated to access.

Channel:WEBSOCKET
Tag:
Account

Request to subscribe to account stats (requires authentication, supports delegation)

Parameters

sourcestring

Must be 'stats'

accountstring

Ethereum address of the account (must match authenticated user or user must be a delegate)

subaccountIndicesarray

Array of subaccount indices. - Empty array []: Subscribes to ALL subaccounts (owner only - delegation not allowed) - Non-empty array: Subscribes to the specified subaccounts (delegation allowed) For delegated access, delegation is checked for ALL specified subaccounts. Subscription fails if user lacks delegation for any subaccount in the array.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "stats",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndices": [
      0
    ]
  },
  "id": 10
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

stats#

REPLY

Published at a fixed interval (every 5 seconds) for the subscribed account and subaccount. Contains UPnL, cross leverage, maintenance margin, account value, free collateral, etc. Wrapped with type field to identify the message type.

Parameters

accountstring

Ethereum address of the account

subaccountIndexinteger

Subaccount index

upnlstring

Total unrealized profit and loss across all positions

crossLeveragestring

Cross-margin leverage (cross notional / cross account equity)

crossMarginUsagestring

Cross-margin usage (cross initial margin requirement / cross account equity)

maintMarginstring

Total maintenance margin requirement across all positions

crossMarginRatiostring

Cross-margin ratio (cross account equity / cross maintenance margin requirement)

accountValuestring

Account value (balance + cross UPnL)

initialMarginRequirementstring

Total initial margin requirement for all positions and orders

freeCollateralstring

Amount available for withdrawals

Payload
{
  "type": "Stats",
  "data": {
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndex": 0,
    "upnl": "1234.567",
    "crossLeverage": "2.5",
    "crossMarginUsage": "0.38",
    "maintMargin": "5000.123",
    "crossMarginRatio": "0.4",
    "accountValue": "10000.0",
    "initialMarginRequirement": "5100.0",
    "freeCollateral": "4500.0"
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Create a new order (requires authentication)#

Uses the 'create' method with type 'order' to submit a new order to the matching engine

Channel:WEBSOCKET
Tag:
Orders

Request to create a new order (requires authentication)

Parameters

typestring

Must be 'order'

orderobject
Payload
{
  "jsonrpc": "2.0",
  "method": "create",
  "params": {
    "type": "order",
    "order": {
      "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
      "clientId": "order-12345",
      "orderType": "Limit",
      "quantity": "1.5",
      "expiresAt": 1968686299000,
      "symbol": "ETH-USD-PERP",
      "subaccountIndex": 0,
      "nonce": 387,
      "price": "2511.12",
      "flags": {
        "reduceOnly": false,
        "postOnly": true,
        "ioc": false,
        "selfTradeExpire": null
      },
      "signatures": [
        "0x587244e256b155471bbb11d69edc1f039205411bf29e39209c6862e87735beb2..."
      ],
      "originator": "0x0000000000000000000000000000000000000000",
      "originatorFee": 0
    }
  },
  "id": 7
}

Success response for create order requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Order with ID a6e139432b47a2dece7734777fc6df8cab8a6a933daa26821c9185020f7f6a10 created successfully"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 7
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Cancel an existing order (requires authentication)#

Uses the 'cancel' method with type 'order' to cancel an existing order. Provide either orderId or both clientId and account (required if orderId is not provided).

Channel:WEBSOCKET
Tag:
Orders

Request to cancel an existing order (requires authentication)

Parameters

typestring

Must be 'order'

orderId?string

Identifies the order to be cancelled.

clientId?string

Identifies the order to be cancelled, required if orderId is not provided.

account?string

Identifies the account which owns the order to be cancelled, required with clientId.

Payload
{
  "jsonrpc": "2.0",
  "method": "cancel",
  "params": {
    "type": "order",
    "orderId": "a6e139432b47a2dece7734777fc6df8cab8a6a933daa26821c9185020f7f6a10"
  },
  "id": 8
}

Success response for cancel order requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Order cancelled successfully"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 8
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Cancel a batch of orders (requires authentication)#

Uses the 'cancel' method with type 'batchOrders' to cancel multiple orders in one request. Provide either orderIds or both account and clientIds (required together). Cannot mix orderIds with account/clientIds.

Channel:WEBSOCKET
Tag:
Orders

Request to cancel a batch of orders (requires authentication)

Parameters

jsonrpcstring

JSON-RPC version, must be '2.0'

methodstring

Must be 'cancel'

paramsobject | object

Provide either orderIds or both account and clientIds. Cannot mix.

id?string | integer | null

Optional request identifier for matching responses (string, number, or null per JSON-RPC 2.0)

Payload
{
  "jsonrpc": "2.0",
  "method": "cancel",
  "params": {
    "type": "batchOrders",
    "orderIds": [
      "a6e139432b47a2dece7734777fc6df8cab8a6a933daa26821c9185020f7f6a10",
      "b5cb9b814027f12334d1e02dec61a73f6ca1eab01049060c366f2d3ced11e0dd"
    ]
  },
  "id": 10
}

Success response for batch cancel order requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Batch orders cancelled successfully: 3 orders"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Create a batch of orders (requires authentication)#

Uses the 'create' method with type 'batchOrders' to submit multiple orders to the matching engine. Supports batch Limit orders, TWAP orders and Iceberg orders All orders in the batch must have the same: - account - subaccountIndex - symbol - orderType - period (if applicable) - side (buy or sell) For TWAP orders, the quantity of each order should be set such that the sum equals the total desired quantity. TWAPs must specify a nonzero period (in milliseconds) between orders. For Iceberg orders, the quantity of each order should be set to the desired display quantity.

Channel:WEBSOCKET
Tag:
Orders

Request to create a batch of orders (requires authentication)

Parameters

typestring

Must be 'batchOrders'

ordersarray

Array of orders to create. All orders must have the same: - account - subaccountIndex - symbol - orderType - period (if applicable) - side (buy or sell) For TWAP orders, period must be nonzero and the same for all orders.

Payload
{
  "jsonrpc": "2.0",
  "method": "create",
  "params": {
    "type": "batchOrders",
    "orders": [
      {
        "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
        "clientId": "batch-order-1",
        "orderType": "Limit",
        "quantity": "-1.5",
        "expiresAt": 1968686299000,
        "symbol": "ETH-USD-PERP",
        "subaccountIndex": 0,
        "nonce": 387,
        "price": "2511.12",
        "flags": {
          "reduceOnly": false,
          "postOnly": true,
          "ioc": false
        },
        "signatures": [
          "0x587244e256b155471bbb11d69edc1f039205411bf29e39209c6862e87735beb2..."
        ],
        "originator": "0x0000000000000000000000000000000000000000",
        "originatorFee": 0
      },
      {
        "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
        "clientId": "batch-order-2",
        "orderType": "Limit",
        "quantity": "-1.5",
        "expiresAt": 1968686299000,
        "symbol": "ETH-USD-PERP",
        "subaccountIndex": 0,
        "nonce": 388,
        "price": "2515.00",
        "flags": {
          "reduceOnly": false,
          "postOnly": true,
          "ioc": false
        },
        "signatures": [
          "0x9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b..."
        ],
        "originator": "0x0000000000000000000000000000000000000000",
        "originatorFee": 0
      }
    ]
  },
  "id": 9
}

Success response for batch create order requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Batch orders created successfully: 3 orders"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 9
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from trade notifications#

Stops receiving trade updates for the specified symbol

Channel:WEBSOCKET
Tag:
Market Data

Request to unsubscribe from trade notifications

Parameters

sourcestring

Must be 'trade'

symbolsarray

Array of market symbols to unsubscribe from (must match the symbols used when subscribing) or empty array [] for all markets

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "trade",
    "symbols": [
      "ETH-USD-PERP"
    ]
  },
  "id": 10
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from order book updates#

Stops receiving order book updates for the specified symbol

Channel:WEBSOCKET
Tag:
Market Data

Request to unsubscribe from order book updates

Parameters

sourcestring

Must be 'book'

symbolstring

Market symbol to unsubscribe from

tickSize?number

Optional tick size (must match subscription if provided)

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "book",
    "symbol": "SOL-USD-PERP",
    "tickSize": 0.01
  },
  "id": 11
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from candle data#

Stops receiving candle data for the specified symbol and interval

Channel:WEBSOCKET
Tag:
Market Data

Request to unsubscribe from candle data

Parameters

sourcestring

Must be 'candle'

symbolsarray

Array of market symbols to unsubscribe from (must match the symbols used when subscribing) or empty array [] for all markets

intervalstring

Candle interval - accepts either string format or seconds

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "candle",
    "symbols": [
      "BTC-USD-PERP"
    ],
    "interval": "1m"
  },
  "id": 12
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from price updates#

Stops receiving price updates for the specified symbols

Channel:WEBSOCKET
Tag:
Market Data

Request to unsubscribe from price updates

Parameters

sourcestring

Must be 'price'

symbolsarray

Array of market symbols to unsubscribe from (must match the symbols used when subscribing) or empty array [] for all markets

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "price",
    "symbols": [
      "BTC-USD-PERP",
      "ETH-USD-PERP"
    ]
  },
  "id": 13
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from summary updates#

Stops receiving summary updates for the specified symbols

Channel:WEBSOCKET
Tag:
Market Data

Request to unsubscribe from summary updates

Parameters

sourcestring

Must be 'summary'

symbolsarray

Array of market symbols to unsubscribe from (must match the symbols used when subscribing) or empty array [] for all markets

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "summary",
    "symbols": [
      "BTC-USD-PERP",
      "ETH-USD-PERP"
    ]
  },
  "id": 15
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from position updates (requires authentication)#

Stops receiving position updates for the specified account

Channel:WEBSOCKET
Tag:
Account

Request to unsubscribe from position updates

Parameters

sourcestring

Must be 'position'

accountstring

Ethereum address of the account (must match subscription)

subaccountIndicesarray

Array of subaccount indices. Must match the subscription (same indices; order does not matter). Use [] if unsubscribing from an "all subaccounts" subscription.

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "position",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndices": []
  },
  "id": 13
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from order updates (requires authentication)#

Stops receiving order updates for the specified account, symbol, and order type

Channel:WEBSOCKET
Tag:
Orders

Request to unsubscribe from order updates

Parameters

sourcestring

Must be 'order'

accountstring

Ethereum address of the account (must match subscription)

symbolsarray

Array of market symbols to unsubscribe from (must match the symbols used when subscribing) or empty array [] for all markets

orderType?string

Optional order type to match subscription - must match the orderType used when subscribing. Defaults to ALL if not specified.

subaccountIndicesarray

Array of subaccount indices. Must match the subscription (same indices; order does not matter). Use [] if unsubscribing from an "all subaccounts" subscription.

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "order",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "symbols": [
      "BTC-USD-PERP"
    ],
    "orderType": "Limit",
    "subaccountIndices": []
  },
  "id": 14
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from fill updates (requires authentication)#

Stops receiving fill updates for the specified account, subaccount, and symbol

Channel:WEBSOCKET
Tag:
Account

Request to unsubscribe from fill updates

Parameters

sourcestring

Must be 'fill'

accountstring

Ethereum address of the account (must match subscription)

subaccountIndexinteger

Subaccount index (must match subscription)

symbolsarray

Array of market symbols to unsubscribe from (must match the symbols used when subscribing) or empty array [] for all markets

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "fill",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndex": 0,
    "symbols": [
      "ETH-USD-PERP"
    ]
  },
  "id": 18
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from stats updates (requires authentication)#

Stops receiving stats updates for the specified account and subaccount

Channel:WEBSOCKET
Tag:
Account

Request to unsubscribe from stats updates

Parameters

sourcestring

Must be 'stats'

accountstring

Ethereum address of the account (must match subscription)

subaccountIndicesarray

Array of subaccount indices. Must match the subscription (same indices; order does not matter). Use [] if unsubscribing from an "all subaccounts" subscription.

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "stats",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndices": [
      0
    ]
  },
  "id": 18
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to account transfer updates (requires authentication, supports delegation)#

Subscribe to real-time account transfer updates (deposits, withdrawals, transfers, fees, etc.) for GET account/transfers. Uses the Spacetime account_transfers table. Requires account and subaccount index.

Channel:WEBSOCKET
Tag:
Account

Request to subscribe to account transfer updates (requires authentication, supports delegation)

Parameters

sourcestring

Must be 'transfer'

accountstring

Ethereum address of the account (must match authenticated user or user must be a delegate)

subaccountIndexinteger

Subaccount index to subscribe to transfer updates for

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "transfer",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndex": 0
  },
  "id": 11
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Real-time notification for a new account transfer (deposit, withdrawal, transfer, fee, etc.). Same shape as GET /account/transfers items. Wrapped with type field to identify the message type.

Parameters

transferTypestring
amountstring

Signed amount (positive = credit, negative = debit), fixed-point string

accountstring

Account address (hex)

subaccountIndexinteger

Subaccount index

counterpartyAccountstring

Counterparty account (zero address for external flows)

counterpartySubaccountIndexinteger

Counterparty subaccount index

timestampMillisinteger

Block timestamp in milliseconds since Unix epoch

symbolstring

Market symbol (e.g. ETH-USD-PERP)

Payload
{
  "type": "Transfer",
  "data": {
    "transferType": "Deposit",
    "amount": "1000.000000",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndex": 0,
    "counterpartyAccount": "0x0000000000000000000000000000000000000000",
    "counterpartySubaccountIndex": 0,
    "timestampMillis": 1752846925000,
    "symbol": "ETH-USD-PERP"
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from transfer updates (requires authentication)#

Stops receiving transfer updates for the specified account

Channel:WEBSOCKET
Tag:
Account

Request to unsubscribe from transfer updates

Parameters

sourcestring

Must be 'transfer'

accountstring

Ethereum address of the account (must match subscription)

subaccountIndexinteger

Subaccount index (must match subscription)

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "transfer",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndex": 0
  },
  "id": 19
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Subscribe to balance updates for an account (requires authentication, supports delegation)#

Subscribe to real-time balance updates for owned or delegated accounts. Can subscribe to all subaccounts or a specific subaccount.

Channel:WEBSOCKET
Tag:
Account

Request to subscribe to balance updates (requires authentication, supports delegation)

Parameters

sourcestring

Must be 'balance'

accountstring

Ethereum address of the account (must match authenticated user or user must be a delegate)

subaccountIndicesarray

Array of subaccount indices. - Empty array []: Subscribes to ALL subaccounts (owner only - delegation not allowed) - Non-empty array: Subscribes to the specified subaccounts (delegation allowed) For delegated access, delegation is checked for ALL specified subaccounts. Subscription fails if user lacks delegation for any subaccount in the array.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "balance",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndices": []
  },
  "id": 7
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Published each time an account balance is created or updated for the subscribed account. Supports delegation - users can receive updates for accounts they are delegated to access. Wrapped with type field to identify the message type.

Parameters

accountstring

Ethereum address of the account

subaccountIndexinteger

Subaccount index

balancestring

Current account balance as Fixed6 decimal string

updatedAtinteger

Timestamp when balance was last updated in milliseconds

Payload
{
  "type": "Balance Update",
  "data": {
    "account": "0xc2cbbb5bea8fdefb1f441feaf017a0df72e89c9f",
    "subaccountIndex": 0,
    "balance": "1000.500000",
    "updatedAt": 1752846925000
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Unsubscribe from balance updates (requires authentication)#

Stops receiving balance updates for the specified account

Channel:WEBSOCKET
Tag:
Account

Request to unsubscribe from balance updates

Parameters

sourcestring

Must be 'balance'

accountstring

Ethereum address of the account (must match subscription)

subaccountIndicesarray

Array of subaccount indices. Must match the subscription (same indices; order does not matter). Use [] if unsubscribing from an "all subaccounts" subscription.

Payload
{
  "jsonrpc": "2.0",
  "method": "unsubscribe",
  "params": {
    "source": "balance",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndices": []
  },
  "id": 15
}

Success response for unsubscribe requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Unsubscribed from channel"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 10
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}