Connection
Connect to the Polymarket WebSocket endpoint:| Property | Value |
|---|---|
| Protocol | WebSocket (wss://) |
| Keepalive | Ping every 54 seconds |
| Timeout | 60 seconds without pong |
| Max Message Size | 512 KB |
Subscribing to markets
Once connected, send a JSON message to subscribe usingcondition_id:
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | subscribe or unsubscribe |
condition_ids | array | Yes | Array of Polymarket condition identifiers (hex strings starting with 0x) |
message_types | array | No | ["prices"], ["orderbook"], ["trades"], or any combination. Defaults to prices and orderbook if omitted |
Unsubscribing
Message types
Price messages
Real-time price updates for subscribed markets:Orderbook messages
Real-time orderbook snapshots for subscribed markets:Trade messages
Real-time trade executions for subscribed markets:Full example
Important notes
- No authentication required for WebSocket connections
- Use
condition_id(Polymarket condition identifier) to subscribe - Messages are only sent for markets you have explicitly subscribed to
- Multiple markets can be subscribed in a single message
- Trades must be explicitly requested (not included in the default subscription)
- Orderbook updates are high-frequency — consider filtering client-side if needed

