Skip to main content

Overview

The Alerts endpoint lets you receive the same events as Struct’s webhooks (trader whale trades, PnL crossings, probability spikes, volume milestones, and more) pushed directly over a websocket connection instead of HTTP POSTs. This is useful when you want the low-latency push model of webhooks without having to host a public HTTP endpoint.

Perfect for In-App Alert Systems

Alerts are especially well-suited for building in-app notification systems on trading platforms, letting your users track specific wallets, listen for price spikes on markets they care about, get notified when volume milestones are hit, or follow whale activity in real time.Because subscriptions are scoped to a single connection, you can open a dedicated socket per logged-in user and dynamically subscribe and unsubscribe as they adjust their alert preferences, without touching any server-side webhook configuration.

Endpoint

wss://api.struct.to/ws/alerts?api-key=YOUR_API_KEY
Alerts use the same API key authentication as the Rooms endpoint. Subscriptions are ephemeral: they live only for the duration of the connection and are dropped on disconnect.

Subscribing

Subscribe to an alert type by sending a JSON message. The op and event fields identify the subscription; all filter fields are flat on the top level of the message.
{
  "op": "subscribe",
  "event": "trader_whale_trade",
  "wallet_addresses": ["0xabc..."],
  "min_usd_value": 10000
}
The server acknowledges with:
{
  "op": "subscribed",
  "event": "trader_whale_trade",
  "subscription_id": "b9c0e4b0-1a2d-4e3f-9c0a-111122223333"
}

Unsubscribing

Send an unsubscribe message whose filter fields match the original subscription exactly:
{
  "op": "unsubscribe",
  "event": "trader_whale_trade",
  "wallet_addresses": ["0xabc..."],
  "min_usd_value": 10000
}
Response:
{
  "op": "unsubscribed",
  "event": "trader_whale_trade"
}

Message Format

Each alert is pushed as JSON with the event name, a millisecond Unix timestamp, and the payload:
{
  "event": "trader_whale_trade",
  "timestamp": 1775913505260,
  "data": { ... }
}

Available Events

Trader Events

EventDescription
trader_first_tradeFirst-ever trade by a trader on Polymarket
trader_new_marketTrader’s first trade in a specific market
trader_new_tradeEvery order-filled trade, with optional filters
trader_trade_eventTyped trade-event union covering every confirmed trade variant
trader_whale_tradeTrade exceeds configured size and probability thresholds
trader_global_pnlTrader’s global PnL crosses a threshold
trader_market_pnlTrader’s per-market PnL crosses a threshold
trader_event_pnlTrader’s per-event PnL crosses a threshold

Metrics

EventDescription
condition_metricsMarket volume or transaction metrics cross a threshold
event_metricsEvent aggregated metrics cross a threshold
position_metricsPosition metrics cross a threshold

Volume Milestones

EventDescription
market_volume_milestoneMarket volume crosses a USD milestone
event_volume_milestoneEvent volume crosses a USD milestone
position_volume_milestonePosition volume crosses a USD milestone

Spikes

EventDescription
probability_spikePosition probability changes rapidly
price_spikePosition price changes rapidly
market_volume_spikeMarket volume exceeds baseline by spike ratio
event_volume_spikeEvent volume exceeds baseline by spike ratio
position_volume_spikePosition volume exceeds baseline by spike ratio

Market Lifecycle

EventDescription
close_to_bondTrade at a near-certain-outcome price
market_createdNew prediction market detected on-chain
oracle_eventsTyped UMA oracle lifecycle event affecting a market

Asset Prices

EventDescription
asset_price_tickRaw Chainlink price tick for a crypto asset
asset_price_window_updateCrypto asset candle open or close

Errors

Invalid messages return a JSON error:
{
  "error": "unknown event type"
}

Keepalive

Send a periodic ping to keep the connection alive:
{ "type": "ping" }
The server responds with { "type": "pong" }.

Pricing

Alerts are billed at 0.1 or 0.2 credits per delivered event depending on the event type, with a standard 1 credit connection hold on connect. See each alert’s page for its specific cost, or visit Pricing for details.

Rooms vs. Alerts

Rooms (/ws)Alerts (/ws/alerts)
ShapeRaw data streams (trades, prices, metrics)Event-triggered notifications
FilteringRoom-specific filter fieldsSame filters as webhooks
BillingPer-message rate by room0.1 or 0.2 credits per delivered event
Use caseDashboards, trading UIs, analyticsNotifications, agents, automations
Last modified on April 25, 2026