> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Token Discovery Streams

> Stream new Solana token launches, Pump.fun graduations, trending tokens, and live market events over the Datastream WebSocket in real time.

The Datastream WebSocket lets you watch the Solana token lifecycle as it happens. You can see when a token is created, moves through its bonding curve, and graduates to a DEX pool.

<Info>
  **URL:** `wss://datastream.solanatracker.io/{apiKey}`\
  Available on Premium, Business, and Enterprise plans.
</Info>

## New Tokens

Subscribe to `latest` to get every new token and pool the moment it's created on Solana.

```javascript theme={null}
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({ type: "join", room: "latest" }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type !== "message") return;

  const { token, pools } = msg.data;
  console.log(`New: ${token.name} (${token.symbol})`);
  console.log(`  Mint: ${token.mint}`);
  console.log(`  Created on: ${token.createdOn}`);
  console.log(`  Pool: ${pools[0]?.poolId}`);
  console.log(`  Deployer: ${pools[0]?.deployer}`);
};
```

**Payload includes:**

* Token metadata (name, symbol, mint, image, description, socials)
* Pool details (DEX, liquidity, initial price, market cap)
* Creation info (creator wallet, creation tx, timestamp)

***

## Graduating Tokens

Subscribe to `graduating` to see tokens approaching bonding curve completion (85–100%). A bonding curve is the pricing path a launch token follows before it moves to a normal DEX pool.

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: "graduating" }));

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type !== "message") return;

  const { token, pools } = msg.data;
  const curve = pools[0]?.curvePercentage;
  console.log(`Graduating: ${token.name} — ${curve}% curve`);
  console.log(`  MC: $${pools[0]?.marketCap?.usd?.toLocaleString()}`);
};
```

### Filter by Market and SOL Threshold

Narrow down graduating tokens by market and minimum SOL in the curve:

```javascript theme={null}
// Only pump.fun tokens with at least 50 SOL
ws.send(JSON.stringify({ type: "join", room: "graduating:pumpfun:50" }));

// Only launchpad tokens with at least 100 SOL
ws.send(JSON.stringify({ type: "join", room: "graduating:launchpad:100" }));
```

***

## Graduated Tokens

Subscribe to `graduated` to get notified the moment a token completes its bonding curve and migrates to a DEX pool.

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: "graduated" }));

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type !== "message") return;

  const { token, pools } = msg.data;
  console.log(`Graduated: ${token.name}`);
  console.log(`  New pool: ${pools[0]?.poolId}`);
  console.log(`  Liquidity: $${pools[0]?.liquidity?.usd?.toLocaleString()}`);
};
```

***

## Curve Percentage Alerts

Subscribe to `{market}:curve:{percentage}` to get alerted when any token on a specific market hits a bonding curve milestone.

Supported markets: `pumpfun`, `launchpad`, `boop`, `meteora-curve`.

```javascript theme={null}
// Alert when pump.fun tokens hit 30% curve
ws.send(JSON.stringify({ type: "join", room: "pumpfun:curve:30" }));

// Alert at 50%
ws.send(JSON.stringify({ type: "join", room: "pumpfun:curve:50" }));

// Alert at 80%
ws.send(JSON.stringify({ type: "join", room: "pumpfun:curve:80" }));
```

Example strategy: watch at 30% for early signals, then alert more loudly at 80% or higher.

***

## Token Metadata Changes

Subscribe to `metadata:{tokenAddress}` to get notified when a token updates its metadata (name, image, socials, etc.):

```javascript theme={null}
ws.send(JSON.stringify({ type: "join", room: `metadata:${token}` }));
```

***

## Example: New Token Scanner

Build a live feed that filters new tokens by criteria:

```javascript theme={null}
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({ type: "join", room: "latest" }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type !== "message") return;

  const { token, pools } = msg.data;
  const pool = pools[0];
  if (!pool) return;

  // Filter: only tokens with socials and decent liquidity
  const hasSocials = token.strictSocials?.twitter || token.strictSocials?.telegram;
  const hasLiquidity = pool.liquidity?.usd > 1000;

  if (hasSocials && hasLiquidity) {
    console.log(`✓ ${token.name} (${token.symbol})`);
    console.log(`  MC: $${pool.marketCap?.usd?.toLocaleString()}`);
    console.log(`  Liq: $${pool.liquidity?.usd?.toLocaleString()}`);
    console.log(`  Twitter: ${token.strictSocials?.twitter || "—"}`);
  }
};
```

***

## Example: Graduation Pipeline

Watch tokens across their full lifecycle:

```javascript theme={null}
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

ws.onopen = () => {
  // Watch the full pipeline
  ws.send(JSON.stringify({ type: "join", room: "pumpfun:curve:50" }));
  ws.send(JSON.stringify({ type: "join", room: "graduating" }));
  ws.send(JSON.stringify({ type: "join", room: "graduated" }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type !== "message") return;

  const room = msg.room;
  const name = msg.data?.token?.name || "Unknown";

  if (room?.includes("curve:")) {
    console.log(`[50% CURVE] ${name} — halfway through bonding curve`);
  } else if (room === "graduating") {
    console.log(`[GRADUATING] ${name} — approaching completion`);
  } else if (room === "graduated") {
    console.log(`[GRADUATED] ${name} — now on DEX`);
  }
};
```

***

## Room Reference

| Room                        | What you get                                |
| --------------------------- | ------------------------------------------- |
| `latest`                    | Every new token/pool created                |
| `graduating`                | Tokens approaching curve completion         |
| `graduating:{market}:{sol}` | Filtered by market and SOL threshold        |
| `graduated`                 | Tokens that just moved to DEX               |
| `{market}:curve:{pct}`      | Tokens hitting a curve percentage milestone |
| `metadata:{token}`          | Metadata changes                            |

<CardGroup cols={2}>
  <Card title="Token Discovery (REST)" href="/guides/token-discovery">
    REST endpoints for trending, volume leaders, and top performers.
  </Card>

  <Card title="Safety Streams" href="/guides/datastream-safety">
    Track snipers, bundlers, insiders, and holder changes in real time.
  </Card>
</CardGroup>
