Overview

Subscribe to real-time streams for specific tokens or entire networks.

WebSocket API

The InsightX WebSocket API delivers real-time blockchain data directly to your application. Instead of polling REST endpoints, you open a single persistent connection and subscribe to the streams and addresses you care about.

Base URL

wss://api.insightx.network/?api-key=YOUR_API_KEY

Quick Start

const ws = new WebSocket("wss://api.insightx.network/?api-key=YOUR_API_KEY");

ws.onopen = () => {
  // Subscribe to cluster updates for a token
  ws.send(JSON.stringify({
    op: "subscribe",
    network: "sol",
    address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    stream: "clusters"
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  console.log(msg.op, msg);
};

Authentication

Authentication is performed via the api-key query parameter. The key must be a valid UUID tied to an active API account. You can create and manage API keys at the InsightX Hub.

ScenarioBehaviour
Missing api-key parameterConnection rejected with close code 4401
Malformed key (not a valid UUID)Connection rejected with close code 4401
Key not found or inactiveConnection rejected with close code 4401
Connection limit exceededConnection accepted, then closed with code 1013 and a CONN_LIMIT error message

Note: Authentication happens before the WebSocket handshake is accepted. If your key is invalid, you will receive a close frame immediately -- no ready message is sent.

Connection Lifecycle

Client                                   Server
  │                                        │
  │── GET /ws/?api-key=xxx ───────────────>│  (1) HTTP Upgrade
  │                                        │  (2) Validate API key
  │                                        │  (3) Check connection limit
  │<── 101 Switching Protocols ────────────│
  │<── {"op":"ready","ts":1707300000} ─────│  (4) Connection established
  │                                        │
  │── {"op":"subscribe",...} ─────────────>│  (5) Subscribe to topics
  │<── {"op":"subscribed",...} ────────────│
  │                                        │
  │<── {"op":"event",...} ─────────────────│  (6) Receive real-time events
  │<── {"op":"event",...} ─────────────────│
  │                                        │
  │── {"op":"ping","id":"abc"} ──────────>│  (7) Keep-alive
  │<── {"op":"pong","id":"abc",...} ───────│
  │                                        │
  │── close ──────────────────────────────>│  (8) Disconnect

The ready Message

After a successful connection, the server sends:

{
  "op": "ready",
  "ts": 1707300000
}

This confirms the connection is authenticated and ready to accept commands. Do not send subscribe messages before receiving ready.

Plan Limits

Your API plan determines three WebSocket limits:

LimitDescription
Max connectionsMaximum number of simultaneous WebSocket connections across all your API keys. Exceeding this returns a CONN_LIMIT error.
Max topicsMaximum number of address+stream subscriptions active at the same time on a single connection. Exceeding this returns a TOPIC_LIMIT error.

Supported Networks

NetworkID
Ethereumeth
Solanasol
Basebase
BNB Smart Chainbsc
Monadmonad
XLayerxlayer
Abstractabs

Supported Streams

StreamSupported NetworksDescription
dex_metricssol, eth, base, bscUnified holder analysis stream delivering top-10 distribution, clusters, and (on Solana) snipers, bundlers, insiders, and dev holdings. See DEX Metrics Stream for details.
clustersAll networksReal-time token holder cluster analysis. See Clusters Stream for details.
bundlerssolReal-time bundler concentration percentage. See Bundlers Stream for details.
insiderssolReal-time insider and dev holdings percentages. See Insiders Stream for details.
sniperssolReal-time sniper concentration percentage. See Snipers Stream for details.
distributionsol, eth, base, bscReal-time top-10 holder distribution percentage.
scannersolReal-time token security scan events. See Scanner Stream for details.
dex_tradessolReal-time DEX trade events with multi-address filtering. See DEX Trades Stream for details.

New streams will be added over time. Sending an unrecognized stream name returns a BAD_STREAM error. Subscribing to a stream on an unsupported network returns a BAD_NETWORK error.

Message Format

All messages -- both client-to-server and server-to-client -- are JSON objects. Every message includes an op field indicating the operation type.

Client Operations

OperationDescription
subscribeSubscribe to one or more topics
unsubscribeUnsubscribe from topics
pingKeep-alive ping

Server Operations

OperationDescription
readyConnection established and authenticated
subscribedSubscription confirmation
unsubscribedUnsubscription confirmation
eventReal-time data event
pongPing response
errorError response