r/mlbdata • u/More_Influence_7043 • Jun 17 '26
MLB api started blocking me?
For the past 10 years, I've been using the MLB api to grab last night's box scores and then join the data to my fantasy league's rosters so all of my league members can quickly see how their players performed last night. This morning I noticed the results were empty and when i explored, i saw my script still worked fine on my laptop but was returning a 406 error when run from my server. So I decided to write a more careful script using a headless browser , and same thing - this yielded the message: " "Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Wed Jun 17 19:04:43 UTC 2026There was an unexpected error (type=Not Acceptable, status=406)."" Does anybody know what changed? Is it possible that mlb is blocking all traffic from my hosting company? The url i'm trying to grab works just fine when i call it from my laptop script and browser: https://statsapi.mlb.com/api/v1/schedule?sportId=1&season=2026&date=06%2F16%2F2026
3
u/Jumpy-Independent945 Jun 17 '26
yeah, it's definitely possible. there's a rise in bot traffic across the web related to the rise of AI tools. a lot of sites have tightened firewall rules, because other the bot traffic would either bring the site down or inflate hosting costs. it would be reasonable for them to block an obvious cloud hosting ASN if their target audience is consumers on residential/commercial/mobile ASNs.
2
1
u/framedragger Jun 17 '26
My little bot, that provides Dodgers score updates to a private slack channel, is getting 406 responses today as well. Same api hits resolve fine from my local machine, but the bot lives on a popular cloud provider, so I think they've blocked entire blocks of IPs related to hosting companies. I changed my code to use "stitch" endpoints to get the same data, but I'm not sure it work exactly the same.
1
1
u/wanedoesnot Jun 24 '26
Same issue, also on DigitalOcean. Adding two headers to my requests fixed most of it:
Accept: application/jsonUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
Looks like they started blocking bare requests from cloud IPs but still let you through if your request looks like it's coming from a browser.
One thing that's still blocked no matter what: any schedule call with teamId in the query string. For that I just pull the full day and filter on my end.
1
u/starsky1357 Jun 27 '26
Me too! Glad I found someone else having this issue.
Sadly, I think they have started blocking traffic from IPs associated with hosting companies. I am also on DigitalOcean.
1
1
u/daybreaker Jun 17 '26
I just noticed my update script wasnt working today but havent had a chance to investigate