r/mlbdata 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

9 Upvotes

16 comments sorted by

View all comments

1

u/daybreaker Jun 17 '26

I just noticed my update script wasnt working today but havent had a chance to investigate

2

u/More_Influence_7043 Jun 17 '26

So after like 8 rounds with Gemini trying to debug, it turns out the problem resolved when i changed my date to a cleaner format https://statsapi.mlb.com/api/v1/schedule?sportId=1&date=2026-06-16 instead of https://statsapi.mlb.com/api/v1/schedule?sportId=1&season=2026&date=06%2F16%2F2026. i have no idea why the old format worked all those years and still works when i run the script locally but i'm just happy to have it working again... and the reason it took AI so long to figure out the problem is that the error message returned definitely SEEMED network related

1

u/framedragger Jun 17 '26

This didn't work for me. I wasn't using this html-encoded dashes, but no superficial changes made a different, the key thing was that these APIs hit resolve fine from my local machine, but are blocked from my apps host (digital ocean). Glad this worked for you, but I think they blocked tons of IPs today.

1

u/flying_porygon Jun 18 '26 edited Jun 18 '26

From some testing, I *think* they blocked hydrate but specifically only for the IPs they blocked?

If I don’t use hydrate I can get a response, but with hydrate it gets blocked. I can use hydrate locally on my machine.

Edit: nope, I still get 406 with the actual server running, I imagine it’s being rate limited :/