Dataset
MLB pitch-by-pitch data, by API
Short answer: MLB pitch-by-pitch data since 2015 is served by the get_pitches API tool: type, velocity, location, count and result for every pitch, with rows for about 98% of games in 2015 to 2017 and every game from 2018. There is no pitch file package on sale today. The free plan gives 500 credits a month.
What exists, and what does not
No SportsDataHQ data package covers MLB pitches. The data packages page sells one MLB package, MLB Odds ($299), which holds games, game odds by book and a consensus close. It has no pitch table, and no MLB History tier is on sale. For that reason this page proposes no Dataset markup, and it does not link a purchase.
What does exist is the API. FastballAPI covers MLB games since 2015 with pitch-by-pitch data, every plate appearance, box scores and our ratings. The get_pitches tool returns every pitch for a game, a player or a season. The get_plate_appearances tool returns each plate appearance with the base-out state and win probability. The get_pitch_mix tool summarizes a pitcher's arsenal.
You pay in credits, not per file: get_pitches and get_plate_appearances cost 10 credits a call and get_pitch_mix costs 5. The free plan gives 500 credits a month with no card.
Coverage
Pitch rows cover about 98% of games from 2015 to 2017 and every game from 2018. The tool's own note says pitch type and velocity are present on 96% or more of each season's pitches, and on 99.8% or more from 2020. Automatic balls and strikes, such as intentional walks and pitch-timer violations, are not pitches and are not in the table. Seasons are calendar years.
The call's note also says px and py are a pitch-location frame in pixels. It is not a feet-based strike zone. If you need the plate in feet, you cannot get that from this call. The response has no spin rate, break or release-point columns.
The free sample we looked at held three postseason games with 916 pitches, about 305 a game. At that rate a full 2,430-game season runs to roughly 740,000 pitches. That is an estimate from three games, not a count.
Schema
These are the real fields returned by get_pitches on Dec 6, 2026.
| Field | Meaning |
|---|---|
| game_id | Game key |
| at_bat_id | Plate appearance key: the game id plus a four-digit sequence |
| pitch_number | Order of the pitch inside the plate appearance |
| inning, half | Inning, and top or bottom |
| pitcher_id, batter_id | Player ids |
| balls, strikes | The count before the pitch |
| pitch_type, pitch_type_name | Code such as SI, and its name such as Sinker |
| velocity | Speed in mph |
| px, py | Location in a pixel frame |
| result | For example ball, strike-looking, strike-swinging |
| in_play | True when the ball was put in play |
The response also carries count and a next_offset so you can page through a longer request.
A real sample
The first five pitches of game 401908045 (2026 postseason, Milwaukee at Tampa Bay), from a live call on Dec 6, 2026:
| at_bat_id | pitch_number | inning | half | balls | strikes | pitch_type_name | velocity | px | py | result | in_play |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 4019080450001 | 1 | 1 | top | 0 | 0 | Sinker | 95 | 102 | 188 | strike-looking | false |
| 4019080450001 | 2 | 1 | top | 0 | 1 | Sweeper | 87 | 102 | 151 | strike-looking | false |
| 4019080450001 | 3 | 1 | top | 0 | 2 | Changeup | 90 | 137 | 227 | ball | false |
| 4019080450001 | 4 | 1 | top | 1 | 2 | Changeup | 90 | 130 | 165 | strike-swinging | false |
| 4019080450002 | 1 | 1 | top | 0 | 0 | Sweeper | 88 | 122 | 140 | ball | false |
The first at-bat lasts four pitches, ending on a swinging strike. The count columns show the count before each pitch.
Pull it with the API
Set FASTBALLAPI_API_KEY to a key from your account first.
import json
import os
import urllib.request
payload = {"game_id": "401908045", "limit": 5}
req = urllib.request.Request(
"https://mcp.fastballapi.com/v1/get_pitches",
data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json", "x-api-key": os.environ["FASTBALLAPI_API_KEY"]},
)
with urllib.request.urlopen(req, timeout=60) as resp:
print("HTTP", resp.status)
d = json.load(resp)["data"]
for p in d["pitches"]:
print(p["at_bat_id"], p["pitch_number"], p["pitch_type_name"], p["velocity"], p["result"])
print("next_offset", d["next_offset"])curl -s -X POST https://mcp.fastballapi.com/v1/get_pitches \
-H "Content-Type: application/json" -H "x-api-key: $FASTBALLAPI_API_KEY" \
-d '{"game_id": "401908045", "limit": 5}'Analyze it with DuckDB or Polars
Once you have saved a few pages of pitches as JSON lines, DuckDB reads them directly. This sketch gives the average velocity and share of swinging strikes by pitch type. It is unverified: we did not run it, and it assumes you wrote the pitches array to pitches.jsonl, one object per line.
import duckdb
duckdb.sql("""
SELECT pitch_type_name,
count(*) AS pitches,
avg(velocity) AS avg_mph,
avg(CASE WHEN result = 'strike-swinging' THEN 1 ELSE 0 END) AS swinging_strike_rate
FROM read_json_auto('pitches.jsonl')
GROUP BY pitch_type_name
ORDER BY pitches DESC
""").show()In Polars, also unverified:
import polars as pl
df = pl.read_ndjson("pitches.jsonl")
print(
df.group_by("pitch_type_name")
.agg(pl.len().alias("pitches"), pl.col("velocity").mean().alias("avg_mph"))
.sort("pitches", descending=True)
)When not to use this
- You want a downloadable archive. No pitch file is on sale. Pulling a full season by API costs credits, and a season is hundreds of thousands of pitches.
- You need spin, break, release point or exit velocity. This call returns none of them.
- You need the strike zone in feet. Location is in a pixel frame.
- You need minor-league or college pitch rows. College baseball has plate appearances from the official scorer's text, with the count and pitch sequence but no pitch rows.
- You want live data in the middle of an at-bat. Use the API's schedule and game tools and expect delays.
- You want to redistribute pitch rows as your own dataset or feed. The API terms do not allow it.
Who uses pitch data
Most users build pitch-mix and sequencing models, or compare how velocity changes across a season or a game. Others join pitches to plate appearances for run value and win probability. Teachers use a single game to show how a count evolves pitch by pitch. For one game or one pitcher, the API is the faster route. For many seasons at once, plan your credits and page through with next_offset.
Worked example: one whole game
How many pitches is a game, really? We asked for game 401908045 with limit set to 1000 and got a complete answer in one call: 367 pitches, no next_offset, spread over 92 plate appearances and 12 innings (the game went to extra innings, Tampa Bay won 4 to 3). Every one of the 367 rows had a velocity, and 64 pitches were put in play.
| pitch_type_name | pitches | average mph |
|---|---|---|
| Sinker | 121 | 95.5 |
| Changeup | 74 | 85.3 |
| Four-seam FB | 58 | 94.7 |
| Cutter | 44 | 90.9 |
| Slider | 28 | 86.7 |
| Sweeper | 23 | 84.8 |
| Curve | 18 | not computed |
Two readings follow. A long game runs well above the roughly 305 pitches a game we saw in the three-game sample, so treat 300 as a floor for estimating credits, not an average. And pitch names are not one clean list: this game has both "Four-seam FB" and "Sinker", and the tool returns "Curve" and "Knuckle Curve" as separate names. Group on pitch_type when you need a stable code.
What the columns mean in practice
ballsandstrikesare the count before the pitch, so the pitch that ends a plate appearance still shows the old count.resultmixes pitch outcomes (ball, foul-ball, strike-looking, strike-swinging) with batted-ball outcomes (ground-out, single, fly-out, line-out). Rows with a batted-ball result are the ones wherein_playis true.at_bat_idis the game id plus a four-digit sequence, so it sorts in game order.pxandpyhave no unit conversion in the response. Plot them as given and do not mix them with locations from another source.
How to plan a large pull
Treat credits as the budget. A call returns a page, so a season-long pull is many calls. Before you start, decide the unit you need. If you want one pitcher's arsenal, get_pitch_mix summarizes it for 5 credits and saves you from pulling raw rows. If you want every pitch in a set of games, list the games first with get_games (2 credits) and request pitches one game at a time, saving each page to disk as you go so a failure never costs you the whole run.
Join pitches to plate appearances on at_bat_id when you need the outcome of the at-bat, and to player ids from search_players (1 credit) when you need names. The pitch rows carry ids only. Keep your own copy of the raw pages, because stored data is yours to use for models and backtests under the API terms, though you may not redistribute it as a dataset or feed of its own.
If you would rather have files, say so on the data packages page or by email. A pitch file is not promised, and we would rather tell you that than imply it.
Next step
Test the API free and run the five-pitch call above. If you want game odds for MLB as files instead, the MLB Odds package is on the data packages page, but it holds no pitches.
Get a free key Or download whole seasons as Parquet
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.