Skip to content

Info WebSocket

Public WebSocket endpoint for real-time market data and information queries without authentication.

Endpoint

ws.send() wss://api.synthetix.io/v1/ws/info

Overview

The Info WebSocket endpoint supports two types of requests:

  1. Request/Response Pattern - Query market data using method: "post" with action parameters
  2. Subscribe/Broadcast Pattern - Subscribe to real-time data streams using method: "subscribe"

No authentication required for any operations on this endpoint.

Request/Response Pattern

Use method: "post" with an action parameter to query market information. The server responds with the requested data.

Available Actions

ActionDescriptionDocumentation
getMarketsRetrieve all available markets and their configurationGet Markets
getSubAccountIdsGet all subaccount IDs for a wallet addressGet SubAccount IDs

Request Format

{
  "id": "request-1",
  "method": "post",
  "params": {
    "action": "getMarkets"
  }
}

Response Format

{
  "id": "request-1",
  "status": 200,
  "result": {
    "response": [],
    "status": "success"
  }
}

Example: Query Markets

const ws = new WebSocket('wss://papi.synthetix.io/v1/ws/info');
 
ws.onopen = () => {
  // Request all markets
  ws.send(JSON.stringify({
    id: 'markets-1',
    method: 'post',
    params: {
      action: 'getMarkets'
    }
  }));
};
 
ws.onmessage = (event) => {
  const response = JSON.parse(event.data);
 
  if (response.id === 'markets-1' && response.status === 200) {
    const markets = response.result.response;
    console.log('Markets:', markets);
    console.log(`Found ${markets.length} markets`);
  }
};

Subscribe/Broadcast Pattern

Subscribe to real-time data streams to receive continuous updates as events occur. The server broadcasts updates to all subscribed connections.

Available Subscription Types

TypeDescriptionRequired ParametersUpdate Method
candlesReal-time candlestick updatessymbol, timeframecandle_update
marketPricesLive market price updates (mark, last, index, mid)symbolmarket_price_update
orderbookOrderbook depth updatessymbolorderbook_depth_update

Subscribe Request

{
  "id": "sub-1",
  "method": "subscribe",
  "params": {
    "type": "orderbook",
    "symbol": "BTC-USDT"
  }
}

Subscribe Response

{
  "id": "sub-1",
  "status": 200,
  "result": {
    "message": "Subscribed to orderbook for BTC-USDT"
  }
}

Unsubscribe Request

{
  "id": "unsub-1",
  "method": "unsubscribe",
  "params": {
    "type": "orderbook",
    "symbol": "BTC-USDT"
  }
}

Broadcast Updates

After subscribing, the server sends updates using the notification format:

{
  "method": "orderbook_depth_update",
  "data": {
    "symbol": "BTC-USDT",
    "timestamp": "1735689600000",
    "bids": [
      {"price": "50000.00", "quantity": "1.5"},
      {"price": "49999.00", "quantity": "2.0"}
    ],
    "asks": [
      {"price": "50001.00", "quantity": "1.2"},
      {"price": "50002.00", "quantity": "1.8"}
    ]
  }
}

Subscription Examples

Orderbook Updates

const ws = new WebSocket('wss://papi.synthetix.io/v1/ws/info');
 
ws.onopen = () => {
  // Subscribe to BTC-USDT orderbook
  ws.send(JSON.stringify({
    id: 'sub-orderbook',
    method: 'subscribe',
    params: {
      type: 'orderbook',
      symbol: 'BTC-USDT'
    }
  }));
};
 
ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
 
  // Handle subscription confirmation
  if (message.id === 'sub-orderbook') {
    console.log('Subscribed successfully:', message.result);
  }
 
  // Handle orderbook updates
  if (message.method === 'orderbook_depth_update') {
    console.log('Orderbook update:', message.data);
  }
};

Market Price Updates

ws.onopen = () => {
  // Subscribe to ETH-USDT price updates
  ws.send(JSON.stringify({
    id: 'sub-prices',
    method: 'subscribe',
    params: {
      type: 'marketPrices',
      symbol: 'ETH-USDT'
    }
  }));
};
 
ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
 
  // Handle price updates
  if (message.method === 'market_price_update') {
    const { symbol, price, updateType, lastUpdateTime } = message.data;
    console.log(`${symbol} ${updateType} price: ${price} at ${lastUpdateTime}`);
  }
};

Candle Updates

ws.onopen = () => {
  // Subscribe to SOL-USDT 1-minute candles
  ws.send(JSON.stringify({
    id: 'sub-candles',
    method: 'subscribe',
    params: {
      type: 'candles',
      symbol: 'SOL-USDT',
      timeframe: '1m'
    }
  }));
};
 
ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
 
  // Handle candle updates
  if (message.method === 'candle_update') {
    const candle = message.data;
    console.log(`Candle: O:${candle.open} H:${candle.high} L:${candle.low} C:${candle.close}`);
  }
};

Complete Example

const ws = new WebSocket('wss://papi.synthetix.io/v1/ws/info');
 
ws.onopen = () => {
  console.log('Connected to Info WebSocket');
 
  // 1. Query available markets (request/response)
  ws.send(JSON.stringify({
    id: 'get-markets',
    method: 'post',
    params: {
      action: 'getMarkets'
    }
  }));
 
  // 2. Subscribe to BTC-USDT orderbook (subscription)
  ws.send(JSON.stringify({
    id: 'sub-orderbook',
    method: 'subscribe',
    params: {
      type: 'orderbook',
      symbol: 'BTC-USDT'
    }
  }));
};
 
ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
 
  // Handle request/response
  if (message.id) {
    if (message.id === 'get-markets') {
      console.log('Available markets:', message.result);
    }
    if (message.id === 'sub-orderbook') {
      console.log('Subscription confirmed:', message.result);
    }
  }
 
  // Handle broadcast updates
  if (message.method) {
    switch (message.method) {
      case 'orderbook_depth_update':
        console.log('Orderbook update:', message.data);
        break;
      case 'market_price_update':
        console.log('Price update:', message.data);
        break;
      case 'candle_update':
        console.log('Candle update:', message.data);
        break;
    }
  }
};
 
ws.onerror = (error) => {
  console.error('WebSocket error:', error);
};
 
ws.onclose = () => {
  console.log('WebSocket connection closed');
};

Features

  • No Authentication Required - Public endpoint, no EIP-712 signatures needed
  • Low-Latency Streaming - Real-time market data with minimal delay
  • Request/Response + Subscriptions - Both query and streaming patterns supported
  • Multiple Subscriptions - Subscribe to multiple markets and data types simultaneously
  • Efficient Updates - Delta updates for orderbook, full snapshots on subscription

Error Responses

{
  "id": "request-1",
  "status": 400,
  "result": null,
  "error": {
    "code": 400,
    "message": "Invalid subscription type"
  }
}

Next Steps