Skip to content

WebSocket Streaming

Connect via WebSocket for real-time Polymarket events. Supports filtered subscriptions with multiple event types.

wss://polynode.dev/ws?key=pn_live_YOUR_KEY

The API key must be passed as a query parameter.

After connecting, send a JSON subscribe message:

{
"action": "subscribe",
"type": "settlements",
"filters": {
"tokens": ["21742633..."],
"side": "BUY",
"min_size": 100,
"status": "pending"
}
}

You’ll receive an acknowledgment:

{
"type": "subscribed",
"subscriber_id": "uuid-here",
"subscription_type": "settlements"
}

Followed by a snapshot of recent matching events, then live updates.

TypeEvents ReceivedDescription
settlementssettlementDecoded mempool + confirmed settlements (default)
tradessettlement, trade, status_updateAll trade activity
pricessettlement, tradePrice-moving events for specific markets
blocksblockNew block notifications
walletssettlement, trade, position_change, deposit, status_updateAll activity for specific wallets
marketssettlement, trade, position_change, status_updateAll activity for specific markets
large_tradessettlement, tradeWhale alerts ($1K+ default min_size)
orderbookorderbook, price_tickCLOB orderbook updates
globalallUnfiltered stream of everything

All filters are optional. Omit filters to receive all events of the subscription type.

FilterTypeDescription
walletsstring[]Filter by wallet addresses
tokensstring[]Filter by token IDs
marketsstring[]Alias for tokens (used with prices, markets, orderbook types)
sidestring"BUY" or "SELL"
min_sizenumberMinimum trade size in USD
statusstring"pending", "confirmed", or "all" (default)
event_typesstring[]Override default event types for the subscription

Each event is delivered as a JSON message:

{
"type": "settlement",
"data": {
"tx_hash": "0x1a2b3c...",
"status": "Pending",
"detected_at": 1709136043000,
"taker_wallet": "0xabcdef...",
"taker_token": "21742633...",
"taker_side": "BUY",
"taker_price": 0.72,
"taker_size": 500.00
}
}
{"action": "unsubscribe"}

Send periodic pings to prevent timeout:

{"action": "ping"}

Response:

{"type": "pong"}
const ws = new WebSocket('wss://polynode.dev/ws?key=pn_live_YOUR_KEY');
ws.onopen = () => {
ws.send(JSON.stringify({
action: 'subscribe',
type: 'large_trades',
filters: { min_size: 5000 }
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'settlement') {
console.log(`Whale: ${data.data.taker_side} $${data.data.taker_size} @ ${data.data.taker_price}`);
}
};
ws.send(JSON.stringify({
action: 'subscribe',
type: 'markets',
filters: {
markets: ['21742633...'],
status: 'pending' // Only mempool events
}
}));