NBA Push Events retrieves detailed, real-time information on every game event.
Syntax
https://api.sportradar.com/nba/{access_level}/stream/{language_code}/events/subscribe |
Parameters
Parameter | Description |
---|---|
| Defines the access level of your API key |
| Optional code for supported languages |
Optional Query String Parameters
By default, a Push feed will provide all data available for all in progress games. If needed, you can filter the data returned by including query strings.
Each query string parameter can be added with a preceding ampersand (&
).
Parameter | Description |
---|---|
| Event category |
| Event type |
| Language returned expressed as a 2-letter code |
| Match id |
| Player id |
| Game status |
| Team id |
Code Samples
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.sportradar.com/nba/trial/stream/en/events/subscribe")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-api-key"] = "{your_api_key}" # Replace with your actual key
response = http.request(request)
puts response.read_body
import requests
import json
headers = {
'x-api-key': 'your_api_key' # Replace with your actual key
}
r = requests.get(
"https://api.sportradar.com/nba/trial/stream/en/events/subscribe",
headers=headers,
allow_redirects=False
)
redirect_url = r.headers['Location']
r = requests.get(redirect_url, stream=True, headers=headers)
for line in r.iter_lines():
# filter out keep-alive new lines
if line:
decoded_line = line.decode('utf-8')
print(json.loads(decoded_line))
curl -L -X GET 'https://api.sportradar.com/nba/trial/stream/en/events/subscribe' \
-H 'x-api-key: {your_api_key}'
Samples with Query String Params
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.sportradar.com/nba/trial/stream/en/events/subscribe?&status=inprogress&match=sd:match:76b2e680-7da7-461f-95ad-e7c34dbc4c56")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-api-key"] = "{your_api_key}" # Replace with your actual key
response = http.request(request)
puts response.read_body
import requests
import json
headers = {
'x-api-key': 'your_api_key' # Replace with your actual key
}
r = requests.get("https://api.sportradar.com/nba/trial/stream/en/events/subscribe",
params = {'status': 'inprogress', 'match': 'sd:match:76b2e680-7da7-461f-95ad-e7c34dbc4c56'},
allow_redirects=False)
redirect_url = r.headers['Location']
r = requests.get(redirect_url, stream=True)
for line in r.iter_lines():
# filter out keep-alive new lines
if line:
decoded_line = line.decode('utf-8')
print(json.loads(decoded_line))
curl -L -X GET 'api.sportradar.com/nba/trial/stream/en/events/subscribe?&status=inprogress&match=sd:match:76b2e680-7da7-461f-95ad-e7c34dbc4c56'
-H 'x-api-key: {your_api_key}'
Response Sample
The above commands return json like this.
Simulations
Check out our Simulations to replay actual games at any time, on your own schedule. Push simulations are available as well.
Data Points
Game:
Attribute | Parent Element | Type | Description |
---|---|---|---|
|
| String | Coverage level of a game |
|
| GUID | Unique ID of a game |
|
| String | League reference ID of a game |
|
| GUID | Unique Sportradar ID of a game |
|
| String | The status of a game |
|
| String | Title of a game |
|
| dateTime | Scheduled date and time of a game |
|
| String | Time zone of the away team |
|
| String | Time zone of the home team |
|
| String | Time zone of the venue |
Metadata:
Attribute | Parent Element | Type | Description |
---|---|---|---|
|
| String | Category of an event |
|
| String | Type of an event |
|
| String | Alias of a league |
|
| String | Language code |
|
| GUID | Unique ID of a game |
|
| String | Operation of an update |
|
| GUID | Unique ID(s) of players associated with an event |
|
| String | The status of a game |
|
| GUID | Unique ID(s) of team(s) associated with an event |
|
| String | Version of the API |
Play-by-Play - Attribution & Possession:
Attribution is the team associated with the play-by-play event (i.e. the statistic associated with it). Possession is the team who currently has the possession of the ball as a result of that play-by-play event.
Attribute | Parent Element | Type | Description |
---|---|---|---|
id | event - attribution | GUID | Unique ID of a team ex. 583ed0ac-fb46-11e1-82cb-f4ce4684ea4c |
market | event - attribution | String | Market name of a team ex. Sacramento |
name | event - attribution | String | Team name ex. Kings |
reference | event - attribution | String | League reference ID of a team ex. 1610612750 |
sr_id | event - attribution | GUID | Unique Sportradar ID of a team ex. sr:team:3415 |
team_basket | event - attribution | String | The basket the offensive team is shooting at in the arena. Direction is based on the TV broadcast's perspective.left , right |
id | event - possession | GUID | Unique ID of a team ex. 583ed0ac-fb46-11e1-82cb-f4ce4684ea4c |
market | event - possession | String | Market name of a team ex. Sacramento |
name | event - possession | String | Team name ex. Kings |
sr_id | event - possession | GUID | Unique Sportradar ID of a team ex. sr:team:3415 |
Play-by-Play - Home/Away Teams:
Attribute | Parent Element | Type | Description |
---|---|---|---|
bonus | game - away | Boolean | Signifies a team is in the bonus |
points | game - away | Integer | Total points for the away team |
id | game - away | GUID | Unique ID of the away team ex. 583ed0ac-fb46-11e1-82cb-f4ce4684ea4c |
market | game - away | String | Market name of the away team ex. Sacramento |
name | game - away | String | Away team name ex. Kings |
reference | game - away | String | League reference ID of the away team ex. 1610612750 |
remaining_timeouts | game - away | Integer | Remaining timeouts for the away team |
sr_id | game - away | GUID | Unique Sportradar ID of the away team ex. sr:team:3415 |
bonus | game - home | Boolean | Signifies a team is in the bonus |
points | game - home | Integer | Total points for the home team |
id | game - home | GUID | Unique ID of the home team ex. 583ed0ac-fb46-11e1-82cb-f4ce4684ea4c |
market | game - home | String | Market name of the home team ex. Sacramento |
name | game - home | String | Home team name ex. Kings |
reference | game - home | String | League reference ID of the home team ex. 1610612750 |
remaining_timeouts | game - home | Integer | Remaining timeouts for the home team |
sr_id | game - home | GUID | Unique Sportradar ID of the home team ex. sr:team:3415 |
Play-by-Play - Event:
Attribute | Parent Element | Type | Description |
---|---|---|---|
|
| String | Clock value in decimal form when the game clock is under 1:00. Otherwise it displays the same value as |
|
| String | Text description of a free throw attempt |
|
| Integer | Total points for the away team after an event |
|
| String | Clock value of an event |
|
| String | Text description of an event |
|
| String | Type of event |
|
| Integer | Total points for the home team after an event |
|
| GUID | Unique ID of an event |
|
| String | Action area of an event |
|
| Integer | X coordinate of an event. The court we use is 1128 by 600; the scale is in inches. |
|
| Integer | Y coordinate of an event. The court we use is 1128 by 600; the scale is in inches. |
|
| Integer | Sequential number of an event in a game |
|
| String | Additional descriptor of a play-by-play event type. |
|
| Boolean | Signifies a technical foul |
|
| Integer | UNIX timestamp of the wall clock value. Use this value to help sequence play-by-play events (smallest to largest sequence number). |
|
| String | Type of turnover |
|
| dateTime | Timestamp of the creation of an event |
|
| dateTime | Timestamp of the last update to an event |
|
| dateTime | Timestamp in UTC when the on-venue statistician began entry of a play-by-play event. |
Play-by-Play - Play Participants & Stats:
Attribute | Parent Element | Type | Description |
---|---|---|---|
|
| GUID | Unique ID of a team |
|
| String | Market name of a team |
|
| String | Team name |
|
| String | League reference ID of a team |
|
| GUID | Unique Sportradar ID of a team |
|
| String | Full name of a player |
|
| GUID | Unique player ID |
|
| Integer | Number of a player's jersey |
|
| String | League reference ID of a player |
|
| GUID | Unique Sportradar ID of a player |
|
| Boolean | Signifies a made basket |
|
| Integer | Number of points scored for an event |
|
| String | Rebound type |
|
| Decimal | Shot distance in feet from the basket |
|
| String | Shot type |
|
| String | Text description of a shot type |
|
| Boolean | Signifies a 3-point attempt |
|
| Boolean | Signifies a made free throw |
|
| String | Type of free throw |
Play-by-Play - On Court Participants:
Attribute | Parent Element | Type | Description |
---|---|---|---|
full_name | event - on_court - home / away - players | String | Full name of a player ex. Stephen Curry |
id | event - on_court - home / away - players | GUID | Unique player ID ex. 8ec91366-faea-4196-bbfd-b8fab7434795 |
jersey_number | event - on_court - home / away - players | Integer | Number of a player's jersey |
reference | event - on_court - home / away - players | String | League reference ID of a player ex. 1626157 |
sr_id | event - on_court - home / away - players | GUID | Unique Sportradar ID of a player ex. sr:player:608110 |
id | event - on_court - home / away | GUID | Unique ID of a team ex. 583ed0ac-fb46-11e1-82cb-f4ce4684ea4c |
market | event - on_court - home / away | String | Market name of a team ex. Sacramento |
name | event - on_court - home / away | String | Team name ex. Kings |
reference | event - on_court - home / away | String | League reference ID of a team ex. 1610612750 |
sr_id | event - on_court - home / away | GUID | Unique Sportradar ID of a team ex. sr:team:3415 |
Quarter:
Attribute | Parent Element | Type | Description |
---|---|---|---|
id | period | GUID | Unique ID of a quarter ex. fece1ac0-b703-4478-8a7c-3f27313dec97 |
number | period | Integer | Number of a quarter |
sequence | period | Integer | Sequential number of a quarter |
type | period | GUID | Type of period ex. quarter |