MLB Stats API - Baseball Data
Pricing
from $0.01 / 1,000 results
MLB Stats API - Baseball Data
Comprehensive MLB baseball statistics including player stats, game logs, standings & historical data. Perfect for fantasy sports, betting & analytics.
Pricing
from $0.01 / 1,000 results
Rating
0.0
(0)
Developer

John Rippy
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
3 days ago
Last modified
Categories
Share
MLB Stats API
"Complete MLB Data in Clean JSON" by John Rippy | johnrippy.link
Simple Access to Official MLB Statistics
The MLB Stats API exists but is complex and poorly documented. Hundreds of endpoints, nested responses, and frequent changes make it frustrating to use.
What if you could get clean, simple MLB data with one API call?
The MLB Stats API actor wraps the official MLB API and returns clean, structured data:
- All 30 MLB teams with details
- Full 40-man rosters with player info
- Current division standings
- Complete game schedules
- Individual player statistics (batting & pitching)
- Box scores with play-by-play
- League leaders by category
No API key required. No authentication needed. Just simple JSON responses.
Why Use This Instead of Direct API Access
1. Clean Data Structure
Raw MLB API returns inconsistent, deeply nested JSON. We normalize everything.
Raw MLB API:
{"people": [{"id": 660271,"fullName": "Shohei Ohtani","stats": [{"type": {"displayName": "season"},"splits": [{"stat": {"homeRuns": 54}}]}]}]}
Our API:
{"player": "Shohei Ohtani","playerId": 660271,"team": "Los Angeles Dodgers","homeRuns": 54,"battingAverage": ".310"}
2. No Authentication Needed
We handle all the complexity. You just make requests.
3. Stable Endpoints
MLB changes their API frequently. We maintain compatibility.
4. Both Batting and Pitching Stats
Get comprehensive stats for any player in one call.
Available Tasks
| Task | Description | Required Params |
|---|---|---|
teams | All 30 MLB teams with basic info | None |
team_roster | Full 40-man roster with players | teamId |
team_schedule | Team's season schedule | teamId |
standings | Current division standings | None |
player_stats | Individual player statistics | playerId |
game_boxscore | Full game box score | gameId |
schedule | League schedule by date | date |
leaders | League leaders by category | leaderCategory |
Quick Start Examples
Example 1: Get Current Standings
{"task": "standings"}
Example 2: Get Team Roster
{"task": "team_roster","teamId": 119}
Example 3: Get Player Stats
{"task": "player_stats","playerId": 660271,"season": "2024"}
Example 4: Today's Schedule
{"task": "schedule","date": "2025-04-15"}
Team IDs Reference
| Team | ID | Team | ID |
|---|---|---|---|
| Arizona Diamondbacks | 109 | Milwaukee Brewers | 158 |
| Atlanta Braves | 144 | Minnesota Twins | 142 |
| Baltimore Orioles | 110 | New York Mets | 121 |
| Boston Red Sox | 111 | New York Yankees | 147 |
| Chicago Cubs | 112 | Oakland Athletics | 133 |
| Chicago White Sox | 145 | Philadelphia Phillies | 143 |
| Cincinnati Reds | 113 | Pittsburgh Pirates | 134 |
| Cleveland Guardians | 114 | San Diego Padres | 135 |
| Colorado Rockies | 115 | San Francisco Giants | 137 |
| Detroit Tigers | 116 | Seattle Mariners | 136 |
| Houston Astros | 117 | St. Louis Cardinals | 138 |
| Kansas City Royals | 118 | Tampa Bay Rays | 139 |
| Los Angeles Angels | 108 | Texas Rangers | 140 |
| Los Angeles Dodgers | 119 | Toronto Blue Jays | 141 |
| Miami Marlins | 146 | Washington Nationals | 120 |
Output Examples
Standings Response
{"task": "standings","success": true,"data": {"season": "2024","standings": [{"division": "AL East","teams": [{"rank": 1,"team": "Baltimore Orioles","teamId": 110,"wins": 91,"losses": 71,"pct": ".562","gamesBack": "-","wildCard": "-","runsScored": 765,"runsAllowed": 640,"runDifferential": 125,"streak": "W3","last10": "7-3"}]}]}}
Player Stats Response
{"task": "player_stats","success": true,"data": {"player": {"id": 660271,"name": "Shohei Ohtani","team": "Los Angeles Dodgers","position": "DH","jerseyNumber": 17,"bats": "L","throws": "R","batting": {"gamesPlayed": 159,"atBats": 636,"runs": 134,"hits": 197,"doubles": 38,"triples": 6,"homeRuns": 54,"rbi": 130,"stolenBases": 59,"battingAverage": ".310","obp": ".390","slg": ".646","ops": "1.036"}}}}
Pay-Per-Event Pricing
You only pay for what you use. No API key costs. No rate limit fees.
| Event | Description | Price |
|---|---|---|
api_request | Each task executed | $0.01 |
Cost Examples
| Usage | Monthly Cost |
|---|---|
| 100 requests | $1 |
| 1,000 requests | $10 |
| 10,000 requests | $100 |
Free tier available for testing.
Use Cases
Fantasy Baseball
- Player tracking: Monitor stats for your roster
- Injury updates: Check player status
- Waiver wire: Compare available players
- Trade analysis: Compare player statistics
Sports Analytics
- Team performance: Analyze wins, losses, run differentials
- Sabermetrics: Calculate WAR, wOBA, FIP, etc.
- Trend analysis: Track performance over time
- Predictive models: Feed data into ML models
Apps & Websites
- Live scores: Display current standings
- Schedule displays: Show upcoming games
- Stats pages: Build player stat cards
- Team pages: Roster and team info
Media & Content
- Article research: Get accurate stats for articles
- Broadcast support: Quick stats lookup
- Social content: Stats for posts and graphics
API Integration
Using the Apify API (JavaScript)
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });const run = await client.actor('localhowl/mlb-stats-api').call({task: 'player_stats',playerId: 660271});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items[0].data.player);
Using cURL
curl -X POST "https://api.apify.com/v2/acts/localhowl~mlb-stats-api/runs?token=YOUR_API_TOKEN" \-H "Content-Type: application/json" \-d '{"task": "standings"}'
Webhook Integration
Webhook Payload Format
{"event": "task_completed","timestamp": "2025-04-15T12:00:00.000Z","actor": "mlb-stats-api","task": "standings","success": true,"data": { ... }}
Automation Ideas
- Daily standings: Update your database every morning
- Game alerts: Trigger when your team plays
- Stat tracking: Log player stats to Google Sheets
- Discord bot: Post updates to your server
Limitations
- Historical data: Limited to current and recent seasons
- Real-time: Not truly live (refresh every few minutes during games)
- Rate limits: Built-in delays to respect MLB servers
- Offseason: Limited data during winter months
Support
- Email: john@johnrippy.link
- GitHub: Report issues on the repository
Built by John Rippy | johnrippy.link
Keywords
mlb api, baseball api, mlb stats, baseball statistics, mlb standings, mlb scores, baseball data, mlb player stats, fantasy baseball api, sports data api, mlb schedule, baseball scraper, mlb data feed, sports analytics, sabermetrics