Docs
Coverage MatrixDocumentationChange LogLog InContact Us
Docs

Push Linescores

MLB Push Linescores provides real-time high level scoring by inning.

Syntax

https://api.sportradar.com/mlb/{access_level}/stream/en/linescore/subscribe?api_key={your_api_key}

Parameters

ParameterDescription
access_levelDefines the access level of your API key

production, trial
your_api_keyYour API key

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.

Optional query string parameters must be added after your API key with an ampersand (&). If you are filtering for more than one result, separate the results with a comma (,) and no spaces.

ParameterDescription
matchGame id

Example: match=sd:match:7779b2fe-70ad-4823-8c6d-9e2453576e2a
statusGame status

inprogress, created

Example: status=inprogress


Code Samples

require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.sportradar.com/mlb/trial/stream/en/linescore/subscribe?api_key={your_api_key}")

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)

response = http.request(request)
puts response.read_body
import requests
import json

r = requests.get("https://api.sportradar.com/mlb/trial/stream/en/linescore/subscribe",
    params = {'api_key': 'your_api_key'},
    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 GET 'api.sportradar.com/mlb/trial/stream/en/linescore/subscribe?api_key={your_api_key}'

Samples with Query String Params

require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.sportradar.com/mlb/trial/stream/en/linescore/subscribe?api_key={your_api_key}&status=inprogress&match=sd:match:7779b2fe-70ad-4823-8c6d-9e2453576e2a")

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)

response = http.request(request)
puts response.read_body
import requests
import json

