Docs
Coverage MatrixDocumentationChange LogLog InContact Us
Docs

MLB Push Events provides detailed, real-time information on every game event.

Syntax

https://api.sportradar.com/mlb/{access_level}/stream/en/events/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
event_categoryEvent category

stolenbase, runneradvancement, hit, single, double, triple, homerun, strikeout, walk, out, double_play, triple_play, atbatover, runscored, or halfover

Example: event_category=hit
event_typeEvent type

atbat, pitch, steal, lineup, warmup, event_over

Example: event_type=atbat_id
inning_halfInning half (top or bottom)

T, B

Example: inning_half=T
inningInning expressed as an integer

Example: inning=9
matchGame id

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

inprogress, created

Example: status=inprogress
teamTeam id

Example: team=sd:team:25507be1-6a68-4267-bd82-e097d94b359b


Code Samples

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

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


Response Samples

The above commands return json like this.


Enforced Strikes

See the below samples for behavior of enforced strikes or balls due to time clock violations.

{
   "payload":{
      "game":{
         "id":"1506ae41-f6e1-4d94-bd5a-5adcf6a3a967",
         "status":"closed",
         "coverage":"full",
         "game_number":1,
         "double_header":false,
         "entry_mode":"STOMP",
         "mlb_id":"718777",
         "day_night":"D",
         "scheduled":"2023-03-30T18:20:00+00:00",
         "home_team":"55714da8-fcaf-4574-8443-59bfb511a524",
         "away_team":"dcfd5266-00ce-442c-bc09-264cd20cf455",
         "home":{
            "name":"Cubs",
            "market":"Chicago",
            "abbr":"CHC",
            "id":"55714da8-fcaf-4574-8443-59bfb511a524",
            "runs":4,
            "hits":6,
            "errors":1
         },
         "away":{
            "name":"Brewers",
            "market":"Milwaukee",
            "abbr":"MIL",
            "id":"dcfd5266-00ce-442c-bc09-264cd20cf455",
            "runs":0,
            "hits":4,
            "errors":1
         }
      },
      "event":{
         "id":"40ce37f0-24fe-4abe-8d9c-bee4b6167102",
         "type":"pitch",
         "inning":3,
         "inning_half":"T",
         "sequence_number":98,
         "sequence":1680202550928,
         "hitter_id":"42cb5171-ffa3-4600-9c41-dbc3805206ea",
         "atbat_id":"894a5399-585b-4966-93a1-8370a3c3e24f",
         "outcome_id":"bAB",
         "status":"official",
         "created_at":"2023-03-30T18:55:50+00:00",
         "updated_at":"2023-04-04T23:24:25+00:00",
         "wall_clock":{
            "start_time":"2023-03-30T18:55:38+00:00",
            "end_time":"2023-03-30T18:55:45+00:00"
         },
         "flags":{
            "is_ab_over":false,
            "is_bunt":false,
            "is_bunt_shown":false,
            "is_hit":false,
            "is_wild_pitch":false,
            "is_passed_ball":false,
            "is_double_play":false,
            "is_triple_play":false
         },
         "count":{
            "balls":2,
            "strikes":2,
            "outs":0,
            "pitch_count":3
         },
         "pitcher":{
            "id":"cc86d4d3-1618-415e-b7fc-a303f3b8dd6f",
            "pitcher_hand":"R",
            "hitter_hand":"L",
            "pitch_count":39,
            "last_name":"Stroman",
            "first_name":"Marcus",
            "preferred_name":"Marcus",
            "jersey_number":"0"
         },
         "hitter":{
            "last_name":"Yelich",
            "first_name":"Christian",
            "preferred_name":"Christian",
            "jersey_number":"22",
            "id":"42cb5171-ffa3-4600-9c41-dbc3805206ea"
         },
         "runners":[
            "\\"{
               "id":"45d9ee07-705d-4d91-8131-264ab0cc8af4",
               "starting_base":2,
               "ending_base":2,
               "outcome_id":"",
               "out":false,
               "last_name":"Turang",
               "first_name":"Brice",
               "preferred_name":"Brice",
               "jersey_number":"0"
            }
         ]
      }
   },
   "locale":"en",
   "metadata":{
      "league":"MLB",
      "match":"sd:match:1506ae41-f6e1-4d94-bd5a-5adcf6a3a967",
      "status":"closed",
      "inning":3,
      "inning_half":"T",
      "event_type":"pitch",
      "event_category":"pitch",
      "locale":"en",
      "operation":"update",
      "version":"v6.5"
   }
}{
   "payload":{
      "game":{
         "id":"db073916-8fae-4672-a160-061b2892c17c",
         "status":"inprogress",
         "coverage":"full",
         "game_number":1,
         "double_header":false,
         "entry_mode":"STOMP",
         "mlb_id":"718710",
         "day_night":"N",
         "scheduled":"2023-04-04T23:05:00+00:00",
         "home_team":"a09ec676-f887-43dc-bbb3-cf4bbaee9a18",
         "away_team":"2142e1ba-3b40-445c-b8bb-f1f8b1054220",
         "home":{
            "name":"Yankees",
            "market":"New York",
            "abbr":"NYY",
            "id":"a09ec676-f887-43dc-bbb3-cf4bbaee9a18",
            "runs":0,
            "hits":0,
            "errors":0
         },
         "away":{
            "name":"Phillies",
            "market":"Philadelphia",
            "abbr":"PHI",
            "id":"2142e1ba-3b40-445c-b8bb-f1f8b1054220",
            "runs":1,
            "hits":1,
            "errors":0
         }
      },
      "event":{
         "id":"3457862e-9483-4430-9a0e-b75e92dda03c",
         "type":"pitch",
         "inning":2,
         "inning_half":"T",
         "sequence_number":44,
         "sequence":1680650663534,
         "hitter_id":"169ed0b1-e34b-4f4b-925b-f3288f24a5e7",
         "atbat_id":"6ae2a923-ca55-464e-ad8c-3b054cb2617d",
         "outcome_id":"kKS",
         "status":"official",
         "created_at":"2023-04-04T23:24:23+00:00",
         "updated_at":"2023-04-04T23:24:36+00:00",
         "wall_clock":{
            "start_time":"2023-04-04T23:24:16+00:00",
            "end_time":"2023-04-04T23:24:30+00:00"
         },
         "flags":{
            "is_ab_over":false,
            "is_bunt":false,
            "is_bunt_shown":false,
            "is_hit":false,
            "is_wild_pitch":false,
            "is_passed_ball":false,
            "is_double_play":false,
            "is_triple_play":false
         },
         "count":{
            "balls":0,
            "strikes":2,
            "outs":0,
            "pitch_count":2
         },
         "pitcher":{
            "pitch_type":"SI",
            "pitch_speed":91.5,
            "pitch_zone":12,
            "pitch_x":17,
            "pitch_y":-204,
            "id":"f7967ff6-16ea-408f-aa90-7d4df691679f",
            "pitcher_hand":"R",
            "hitter_hand":"R",
            "pitch_count":16,
            "last_name":"Germán",
            "first_name":"Domingo",
            "preferred_name":"Domingo",
            "jersey_number":"0"
         },
         "hitter":{
            "last_name":"Castellanos",
            "first_name":"Nicholas",
            "preferred_name":"Nick",
            "jersey_number":"8",
            "id":"169ed0b1-e34b-4f4b-925b-f3288f24a5e7"
         }
      }
   },
   "locale":"en",
   "metadata":{
      "league":"MLB",
      "match":"sd:match:db073916-8fae-4672-a160-061b2892c17c",
      "status":"inprogress",
      "inning":2,
      "inning_half":"T",
      "event_type":"pitch",
      "event_category":"pitch",
      "locale":"en",
      "operation":"update",
      "version":"v6.5"
   }
}
{
   "payload":{
      "game":{
         "id":"72c21aec-5c0f-49d6-b8c5-9037ab1bd8dd",
         "status":"closed",
         "coverage":"full",
         "game_number":1,
         "double_header":false,
         "entry_mode":"STOMP",
         "mlb_id":"718717",
         "day_night":"D",
         "scheduled":"2023-04-04T20:10:00+00:00",
         "home_team":"d52d5339-cbdd-43f3-9dfa-a42fd588b9a3",
         "away_team":"25507be1-6a68-4267-bd82-e097d94b359b",
         "home":{
            "name":"Padres",
            "market":"San Diego",
            "abbr":"SD",
            "id":"d52d5339-cbdd-43f3-9dfa-a42fd588b9a3",
            "runs":6,
            "hits":10,
            "errors":1
         },
         "away":{
            "name":"Diamondbacks",
            "market":"Arizona",
            "abbr":"ARI",
            "id":"25507be1-6a68-4267-bd82-e097d94b359b",
            "runs":8,
            "hits":9,
            "errors":1
         }
      },
      "event":{
         "id":"fc41c294-4815-436d-bf6c-6f1d2a670c5a",
         "type":"pitch",
         "inning":1,
         "inning_half":"B",
         "sequence_number":38,
         "sequence":1680639905014,
         "hitter_id":"3bb4a60b-953e-4bef-8b25-c6f07d54eddf",
         "atbat_id":"1e5c5ed6-4f6a-4b7f-9892-1523b476aed8",
         "outcome_id":"kAK",
         "status":"official",
         "created_at":"2023-04-04T20:25:05+00:00",
         "updated_at":"2023-04-04T23:30:19+00:00",
         "wall_clock":{
            "start_time":"2023-04-04T20:23:46+00:00",
            "end_time":"2023-04-04T20:23:51+00:00"
         },
         "flags":{
            "is_ab_over":true,
            "is_bunt":false,
            "is_bunt_shown":false,
            "is_hit":false,
            "is_wild_pitch":false,
            "is_passed_ball":false,
            "is_double_play":false,
            "is_triple_play":false
         },
         "count":{
            "balls":3,
            "strikes":3,
            "outs":3,
            "pitch_count":5
         },
         "pitcher":{
            "id":"e488a3a6-4673-4e5d-befe-6d5ab57b0b8e",
            "pitcher_hand":"R",
            "hitter_hand":"R",
            "pitch_count":12,
            "last_name":"Gallen",
            "first_name":"Zachary",
            "preferred_name":"Zac",
            "jersey_number":"23"
         },
         "hitter":{
            "last_name":"Machado",
            "first_name":"Manuel",
            "preferred_name":"Manny",
            "jersey_number":"13",
            "id":"3bb4a60b-953e-4bef-8b25-c6f07d54eddf"
         },
         "fielders":[
            "\\"{
               "id":"c5b9d056-d030-4640-9e4a-a83599984388",
               "type":"putout",
               "sequence":1,
               "last_name":"Herrera",
               "first_name":"Jose",
               "preferred_name":"Jose",
               "jersey_number":"11"
            }
         ]
      }
   },
   "locale":"en",
   "metadata":{
      "league":"MLB",
      "match":"sd:match:72c21aec-5c0f-49d6-b8c5-9037ab1bd8dd",
      "status":"closed",
      "inning":1,
      "inning_half":"B",
      "event_type":"pitch",
      "event_category":"pitch,strikeout,out,atbatover,halfover",
      "locale":"en",
      "operation":"update",
      "version":"v6.5"
   }
}