Predict API (Beta)
  1. WebSocket
  • FAQs
  • Deployed Contracts
  • Guides
    • Understanding the Orderbook
    • [TS] How to authenticate your API requests
    • [PY] How to authenticate your API requests
    • How to create or cancel orders
  • WebSocket
    • General Information
    • Request Format
    • Response Format
    • Subscription Topics
    • Heartbeats
    • Client Example
  • Authorization
    • Get auth message
      GET
    • Get JWT with valid signature
      POST
  • Categories
    • Get categories
      GET
    • Get category by slug
      GET
    • Get all tags
      GET
  • Markets
    • Get markets
      GET
    • Get market by ID
      GET
    • Get market statistics
      GET
    • Get market last sale information
      GET
    • Get the orderbook for a market
      GET
    • Get market timeseries
      GET
    • Get latest market timeseries value
      GET
  • Orders
    • Get order by hash
      GET
    • Get orders
      GET
    • Get order match events
      GET
    • Remove orders from the orderbook
      POST
    • Create an order
      POST
    • Remove orders by hash
      POST
  • Accounts
    • Get connected account
      GET
    • Get account activity
      GET
    • Set a referral
      POST
  • Positions
    • Get positions
      GET
    • Get positions by address
      GET
  • Search
    • Search categories and markets
      GET
  • OAuth
    • Finalize a OAuth connection
      POST
    • Get the orders for a OAuth connection
      POST
    • Create an order for a OAuth connection
      POST
    • Cancel the orders for a OAuth connection
      POST
    • Get the positions for a OAuth connection
      POST
  • Schemas
    • AccountData
    • AccountResponse
    • ActivityEvent
    • ActivityEventName
    • ActivityOrderData
    • ActivityResponse
    • AuthMessageData
    • AuthMessageResponse
    • AuthTokenData
    • AuthTokenResponse
    • BulletinBoardUpdate
    • BulletinBoardUpdatesResponse
    • CategoriesResponse
    • CategoryResponse
    • CategorySort
    • CategoryStatsData
    • CategoryStatsResponse
    • CategoryStatus
    • CategoryStatusFilter
    • CategoryTranslationData
    • CategoryTranslationFields
    • CategoryTranslationsResponse
    • CategoryWithStats
    • ContractOrder
    • CreateOrderData
    • CreateOrderRequest
    • CreateOrderResponse
    • CreateOrderResponseData
    • CryptoUpDownVariantData
    • ErrorCode
    • ErrorResponse
    • Fee
    • FeeEventData
    • FeeEventsResponse
    • FeeType
    • LastOrderSettled
    • LastSaleData
    • LastSaleResponse
    • Market
    • MarketResponse
    • MarketRewards
    • MarketSort
    • MarketStatsData
    • MarketStatsResponse
    • OAuthCancelOrdersData
    • MarketStatus
    • OAuthCancelOrdersRequest
    • MarketStatusFilter
    • OAuthCancelOrdersResponse
    • OAuthCreateOrderData
    • MarketTimeseries
    • OAuthCreateOrderRequest
    • MarketTimeseriesLatest
    • MarketTradingStatus
    • OAuthCreateOrderResponse
    • OAuthFinalizeData
    • MarketTranslationData
    • OAuthFinalizeRequest
    • MarketType
    • MarketVariant
    • OAuthFinalizeResponse
    • OAuthOrdersData
    • MarketWithStats
    • MarketsResponse
    • OAuthOrdersRequest
    • MatchData
    • OAuthOrdersResponse
    • MatchesResponse
    • OAuthPositionsData
    • Metric
    • OAuthPositionsRequest
    • OAuthPositionsResponse
    • OrderData
    • OrderFillData
    • OrderResponse
    • OrderStatus
    • OrderStatusFilter
    • OrderStrategy
    • OrderbookData
    • OrderbookResponse
    • OrderbooksResponse
    • OrdersResponse
    • Outcome
    • OutcomeSide
    • OutcomeStatus
    • OutcomeTranslation
    • OutcomeVariantData
    • OutcomeVariantData_SportsTeamOutcomeData
    • PendingYieldData
    • PendingYieldResponse
    • PointsInfo
    • PositionData
    • PositionSort
    • PositionsResponse
    • PostAuthRequest
    • RemoveOrdersData
    • PriceFeedProvider
    • RemoveOrdersRequest
    • RemoveOrdersResponse
    • PriceLevel
    • QuoteType
    • ReferralInfo
    • ReferralStatus
    • RemoveOrdersByHashData
    • RemoveOrdersByHashRequest
    • ReservedBalancePolicy
    • Resolution
    • ResolutionProvider
    • RewardPeriod
    • SearchData
    • SearchResponse
    • SelectTeamsRequest
    • SelfTradePreventionStrategy
    • SetReferralData
    • SetReferralRequest
    • SetReferralResponse
    • SportsDataProvider
    • SportsEventTeam
    • SportsFifaFriendliesVariantData
    • SportsFifaWorldCupVariantData
    • SportsNbaVariantData
    • SportsPropsMarketData
    • SportsTeamOutcomeData
    • Tag
    • TagsResponse
    • Team
    • TeamSide
    • TimeseriesData
    • TimeseriesLatestBatchResponse
    • TimeseriesLatestData
    • TimeseriesLatestResponse
    • TimeseriesPoint
    • TimeseriesResponse
    • TweetCountVariantData
    • VariantData
    • VariantData_CryptoUpDownVariantData
    • VariantData_SportsFifaFriendliesVariantData
    • VariantData_SportsFifaWorldCupVariantData
    • VariantData_SportsNbaVariantData
    • VariantData_SportsPropsMarketData
    • VariantData_TweetCountVariantData
  1. WebSocket

General Information

The Predict WebSocket API streams live market data and account activity over a single persistent connection.

Connection#

Connect to wss://ws.predict.fun/ws over TLS (port 443). Connections are served only on the /ws path. A request to any other path, or a non-Upgrade request, is rejected before the connection opens.

Authentication#

Connections are authenticated with an API key, supplied at connection time (the handshake), not per message. Pass it either way:
x-api-key: <key> request header (preferred).
?apiKey=<key> alternatively use a query parameter.
Each key carries its own rate limits, and an invalid key rejects the handshake with HTTP 401.
Wallet events (predictWalletEvents) are user-scoped and additionally require a valid wallet JWT in the topic string.
Handshake rejections are returned as HTTP status codes (for example 401 for an invalid key, 503 when the service is temporarily unavailable). Errors that occur after the connection is open are delivered as JSON response messages (see Response Format).

Data format and timing#

All client and server messages are JSON text frames.
Field names and values are case-sensitive.
Heartbeat and event timestamps are epoch milliseconds (UTC).
Messages are delivered in the order events occur.

Subscriptions#

Subscribe and unsubscribe at any time after connecting; one topic per request.
For most market-data topics, the latest known value is delivered immediately on subscribe as a snapshot, followed by live updates.

Connection liveness#

The server sends a heartbeat every 15 seconds that the client must echo back; a missed heartbeat closes the connection. See Heartbeats. Clients should reconnect with backoff and re-subscribe to their topics on reconnect.
Modified at 2026-06-18 15:44:19
Previous
How to create or cancel orders
Next
Request Format
Built with