WebSocket APITopics

Wallet events

Receive
/ws
Server

Subscribe with predictWalletEvents/{jwt}, where jwt is a wallet JWT from the REST API's POST /auth. A revoked, invalid or expired JWT is refused with invalid_credentials. Nothing is sent on subscribe.

Authorization

headerx-api-key<api-key>

The API key in the handshake's x-api-key header. Use this where you can.

Code Sample
const socket = new WebSocket("wss://ws.predict.fun/ws?apiKey=YOUR_API_KEY");socket.addEventListener("message", (event) => {  console.log(event.data);});

Messages

application/json
  1. payload
type*string
topic*string

The topic string the subscription was made with.

data*|||||||
order accepted
{  "type": "M",  "topic": "predictWalletEvents/eyJhbGciOi...",  "data": {    "type": "orderAccepted",    "orderId": "123456789",    "orderHash": "0x3f1c...9a2b",    "walletAddress": "0x8ba1f109551bD432803012645Ac136ddd64DBA72",    "timestamp": 1736696400000,    "details": {      "marketId": 123,      "outcomeIndex": 1,      "marketQuestion": "Will X happen?",      "outcome": "YES",      "outcomeName": "Yes",      "quoteType": "BID",      "quantity": "100.000",      "quantityFilled": "0.000",      "price": "0.620",      "value": "62.00",      "valueFilled": "0.00",      "strategyType": "LIMIT",      "categorySlug": "politics"    }  }}