WebSocket
Live streams for prices, trades, order books, accounts and more.
Connect
| Base URL | wss://api.xrpl.to/ws/ |
| API key | Optional. Add ?apiKey=xrpl_… to the URL, or send an auth message where a stream lists one. |
| Heartbeat | Send { type: "ping" } to receive { type: "pong", time } |
| Compression | All endpoints support permessage-deflate |
| Reconnecting | Implement exponential backoff |
| Close codes | 4010 rate limit, 4011 max connections/subscriptions, 4012 message size, 4020-4025 invalid params, 4029 connection limit reached ({ error } sent before close) |
A session
- Connectyou send
wss://api.xrpl.to/ws/sync?apiKey=xrpl_… - Subscribeyou send
{ "type": "subscribe", "tokens": ["<md5>", …] } - Confirm and snapshotthe server sends
{ "type": "subscribed" }, then the current state of those tokens - Updatesthe server sends
a message each time one of them changes - Ping (optional)you send
{ "type": "ping" } → { "type": "pong", "time" }
Streams
- WS
wss://api.xrpl.to/ws/sync/Multi-token market sync (handshake first, token data via updates) - WS
wss://api.xrpl.to/ws/token/{md5}Single token real-time updates - WS
wss://api.xrpl.to/ws/ohlc/{md5}OHLC candlestick streaming - WS
wss://api.xrpl.to/ws/history/{md5}Trade history streaming - WS
wss://api.xrpl.to/ws/holders/{id}Token holder richlist streaming (id = token md5) - WS
wss://api.xrpl.to/ws/orderbookDEX orderbook depth streaming - WS
wss://api.xrpl.to/ws/ledgerLedger close stream - WS
wss://api.xrpl.to/ws/trustlines/{account}Account trustlines streaming - WS
wss://api.xrpl.to/ws/newsReal-time news feed - WS
wss://api.xrpl.to/ws/account/balance/{account}Account XRP balance streaming - WS
wss://api.xrpl.to/ws/account/balance/pair/{account}Token pair balance streaming - WS
wss://api.xrpl.to/ws/account/offers/{account}Open DEX offers streaming - WS
wss://api.xrpl.to/ws/amm/infoLive AMM pool info streaming (5s poll) - WS
wss://api.xrpl.to/ws/account/watch/{account}Live account activity feed (parsed tx events) - WS
wss://api.xrpl.to/ws/account/tx/{account}Raw account transaction stream (same shape as GET /account/tx) - WS
wss://api.xrpl.to/ws/creator/{identifier}Creator activity stream (identifier = token md5 or creator address) - WS
wss://api.xrpl.to/ws/socialX/Twitter mentions feed
Example
// One token
const ws = new WebSocket('wss://api.xrpl.to/ws/token/0413ca7cfc258dfaf698c02fe304e607');
ws.onmessage = (e) => console.log(JSON.parse(e.data));
// Many tokens over one socket
const sync = new WebSocket('wss://api.xrpl.to/ws/sync');
sync.onopen = () => sync.send(JSON.stringify({ type: 'subscribe', tokens: ['<md5>', '<md5>'] }));
setInterval(() => sync.send(JSON.stringify({ type: 'ping' })), 30000);