Skip to main content
The sports scores stream pushes every change to a live game’s score and state, so you do not have to poll GET /sports/live-events. It carries game data only: competitors, scores, period, clock and lifecycle. To join a game to its markets and prices, match its slug against the REST endpoint. One message shape covers every sport. Head-to-head games (basketball, soccer, tennis, table tennis, esports, chess, fights) and fields of many competitors (golf, motorsport) use the same fields, so a new sport or score format arrives without a schema change.

Conventions

These rules hold for every message on the stream:
  • Lifecycle. phase is the game’s only lifecycle field. It is normalized the same way for every sport and source.
  • Order. Scores and per-competitor lists follow competitors order, home first, whatever order the source writes them in.
  • Times. Times are int64 Unix milliseconds, named *_at_ms. A value of 0 means the time is not known.
  • Vocabularies. phase, event kind, subtype, side and role take snake_case values from a documented list, and lists may grow. Read a phase you do not know as unknown, and a kind you do not know as other.
  • Attributes. Every game attributes key is listed on this page, and every event attributes key on the play-by-play page. Ignore a key you do not know. Keys are added, never renamed.
  • Versions. Fields and vocabulary values are added without notice. A breaking change is announced first. schema_version and content_hash are for Kairos’s own services; ignore them.

Connecting

The stream runs on the market data WebSocket at wss://stream.kairos.trade, with the same binary [1-byte tag][protobuf] framing. See Market data stream for the connection, keepalive and error rules. An API key is required. Connect with the X-Client-Id, X-Api-Key and X-Api-Secret headers. Anonymous kairos.marketdata.public.v1 connections are refused with an in-band error (tag 0x17), and the socket stays open for other topics.

Subscribing

Send a SubscribeRequest (tag 0x10) with provider: "sports", topics: ["sports"], and the scope you want as contract_id: sportFamily, league and gameId take the same values as sportFamily, sport and gameId on GET /sports/live-events. The topic list is ["sports"]; add sports.events for play-by-play. A game: scope for a game the stream does not hold yet is accepted, and stays empty until the game appears. A connection can hold up to 51 scopes of any kind, all included. Subscribing again to a scope you hold sets its topics to exactly what you name, and sends a new snapshot. Unsubscribe with an UnsubscribeRequest (tag 0x11) carrying the same provider and contract_id. Its topics (field 4) drops only the topics you name, e.g. ["sports.events"]; leave it empty to drop the whole scope. Older copies of websocket_control.proto lack field 4, so download the file again if yours does. The server answers with an UnsubscribedResponse (tag 0x15), also for a scope you did not hold. After the SubscribedResponse (tag 0x14), the server sends a SportsSnapshot (tag 0x24) with every game in the scope, then a SportsGameUpdate (tag 0x23) each time one of them changes. Scopes can overlap, e.g. all and family:basketball. Each update is then delivered once per scope that covers the game. Keep one state per game for the whole connection, and drop the copies with the (lease_epoch, seq) check in Ordering and recovery.

Messages

SportsSnapshot

SportsGameUpdate

Every update carries the game’s whole state, never a partial change. REFRESH is the game re-sent unchanged by the publisher’s periodic pass. Most snapshot rows carry it, and it also arrives as a live update after a gateway restart. Handle it exactly like CHANGED.

SportsGame

Use phase for the game’s state. status and period vary by league, so show them as labels and do not parse them.

Phases

A game is in play when phase is live, break, overtime or shootout. timing.status on GET /sports/live-events has the same value.

Game attributes

attributes maps names to strings. Keys are snake_case, and a provider’s id for the game is <provider>_<thing>_id. An attribute is present only when it has a value. New attributes may be added, so ignore any attribute you do not know. For a game on /sports/live-events, events[].attributes is the same map less the linking ids txodds_fixture_id and espn_event_id, which only the stream adds. The other TxODDS and ESPN keys are only on games that source alone describes, and REST does not list those games. The stream also fills competitor abbreviation from Polymarket’s team registry or a linked TxODDS or ESPN game, and competition from a linked game; REST has neither field.

SportsCompetitor

The unit of score depends on the sport, as on the REST endpoint: points or goals in team sports, sets won in tennis, maps won in an esports series. See Reading scores by sport.

SportsScorePart

Ordering and recovery

For each game, keep the (lease_epoch, seq) of the last update you applied, and ignore an update whose pair is not greater. This also drops the copies that overlapping scopes deliver. A larger lease_epoch means a new publisher took over; accept it and every later update. Because each update is the whole game state, a missed update costs nothing once the next one arrives. A game leaves your state only on REMOVED, which is sent when:
  • it ended more than five minutes ago;
  • it has been off every source for 30 seconds (a source that fails for a few seconds removes nothing);
  • for a game only TxODDS or ESPN describes: 15 minutes after its final, when its source stops sending it, or at once when it links to a Polymarket game, which then carries its events;
  • on a family: or league: subscription, the game moved to another family or league. It is still live; an all or game: subscription keeps it. If you also hold such a scope, the CHANGED that follows the REMOVED puts the game back.
After a disconnect, reconnect, subscribe again, and replace your state with the new snapshot. A connection can end without a close frame (code 1006), for example when a network path between you and the gateway resets it; treat that like any other disconnect.

Errors

Subscribe errors arrive as ErrorResponse (tag 0x17) with action subscribe_error:sports:<scope>: An invalid scope returns an error that names the problem, e.g. sports scope must be all, family:<family>, league:<league> or game:<gameId>. On an unsubscribe, the same error comes with action unsubscribe_error:sports:<scope>. Snapshot budget. Each connection may take 16 MiB of snapshots at once, then 1 MiB per second. The size counted is the snapshot before compression. A refused subscribe changes nothing: you hold the scope as before, or not at all. A single snapshot larger than 16 MiB is still sent when the budget is full.

Errors while subscribed

The server can drop your sports scopes while you hold them. Each dropped scope gets an ErrorResponse with action sports_disabled:<scope>, and no UnsubscribedResponse: The scope is gone, with all its topics; no more updates come for it. Poll GET /sports/live-events meanwhile, then subscribe again. Until the stream is back, a new subscribe is refused with Live sports scores are switched off, or its snapshot comes with complete false. For play-by-play, see its errors.

Example

Compile sports.proto and websocket_control.proto as described in Protobuf reference.