4.1 KiB
4.1 KiB
Documentation Index
Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt Use this file to discover all available pages before exploring further.
Message Format
Structure of sports result update messages
Once connected to the Sports WebSocket, clients receive JSON messages whenever a sports event updates. Messages are broadcast to all connected clients automatically.
sport_result Message
Emitted when:
- A match goes live
- The score changes
- The period changes (e.g., halftime, overtime)
- A match ends
- Possession changes (NFL and CFB only)
Structure
Unique identifier for the game League identifier (e.g., `"nfl"`, `"nba"`, `"cs2"`) Home team name or abbreviation Away team name or abbreviation Game status (e.g., `"InProgress"`, `"finished"`) `true` if the match is currently in progress `true` if the match has concluded Current score (format varies by sport) Current period (e.g., `"Q4"`, `"2H"`, `"2/3"`) Time elapsed in current period (e.g., `"05:09"`) Timestamp when the match ended (only present when `ended: true`) Team abbreviation with possession (NFL/CFB only) The `turn` field is only present for NFL and CFB games and indicates which team currently has the ball.Example Messages
NFL (in progress):
{
"gameId": 19439,
"leagueAbbreviation": "nfl",
"homeTeam": "LAC",
"awayTeam": "BUF",
"status": "InProgress",
"score": "3-16",
"period": "Q4",
"elapsed": "5:18",
"live": true,
"ended": false,
"turn": "lac"
}
Esports - CS2 (finished):
{
"gameId": 1317359,
"leagueAbbreviation": "cs2",
"homeTeam": "ARCRED",
"awayTeam": "The glecs",
"status": "finished",
"score": "000-000|2-0|Bo3",
"period": "2/3",
"live": false,
"ended": true
}
Slug Format
The slug field follows a consistent naming convention:
{league}-{team1}-{team2}-{date}
Examples:
nfl-buf-kc-2025-01-26— NFL: Buffalo Bills vs Kansas City Chiefsnba-lal-bos-2025-02-15— NBA: LA Lakers vs Boston Celticsmlb-nyy-bos-2025-04-01— MLB: NY Yankees vs Boston Red Sox
Period Values
| Period | Description |
|---|---|
1H |
First half |
2H |
Second half |
1Q, 2Q, 3Q, 4Q |
Quarters (NFL, NBA) |
HT |
Halftime |
FT |
Full time (match ended in regulation) |
FT OT |
Full time with overtime |
FT NR |
Full time, no result (draw or canceled) |
End 1, End 2, etc. |
End of inning (MLB) |
1/3, 2/3, 3/3 |
Map number in Bo3 series (Esports) |
1/5, 2/5, etc. |
Map number in Bo5 series (Esports) |
Handling Updates
When processing messages, use the gameId field as the unique identifier to update your local state:
// Update or insert based on gameId
setSportsData(prev => {
const existing = prev.find(item => item.gameId === data.gameId);
if (existing) {
return prev.map(item =>
item.gameId === data.gameId ? data : item
);
}
return [...prev, data];
});