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

# SSE

> GET /v1/stream/{channel}: one channel as Server-Sent Events. The event name is the frame type.

`GET /v1/stream/{channel}` with the channel's parameters in the query. The frames are the WebSocket's; each one is an SSE event whose **name is the frame `type`**.

```
event: snapshot
data: {"channel":"trades","chain":"sol","token":"<mint>","type":"snapshot","data":[…]}

event: trade
data: {"channel":"trades","chain":"sol","token":"<mint>","type":"trade","data":{…}}
```

A comment line every 15 s keeps proxies from closing an idle stream. Wrong parameters answer **400** JSON before the stream starts. While the server is at capacity, a new stream answers **503** `server_busy` with `Retry-After: 30` before it starts; streams already open keep running.

## Browser

`EventSource` cannot set headers: pass `?apiKey=`. Because every event is named, `onmessage` never fires; listen to the types you want.

```javascript theme={null}
const url = `https://api.raze.bot/v1/stream/trades?chain=sol&token=${mint}&apiKey=${KEY}`;
const es = new EventSource(url);

es.addEventListener("snapshot", (e) => tape.reset(JSON.parse(e.data).data));
es.addEventListener("trade", (e) => tape.prepend(JSON.parse(e.data).data));
es.addEventListener("retract", (e) => tape.remove(JSON.parse(e.data).data)); // Solana: a block lost its fork
es.addEventListener("lagged", () => es.close()); // then reopen: the new stream starts with a snapshot
es.addEventListener("error", (e) => { if (e.data) console.error(JSON.parse(e.data).error); });
```

`EventSource` reconnects on its own after a network drop, and the new stream starts with a fresh `snapshot`. It does not retry a refused stream (a `503`): open a new `EventSource` after 30 s.

## curl

```bash theme={null}
curl -N -H "x-api-key: $KEY" "$API/v1/stream/launchpad?board=graduating&chain=bsc"
curl -N -H "x-api-key: $KEY" "$API/v1/stream/candles?chain=sol&token=$MINT&interval=1m&unit=marketCap"
curl -N -H "x-api-key: $KEY" "$API/v1/stream/prices"
```

## URLs per channel

| Channel | URL |
| - | - |
| `trades` | `/v1/stream/trades?chain=sol&token=<mint>` |
| `candles` | `/v1/stream/candles?chain=sol&token=<mint>&interval=1s` |
| `token` | `/v1/stream/token?chain=eth&token=<contract>` |
| `launchpad` | `/v1/stream/launchpad?board=new` (add `&chain=` to filter) |
| `prices` | `/v1/stream/prices` |
| `wallet` | `/v1/stream/wallet?wallet=<solana address>` |

One stream is one channel. A page that needs several channels opens one `EventSource` each, and browsers allow only about six HTTP/1.1 connections per host: past two or three channels, use the [WebSocket](/streaming/websocket).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.