Skip to main content
Receive live market data using your organisation’s WebSockets credential. This guide reads trades; it does not place an order.

1. Set up access

  1. Create an account or log in.
  2. Select your organisation and an eligible paid plan with WebSockets access. Free signup alone does not enable streams.
  3. Open Endpoints → WebSockets → API keys and create a credential with stream.read. Save the secret when it is shown.
  4. Set BRAVADO_API_KEY and BRAVADO_API_SECRET in your server environment. Never put the secret in browser code, a URL or source control.

2. Connect and receive trades

Install ws with npm install ws. Save the following as stream.mjs, then run node stream.mjs with your environment variables set.
Node.js
The server sends a recent-trades snapshot, then trade frames. No subscription message is needed. Node’s ws client responds to heartbeat pings automatically. See the trade frame reference. Generate a new timestamp and signature for every reconnect. This example ends after 30 seconds; it is not a production reconnect loop. Use backoff in your application and inspect authentication failures before retrying.
This is a live, billable connection. Snapshot and trade payloads consume WebSocket credits. Closing the socket stops further delivery; data already delivered remains counted.

3. Check your usage

Open Usage and Billing in the same Console organisation that owns the key. Messages and credits are different units: the current stream tariff is 1 credit per 100,000 delivered uncompressed UTF-8 bytes, not one credit per message or per connection. Heartbeats and errors are not billed. Usage is batched while connections remain open. Allow about a minute, then refresh. Home’s activity window and Billing’s current cycle can cover different periods. Use the same organisation and period when comparing Console and Admin.

4. Add order books or trader analytics

  • Use an assetId from a trade with the authenticated order-book guide. It supports Polymarket and Predict.fun when your organisation has access to the venue.
  • Query the trader’s history with the Trader Data API, using a credential with analytics.read and its own HMAC signature. A WebSockets-only key does not grant Analytics access.
  • For order execution, follow the separate Trade quickstart.

Troubleshooting

  • 401: check the matching key and secret, current millisecond timestamp and exact signed path. Keep your system clock synchronized.
  • 403: inspect the error code and confirm scope, plan and venue access. Creating an endpoint does not grant these permissions.
  • Connected but no updates: inspect snapshot/status/error frames and market activity; a successful handshake alone does not prove data delivery.
  • No Console usage: confirm you used the authenticated /stream/.../partner route and selected the key’s organisation. Legacy Terminal URLs are not a replacement for this integration.
Browser WebSocket clients cannot set these authentication headers. Connect from your backend and relay only the data your frontend is allowed to receive; never send the API secret to the browser.