Streaming
Marking supports multiplexed WebSocket feeds.
wss://api.marking.fyi/v1/streams?feedIds=btc-usd,eth-usd,sol-usd&format=json
Server-side clients authenticate with an API key in the WebSocket upgrade header:
import WebSocket from "ws";
const socket = new WebSocket(
"wss://api.marking.fyi/v1/streams?feedIds=btc-usd,eth-usd,sol-usd&format=json",
{ headers: { authorization: `Bearer ${process.env.MARKING_API_KEY}` } },
);
Autonomous paid agents authenticate with an x402-created lease:
wss://api.marking.fyi/v1/streams?leaseId=<lease-id>&feedIds=btc-usd,eth-usd
Message types
| Type | Meaning |
|---|---|
ready | Connection accepted and subscribed feeds confirmed |
snapshot | Current latest signed state at connection time |
update | New canonical signed update |
candle_snapshot | Latest candle state for requested candle intervals |
candle | Live candle update |
replay | Bounded replay response |
error | Stream or authorization problem |
Reconnect and replay
Keep the last accepted sequence per feed. On reconnect, send a replay request or use the after cursor pattern supported by the edge path:
{
"btc-usd": "219870676620297556",
"eth-usd": "219870676624445669"
}
Consumers should treat duplicate or reordered frames as transport artifacts, not automatic feed failure.