Connecting
Connect using Socket.IO with your API key or a client token: With API key (merchant-level access):CORE_ACCESS scope. Client token connections never receive them.
Socket.IO Client Example
Events
Trade Updates
Fired whenever a trade changes status. This is the most important event for keeping your UI in sync.data.trade object is the same Trade shape you see in callbacks and API responses.
Trade events are not game-specific. You’ll receive updates for all games (CS2 and Rust) on the same connection.
Crypto Deposit Updates
Fired when a merchant crypto deposit changes state:Crypto Withdrawal Updates
Fired when a merchant crypto withdrawal changes state:Market Updates
Fired when the instant-delivery market changes: an item becomes available, an existing item changes (typically its price), an item is no longer available, or the pool is rebuilt. This mirrors whatGET /secure/market?source=internal returns, so you can keep a local copy of the market current without polling.
Market updates require an API key connection where the key has the CORE_ACCESS scope. Client token connections do not receive this event.
Notes on applying events:
upsertandpatchboth carry the full item. Apply either as an idempotent upsert keyed onitem.id; the distinction only signals whether the item is new or changed.- A
removecan arrive for an item you never saw. Ignore it in that case. - On
sync, your local view may be arbitrarily stale. RefetchGET /secure/market?source=internaland rebuild from the response. - Prices are per merchant account, so the
offer.priceyou receive already reflects your fee. Still validate the price at purchase time as described in Market.
internal. Additional games and sources will reuse the same event and envelope.
WebSocket vs Callbacks
Both WebSocket and callbacks deliver trade updates. They serve different purposes:
Use both. WebSocket for instant UI feedback, callbacks for the authoritative balance updates. Don’t process balance changes based on WebSocket events alone.
Connection Notes
- Only the
websockettransport is supported (no HTTP long-polling fallback) - The connection authenticates once on connect. If your token expires, reconnect with a fresh one.
- All events are scoped to your merchant account. You only see your own trades.