r = requests.get("https://api.sportradar.com/mlb/trial/stream/en/linescore/subscribe",
    params = {'api_key': 'your_api_key', 'status': 'inprogress', 'match': 'sd:match:7779b2fe-70ad-4823-8c6d-9e2453576e2a'},
    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 GET 'api.sportradar.com/mlb/trial/stream/en/linescore/subscribe?api_key={your_api_key}&status=inprogress&match=sd:match:7779b2fe-70ad-4823-8c6d-9e2453576e2a'


Response Sample

The above commands return json like this.



Data Points

Metadata:
AttributeParent ElementTypeDescription
leaguemetadataStringAlias of a league
ex. MLB
localemetadataStringLanguage code
ex. en (English)
matchmetadataGUIDUnique ID of a game
ex. sd:match:30ad883f-aeaf-4e6b-9fd9-a1cc0b6c4679
operationmetadataStringOperation of an update
create, update, delete
statusmetadataStringThe status of a game
scheduled, inprogress, complete, closed, wdelay, fdelay, odelay, canceled, unnecessary, if-necessary, postponed, suspended, maintenance
versionmetadataStringVersion of the API
ex. v6.5
Boxscore:
AttributeParent ElementTypeDescription
abbrawayStringAbbreviation of the away team
ex. MIN (Minnesota)
errorsawayIntegerNumber of errors for the away team
hitsawayIntegerNumber of hits for the away team
idawayGUIDUnique ID of the away team
ex. 29dd9a87-5bcc-4774-80c3-7f50d985068b
idaway-probable_pitcherGUIDUnique ID of the away team's probable pitcher
ex. 515af486-d938-4cb6-90e4-943323a5737c
marketawayStringMarket name of the away team
ex. Colorado
nameawayStringTeam name of the away team
ex. Rockies
runsawayIntegerNumber of runs for the away team in the game
abbrhomeStringAbbreviation of the home team
ex. CLE (Cleveland)
errorshomeIntegerNumber of errors for the home team
hitshomeIntegerNumber of hits for the home team
idhomeGUIDUnique ID of the home team
ex. 29dd9a87-5bcc-4774-80c3-7f50d985068b
idhome-probable_pitcherGUIDUnique ID of the home team's probable pitcher
ex. 515af486-d938-4cb6-90e4-943323a5737c
markethomeStringMarket name of the home team
ex. Cleveland
namehomeStringTeam name of the home team
ex. Guardians
runshomeIntegerNumber of runs for the home team in the game
awaylinescoreIntegerNumber of runs for the away team in the game
homelinescoreIntegerNumber of runs for the home team in the game
inninglinescoreIntegerNumber of the current inning
abbrteamStringAbbreviation of a team
ex. TB (Tampa Bay)
idteamGUIDUnique ID of a team
ex. bdc11650-6f74-49c4-875e-778aeb7632d9
marketteamStringMarket name of a team
ex. Tampa Bay
nameteamStringTeam name
ex. Rays
Game:
AttributeParent ElementTypeDescription
away_teamgameGUIDUnique ID of the away team
ex. 29dd9a87-5bcc-4774-80c3-7f50d985068b
coveragegameStringCoverage level of a game
full, boxscore
double_headergameBooleanSignifies whether a game is part of a double header
day_nightgameStringSignifies a day or night game
D, N
entry_modegameStringSignifies the type of data entry
STOMP, LDE
home_teamgameGUIDUnique ID of the home team
ex. ef64da7f-cfaf-4300-87b0-9313386b977c
idgameGUIDUnique ID of the game
ex. 1b554f5e-d8b7-4268-95da-2f4191015c84
game_numbergameIntegerNumber of the game
referencegameStringUnique MLBAM ID of a game
scheduledgamedateTimeScheduled date and time of a game
ex. 2022-09-25T20:10:00+00:00
split_squadgameBooleanSignifies a Spring Training split squad game
statusgameStringThe status of a game
scheduled, inprogress, complete, closed, wdelay, fdelay, odelay, canceled, unnecessary, if-necessary, postponed, suspended, maintenance
Play-By-Play - Count:
AttributeParent ElementTypeDescription
ballsboxscoreIntegerNumber of balls in an at bat
outsboxscoreIntegerNumber of outs in an at bat
inning_halfboxscoreStringInning half of a player entering the game
T, B
inningboxscoreIntegerInning of a player entering the game
pitch_countboxscoreIntegerNumber of pitches in an at bat
strikesboxscoreIntegerNumber of strikes in an at bat
Current Baserunners:
AttributeParent ElementTypeDescription
baserunnersIntegerRunner's base at the end of a play
first_namerunnersStringFirst name of the current runner
ex. Markus
full_namerunnersStringFull name of the current runner
ex. Mookie Betts
suffixrunnersStringName suffix of the current runner
ex. Jr.
jersey_numberrunnersIntegerNumber of the current runner's jersey
last_namerunnersStringLast name of the current runner
ex. Betts
outoutcome-runnerBooleanSignifies the runner was out on a play
preferred_namerunnersStringPreferred name of the current runner
ex. Mookie
Current Hitter:
AttributeParent ElementTypeDescription
first_namehitterStringFirst name of the current hitter
ex. Markus
full_namehitterStringFull name of the current hitter
ex. Mookie Betts
suffixhitterStringName suffix of the current hitter
ex. Jr.
hitter_handhitterBooleanHandedness of a hittter
jersey_numberhitterIntegerNumber of the current hitter's jersey
last_namehitterStringLast name of the current hitter
ex. Betts
lineup_orderhitterIntegerLineup order number of the current hitter
lineup_positionhitterStringLineup position of the current hitter
preferred_namehitterStringPreferred name of the current hitter
ex. Mookie
Current Pitcher:
AttributeParent ElementTypeDescription
first_namepitcherStringFirst name of the current pitcher
ex. Clayton
full_namepitcherStringFull name of the current pitcher
ex. Clayton Kershaw
suffixpitcherStringName suffix of the current pitcher
ex. Jr.
jersey_numberpitcherIntegerNumber of the current pitcher's jersey
last_namepitcherStringLast name of the current pitcher
ex. Kershaw
pitch_countpitcherIntegerPitch count of the current pitcher
pitch_handpitcherStringPitching hand of the current pitcher
preferred_namepitcherStringPreferred name of the current pitcher
ex. Clayton