The schedule is the list of MLB games for a date. Each game has both clubs, a status, and a score when the game has one. The id you keep is gamePk. That id is what the box score and the other game routes ask for.
Omit date for the default day. Pass YYYY-MM-DD when you want a specific date. The sample below uses 2021-07-30.
👉 To access this endpoint, you must obtain an API key: https://steadyapi.com/register
Authentication
Every call uses a Bearer token from your SteadyAPI dashboard.
Documentation:
https://docs.steadyapi.com/#authenticating-requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
Where this fits
This call does not need a team id first. Teams are GET /v1/mlb/teams if you want the club list on its own. After the schedule, one game’s batting line is GET /v1/mlb/games-boxscore with gamePk. Play-by-play is GET /v1/mlb/games-playbyplay with the same gamePk. NHL scores and the NHL schedule are different paths. They do not return gamePk.
Games for a date
Endpoint: GET /v1/mlb/schedule
Documentation:
https://docs.steadyapi.com/#baseball-mlb-GETapi-v1-mlb-schedule
Parameters
date— optional date,YYYY-MM-DD
The date selects the day. It does not filter to one team. meta.totalGames is the count for that day. There is no team, league, or status parameter. Split scheduled games from finals with status.detailedState after the response.
Python
import requests
url = "https://api.steadyapi.com/v1/mlb/schedule"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.get(url, headers=headers, params={"date": "2021-07-30"})
response.raise_for_status()
payload = response.json()
print(payload.get("meta", {}).get("totalGames"))
body = payload.get("body", {})
games = [row for row in body.values() if isinstance(row, dict) and "gamePk" in row]
for game in games[:8]:
away = game["teams"]["away"]
home = game["teams"]["home"]
print(
game.get("officialDate"),
away["team"]["name"],
away.get("score"),
"at",
home["team"]["name"],
home.get("score"),
game.get("status", {}).get("detailedState"),
)
Annotated sample
{
"gamePk": 633094,
"officialDate": "2021-07-30",
"gameDate": "2021-07-30T23:05:00Z",
"status": { "abstractGameState": "Final", "detailedState": "Final" },
"teams": {
"away": { "score": 3, "isWinner": false, "team": { "name": "Chicago Cubs" } },
"home": { "score": 4, "isWinner": true, "team": { "name": "Washington Nationals" } }
}
}
Store gamePk. That is the id for a box score. officialDate is the game’s date. gameDate is the start timestamp. status.detailedState is the specific state, and status.abstractGameState is the broader one, such as Final or Preview. Read club names from teams.away.team.name and teams.home.team.name. Scores are teams.away.score and teams.home.score. isWinner is on each side. leagueRecord on each side is the club’s record, not the score of this game.
Practical use
body is an object, not a list of games. It holds the games and an events key. Iterate the values and keep the objects that contain gamePk. If you loop every value, events is in the loop and it is not a game.
meta.totalGames counts games. meta.totalEvents counts the other items. A score is missing, or null, when the game has not produced one. Use status.detailedState before you treat a score as final.
Pass gamePk to GET /v1/mlb/games-boxscore when you need hits, runs, and home runs. The schedule row does not include the batting line.
👉 Get your API key and open the schedule: https://steadyapi.com/register