GET /v2/stream is a Server-Sent Events connection that delivers every change matching your filters as it happens. Frames are not metered, so following the market is cheaper than polling for it — and you see a move the moment it lands rather than on your next tick.
curl -N 'https://api-beta.betwatch.com/v2/stream?snapshot=none&sport=thoroughbred&country=au&cursor=cur_8fKq2mXb...' \
--header 'X-API-Key: YOUR_API_KEY'The cursor comes from a REST bootstrap. See Starting up before opening the stream.
Requires the stream scope. See Authentication.
What arrives
event: ready
id: cur_8fKq2mXbTnPdW4sVfHjLcR9Nb3xKpQ
data: {"cursor":"cur_8fKq2mXbTnPdW4sVfHjLcR9Nb3xKpQ"}
event: odds
id: cur_2Xp5NqTbMvWd8HjRcFkLs9Kd7mQ
data: {"id":"odd_7Kd2mQx4...","eventId":"evt_7Kd2mQx4...","key":"win","entrantId":"ent_4Nb8xKpQ...","source":{"id":"betfair","name":"Betfair","kind":"exchange"},"state":"available","exchange":{"marketId":"1.234567890","selectionId":12345678,"marketState":"open","outcomeState":"active","inPlay":false,"back":[{"price":3.15,"size":42.5}],"lay":[{"price":3.2,"size":18}],"last":3.15},"observedAt":"2026-08-17T04:05:44Z","updatedAt":"2026-08-17T04:05:44Z"}| Frame | Payload | Meaning |
|---|---|---|
ready |
cursor | A snapshot=none connection opened at this position. Replay is not yet complete. |
event |
event id, status, start time | A race changed status or start time. |
entrant |
entrant | A runner changed — scratched, rider swap, gear. |
odds |
odds row | One source’s price changed. The frame you will see most. A state of withdrawn is a tombstone: remove it from current state. |
odds_set |
proposition plus rows | Several prices for one win or place at once, used during bootstrap. |
coverage |
coverage row | A source’s coverage of a race changed: it started or stopped pricing it, or its book count moved. |
sync |
cursor | For snapshot=none, replay reached the connection’s initial high-water mark and the baseline is reconciled. For snapshot=full, this commits the provisional snapshot at its anchor and is the first resumable frame; updates after that anchor follow. |
ping |
cursor | Resumable keepalive after bootstrap, roughly every 15 seconds. Nothing changed. |
resync |
reason | Your position is no longer replayable, or a race you follow was merged. Bootstrap again — see below. |
error |
code, detail | Something went wrong mid-stream. |
odds and odds_set carry the same row shape, so one apply function handles both. For a Betfair row, exchange.marketId and exchange.selectionId are native IDs that join the row directly to Betfair. They are optional, and they do not replace Betwatch evt_, ent_, or odd_ ids. Win and place use distinct market IDs. Treat an unrecognised frame name as a no-op: frames can be added.
Every data frame is new or changed. A frame arrives only when something in it differs from what this connection last delivered for the same resource — the odds row, coverage row, race, or runner. A newer observedAt or updatedAt alone is not a change, so the stream never re-sends state you already hold. A source that keeps confirming the same price sends nothing until the price moves. To see when Betwatch last checked a source, read observedAt from coverage over REST.
Order within a race
Frames for one race arrive in the order Betwatch published them. In particular, a price frame arrives before the coverage frame whose book it completed. Take the card from that coverage frame’s book.firstFull, not from the odds frames you hold: it carries every active entrant’s price at fullAt, so you do not need a REST read to get it.
book.firstFull is the first moment every active runner had a price from that source. It counts prices, not confirmations, so it records the card Betwatch held, not a certification that each price could be taken at that instant. A coverage frame or odds row’s confirmation reflects the source checks Betwatch had when it was published; a later check that only confirms an unchanged price does not re-send the odds row. To read every runner’s current confirmation, use REST (see A complete, confirmed market).
A live batch of prices for one race and source can arrive as several odds frames in a row; apply them in order. Treat fullAt as the moment the book filled, not the time the frame reached you.
Capturing the first full card
To keep each race’s first fully priced card from a source — say Sportsbet win for a day of greyhounds — snapshot the day with source=sportsbet&key=win (about 120 races fit one page at limit=200) and record every race whose coverage already has book.fullAt. Then connect to stream.url and, on each coverage frame, record the race the first time book.fullAt appears: book.firstFull is the card. Use fullAt rather than status, since a later scratching can turn a full book partial again while its first card stays fixed. On resync, snapshot again, record anything newly full, and follow the new stream.url; nothing already recorded changes.
/v2 coverage has no complete field; book is the completeness signal. (The 1.x Python SDK’s Coverage.complete meant the source’s last observation was a whole-race image, which a one-runner push update never is, so a fully priced race usually read complete=false.) Wait for book.fullAt.
Starting up
Snapshot over REST, then connect with snapshot=none. That is the path to build on: it is fast, it is resumable, and the cursor comes to you rather than being something you assemble.
Using Python? Start with the SDK README and runnable examples on GitHub. The SDK carries the filters and cursor into follow() and reconnects dropped connections for you. The protocol details below apply to any client implementing its own transport.
This keeps live prices and core event/entrant changes current, not all include=racing enrichment. Refresh form, silks, breeding and dividends over REST separately when needed.
# 1. Snapshot the races you want. Page until `next` is absent.
curl 'https://api-beta.betwatch.com/v2/events/snapshot?sport=thoroughbred&country=au' \
--header 'X-API-Key: YOUR_API_KEY'
# 2. Connect with the cursor it returned, replaying the filters it names.
curl -N 'https://api-beta.betwatch.com/v2/stream?snapshot=none&sport=thoroughbred&country=au&cursor=cur_8fKq2mXb...' \
--header 'X-API-Key: YOUR_API_KEY'GET /v2/events/snapshot returns current state for a page of races — field, prices, coverage — plus a stream block naming the cursor, the exact filters to replay, and url: the /v2/stream path and query that does it for you, with cursor and snapshot=none already set. Append compress if you want it and connect. Every page returns the same cursor, captured before the first page was read, so you can page to the end and then follow without missing a change to a race you read first. See Snapshot races.
For a single race, GET /v2/events/{id}/snapshot does the same thing for one race.
snapshot=full — one connection, narrow scope only
snapshot=full streams the current state as frames before going live, so a single connection needs no REST call at all:
curl -N 'https://api-beta.betwatch.com/v2/stream?event=evt_7Kd2mQx4TnPbW9sVfHjLcR' \
--header 'X-API-Key: YOUR_API_KEY'It requires an event, meeting, or venue filter. Anything broader is refused with 422 filter_required pointing at /v2/events/snapshot.
Committing a full bootstrap
The server anchors the retained stream before reading snapshot data. Snapshot data frames carry no SSE id; the sync frame commits the complete snapshot and carries its first resumable cursor. Everything published between the internal anchor and sync is delivered after sync.
So if a price moves at +10s while the snapshot hydrated that race at +5s, you receive the snapshot value during the bootstrap and the newer value after sync. Apply frames in order and you converge on current state. There is no silent staleness window, however long the bootstrap takes.
Two ways that can fail, and both tell you:
- If the anchor ages out of the replay window before the bootstrap finishes, you get a
resyncframe or a409. Bootstrap again over REST and reconnect with the freshcursor. - If a connection drops mid-bootstrap, discard the incomplete snapshot. Start
snapshot=fullagain without a cursor, or bootstrap over REST and connect withsnapshot=none. There is no pre-syncframe id to resume.
Snapshot and replay overlap
The cursor is captured before the snapshot reads anything. Reads return current state, so the snapshot may already contain an update that replay delivers again. Replay may also deliver an older value before a newer one already seen in the snapshot. Apply frames in order and idempotently by resource identity; do not count every replay frame as a new price movement. On a REST handoff or cursor resume, ready confirms connection opening and sync marks completion of the initial replay.
Both snapshot endpoints hand you the whole handoff in stream: the cursor plus the exact filters to replay. Use those values as given rather than reconstructing them — a scope that does not match the one the cursor was minted for is 409 cursor_scope_changed.
Resuming
Every SSE id you receive is a cursor. Full-snapshot data before sync intentionally has no id. After sync, keep the last id you processed and reconnect with it, either in the standard Last-Event-ID header (which SSE clients send automatically) or as ?cursor=. Last-Event-ID wins if both are present.
curl -N 'https://api-beta.betwatch.com/v2/stream?snapshot=none&sport=thoroughbred&country=au' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'Last-Event-ID: cur_2Xp5NqTbMvWd8HjRcFkLs9Kd7mQ'Keep all filters from the returned continuation, including its resolved startFrom and startTo when present; the abbreviated examples above are not a substitute for that handoff. With stream.url, reuse the returned path and query and send your last processed id in Last-Event-ID. With the Python SDK, follow(snapshot) handles the handoff and transport reconnects.
You receive everything published since that position. Replay reaches back as far as your plan’s window.
Two things end a resume, and both are told to you plainly rather than left to guess:
- A
resyncframe means your position is too old, the stream moved past what can be replayed, or a race, venue, or competitor you follow was merged with another. Bootstrap over REST again and reconnect with the new snapshot’sstream.url. A mergeresynccarries aresyncToken; pass it asresyncTokenon that snapshot and it is not charged. Every connection gets its own token. Trainer, rider, and owner merges never resync: they arrive asentrantframes. - An
errorframe ends the current stream with a public error code and the last valid cursor; it never includes an internal failure. Aftersync, reconnect from that frame id with backoff. Beforesync, discard the partial snapshot and bootstrap again. A client that reads far more slowly than the feed is published receives one too; its reconnect replays what it missed. 409cursor_expiredon connect means the same thing before the stream opens.409cursor_scope_changedmeans the cursor was minted for different filters, a different entitlement, or a different account — replay the filters you bootstrapped with.
After sync, keep state on a dropped connection and reconnect with the last cursor. Before sync, discard the partial full snapshot and restart its bootstrap.
Compression
The stream is plain text by default. Ask for compression with the compress query parameter: compress=zstd is smaller, compress=gzip works everywhere. Send a matching Accept-Encoding header as well, or a proxy along the way may decode the stream before it reaches you. The response says which one you got in Content-Encoding. Every frame is flushed through the encoder as it is written, so compression never holds a price back. It typically cuts stream bandwidth by two thirds or more, because each frame repeats the same JSON shape.
curl -N --compressed 'https://api-beta.betwatch.com/v2/stream?compress=gzip&snapshot=none&sport=thoroughbred&cursor=cur_8fKq2mXb...' \
--header 'X-API-Key: YOUR_API_KEY'Accept-Encoding alone does not compress the stream, so a client that sends it by default keeps a plain stream until it adds compress. Most HTTP clients decode gzip for you: Go’s net/http, Python’s httpx and requests, Node’s fetch, and curl --compressed. For zstd, use a client or library that decodes it. compress is not part of the cursor scope, so you can add or drop it when you reconnect. Error responses before the stream opens are never compressed, and a server that is at its compression capacity serves the stream uncompressed, so read Content-Encoding rather than assuming.
Filters
Use repeated query keys for SSE array filters: sport, country, meeting, event, venue, key (win or place), entrant, and source, up to 50 values each. For example, country=au&country=nz. startFrom and startTo each take one RFC 3339 timestamp. REST arrays use comma-separated values instead. A filter outside your entitlement is 422 invalid_filter.
Filters are part of your cursor’s identity, so choose them for the whole session. To watch a different set of races, bootstrap and connect again.
Every parameter, frame schema, and response code: /stream in the API reference →
One connection can cover many races. ?sport=thoroughbred&country=au is a normal shape; a connection per race is the pattern to avoid, and your plan’s concurrent-stream cap will tell you so with 429 stream_limit.
A client that behaves
- Snapshot with
GET /v2/events/snapshot(or/v2/events/{id}/snapshot), page to the end, then connect to itsstream.url. - Store every SSE
idyou finish applying. A full snapshot has no resumable id untilsync. - On disconnect, reconnect with that id. Back off between attempts.
- On
resync, bootstrap again (with itsresyncToken, if it has one) and connect to the newstream.url. - On
error, reconnect from its id aftersync; beforesync, discard the partial snapshot and bootstrap again. - On
409, treat it asresync. - Ignore frame names and fields you do not know.
- Do not open a connection per race.
- Do not set a read timeout below the keepalive cadence. Snapshot keepalives are SSE comments; live keepalives are
pingframes.