Skip to content
Drazill logoStagingTesting mode — staging environment. No real money: balances, trades, and accounts are for testing only and may be reset at any time.DEMODemo mode: simulated data, for showcase only

Developer platform

OverviewAPI keysUsageWebhooksRealtimeAPI referenceStatus

Realtime API

Stream order books, trades, prices, market events and your private notifications over one WebSocket.

Full realtime protocol reference — every channel, event, and sequence/replay rule — docs.drazill.com/realtime ↗

Connecting

Open a WebSocket to /ws. Anonymous connections can subscribe to every public channel. For your private user: stream or the tier-entitled feed, authenticate by sending an auth message first — never put a token in the URL.

const ws = new WebSocket("wss://api.drazill.com/ws");

// 1) authenticate (optional for public channels)
ws.onopen = () => ws.send(JSON.stringify({ type: "auth", api_key: "<DRAZILL_API_KEY>" }));

// 2) subscribe
ws.send(JSON.stringify({ type: "subscribe", channels: ["prices:OUTCOME_ID", "trades:MARKET_ID"] }));

Channels

Public market-data channels are open to anonymous browsers. For API-key clients the lighter channels are reachable on the FREE tier, while the full order-book depth and trade tape bind to the ENTERPRISE feed tier.

ChannelEvent(s)AuthFeed tierReplay
orderbook:{outcome_id}
Full order-book depth (bids & asks) for an outcome.
orderbook_update
publicPremium (ENTERPRISE)ephemeral
trades:{market_id}
Executed trades on a market — the raw tape.
trade
publicPremium (ENTERPRISE)durable
prices:{outcome_id}
Price-tick updates for an outcome (previous price + % change).
price_tick
publicPublic (FREE)ephemeral
market:{market_id}
Market-level events such as status changes and resolution, plus coalesced live play-by-play ticks (game_play) for sports games.
market_event
game_play
publicPublic (FREE)durable
category:{slug}
Market events aggregated for a category.
market_event
publicPublic (FREE)durable
user:{user_id}
Your private stream: notifications, order fills/cancels, wallet updates, parlay lifecycle ticks, group-conversion receipts, and market-copilot answer deltas. Auto-subscribed on connect; requires auth.
notification
order_filled
order_cancelled
wallet_update
parlay_update
copilot_delta
group_conversion
owner—durable
chat:{channel_id}
Chat messages in a market/category room (membership required).
chat_message
membership—ephemeral
mbo:{market_id}
Market-by-order: the order lifecycle as the book sees it — rests, cancels, size reductions and trades — with each order identified by an irreversible, daily-rotating anonymized reference. Live-forward only (no historical reconstruction); requires the premium feed tier.
mbo_add
mbo_cancel
mbo_reduce
mbo_trade
publicPremium (ENTERPRISE)ephemeral
contest:{contest_id}
Contest standings refreshes — one tick per scoring run, carrying the run's applied-at so a client can show honest staleness.
contest_standings
publicPublic (FREE)ephemeral

Sequence & replay

Every event carries a monotonically increasing per-channel sequence. Persist the last sequence you processed on each channel; on reconnect, resubscribe and the server replays the durable events you missed (fills, cancels, wallet updates, trades, market events, and everything on your private channel) so a fill is never silently dropped. Ephemeral events (price ticks, order-book snapshots) are superseded by the next message and are not replayed.

Heartbeat

The server sends periodic ping messages; reply with {"type":"pong"} to keep the connection alive.

Sample code (SDK)

import { Drazill } from "drazill";

const ws = new Drazill({ apiKey: "<DRAZILL_API_KEY>" }).ws();
ws.connect();
ws.subscribe("prices:OUTCOME_ID", (data) => console.log("price", data));
ws.subscribe("trades:MARKET_ID", (data) => console.log("trade", data));
from drazill import DrazillClient
import asyncio

ws = DrazillClient(api_key="<DRAZILL_API_KEY>").ws()

async def stream():
    await ws.connect()
    await ws.subscribe("prices:OUTCOME_ID")
    async for event in ws.listen():
        print(event["type"], event.get("data"))

asyncio.run(stream())
Markets
Portfolio