Data API

Streaming

Trades as they land, filtered before they reach you.

WSwss://wss.hexio.trade/v1/stream/transactions

Live trades. Available from Pro upward, or as an add-on.

Connection parameters

NameTypeDescription
api_keystringRequired. Browsers cannot set headers on a WebSocket handshake — see Authentication.
walletscsvOnly trades from these addresses.
marketscsvOnly trades in these condition ids.
min_usdcfloatDrop trades below this size. The single most effective filter — most trades are dust.

What arrives

The first message confirms what you are subscribed to. Filters you did not set come back empty, which is how you check a typo did not silently widen the subscription.

First message
{
  "type": "subscribed",
  "filters": { "wallets": [], "markets": [], "min_usdc": 0.0 },
  "note": "credits billed per 100 delivered messages"
}
Billing is per 100 messages delivered, not per minute connected. A socket that is open all day and filtered tightly costs almost nothing; an unfiltered one is expensive. Set min_usdc.

A connection that survives the night

Networks drop, deploys happen, laptops sleep. Anything long-lived needs reconnect logic, and it needs to tell apart “try again” from “stop”.

JavaScript
function connect() {
  const qs = new URLSearchParams({ api_key: KEY, min_usdc: '500' });
  const ws = new WebSocket(`wss://wss.hexio.trade/v1/stream/transactions?${qs}`);
  let attempt = 0;

  ws.onopen = () => { attempt = 0; };

  ws.onmessage = (e) => {
    const msg = JSON.parse(e.data);
    if (msg.type === 'subscribed') { console.log('filters', msg.filters); return; }
    handleTrade(msg);
  };

  ws.onclose = (e) => {
    // 4401/4402/4429 are decisions, not blips. Reconnecting cannot fix a revoked
    // key or an empty balance, and hammering a 4429 keeps the slot occupied.
    if ([4401, 4402, 4429].includes(e.code)) {
      console.error('stream refused:', e.code, e.reason);
      return;
    }
    const wait = Math.min(2 ** attempt++ * 1000, 30000) + Math.random() * 500;
    setTimeout(connect, wait);
  };

  return ws;
}

Close codes

CodeMeaningReconnect?
4401Key missing, wrong, or revokedNo
4402Out of creditsNo
4429Too many concurrent streams for the planClose another first
1006Connection droppedYes, with backoff

Concurrent stream allowance is per plan — 1 on Pro, 3 on Business. Check parallel_streams in /v1/usage.

Never from the browser directly

The key goes in the URL, so a browser connection publishes it to anyone who opens devtools — and to proxy logs and browser history on the way. Connect from your backend and relay to the client over your own socket. That also lets one upstream connection serve every user, which is what the per-plan stream limit assumes.

Filter server-side, not in your handler. Passing min_usdc and wallets means the messages are never sent — and never billed. Receiving everything and discarding most of it in an if costs the same as reading it all.