The Yahoo Fantasy Baseball API

Today, I’m going to take a look at Yahoo’s Fantasy Sports API. If any of the details are unclear, just leave a comment and we’ll clear ‘em up.

The Fantasy Sports API, announced on June 2, 2010, appears to be the only published and freely available API of its kind on the web. Currently baseball and football are included in the API, with basketball and hockey coming later in the year. From here we’ll take it FAQ-style.

What is an API?
In a general sense, an API (Application Programming Interface) is a piece of software that exposes functionality for other software to leverage or integrate. More specific to the web realm, APIs allow sites and applications to retrieve and post data from external services. APIs are the glue that holds Web 2.0 together: mashup sites that incorporate a live Twitter feed or Google Map, buttons that let you “like” a blog post on Facebook, and similar things are all taking advantage of APIs.

So what does the Yahoo Fantasy Sports API do then?
In a nutshell, this API fulfills requests for information with structured data responses. So, if your app wants to know what Barry Zito did in a specific game, or the draft results of a fantasy team, it makes a call out to Yahoo’s API, and gets the requested data back in either an xml or json response. The data in either response format is the same and structured the same way, but have different uses. Xml is a markup language and superset of html, while json is an object notation designed for use with Javascript, but that can be decoded by any popular programming language. The Fantasy Sports API is primarily a read-only tool at this point, but there is an API call post transactions to a team as well.

What data is available?
I’ll admit I haven’t fully sunk my teeth into this yet, but from reading the documentation, it’s mostly metadata associated with running fantasy leagues: draft results, team rosters, ownership status, etc. Individual player stats are available, but which ones specifically isn’t included in the documentation.

Can I set it in action?
Given that the API was only released less than a month ago, there don’t seem to be many live examples yet. The only one I’ve found of a site or app using the Yahoo Fantasy Baseball API is the Pickemfirst app, which I haven’t tried since I am not participating in any fantasy leagues this year. On top of that, usage of this API is limited to non-commercial tools and applications, which may act as a deterrent to potential developers. The hobbyist community is capable of producing great things, though, so it’ll be interesting to see what emerges from the release of this API.




Print This Post



Patrick Newman is a veteran enthusiast of Japanese baseball who happens to write about it at npbtracker.com, and on Twitter @npbtracker.

27 Responses to “The Yahoo Fantasy Baseball API”

You can follow any responses to this entry through the RSS 2.0 feed.
  1. Dan in Japan says:

    Fascinating, thanks for bringing this to my attention.

    Hopefully if there are other live examples out there, commenters will link them…

    Vote -1 Vote +1

  2. Tom B says:

    The pickemfirst app looks very cool, but I can’t get it to log into Yahoo without erroring out:/

    Vote -1 Vote +1

    • jinaz says:

      I haven’t gotten past the issue with pickemfirst that I have to give it my yahoo username & password. Not quite ready for that, especially when I don’t know anything about the company or its motives…
      -j

      Vote -1 Vote +1

      • Pickemfirst says:

        The great thing about the Yahoo API is that you no longer need to share your Yahoo username and password with us.
        All you need to do is allow us to access your fantasy profile (in the same way you allow application to access your facebook profile)
        This is the beauty of OAuth.

        Some users are reporting issues with OAuth, but it works in most cases.
        Please give it a try…

        Vote -1 Vote +1

      • Adam says:

        So make a dumi-API email account ;)

        Vote -1 Vote +1

    • Peter says:

      I get the same issue, I try to authorize it to do whatever to my yahoo account and I just get a blank white page saying oauth error.

      Vote -1 Vote +1

      • The oauth error is definitely a problem on their side — oauth is the authentication protocol the yahoo api uses to validate requests coming into the service. It sounds like they either have a bug or have exceeded their usage limit.

        Vote -1 Vote +1

      • Pickemfirst says:

        yes, there is a bug on our side affecting a small percentage of Yahoo users.
        We’re working on a fix.

        Vote -1 Vote +1

    • @Pickemfirst — good deal, I was gonna drop you guys a line a little later on.

      Vote -1 Vote +1

  3. Zach V says:

    I haven’t had a chance to look into this yet, but it has me excited. Anyone know if it lets you query by actual MLB game? I.e. could I query to get the player performances of yesterdays Twins-Tigers game?

    Vote -1 Vote +1

    • I didn’t get the impression that that was possible, though I will give it a closer look. It does seem like you can get a given player’s results for a specific game though, which makes sense since this api is for fantasy sports, which as far as I can tell are geared towards aggregating individual performance. I’ve only attempted fantasy baseball once, so take that last comment with a grain of salt.

      Vote -1 Vote +1

  4. Chris B. says:

    Pickemfirst seems like a great idea, but has been an absolute train wreck for me. It’s going to take a while to pick up the pieces of my shattered Firefox browser, and I never did get the Pickem tools to work with my leagues.

    Vote -1 Vote +1

  5. This post reminds me of those couple-few times I’ve watched matches on the outer courts at the US Open. No matter how good I’ve gotten at tennis or the level of competition I’ve faced, I’m always shocked by how hard the professionals hit and the pace at which the game is played.

    Likewise, if ever I’m feeling like I’ve reached my full potential as a nerd, I can merely return to this post for a complete and thorough humbling.

    Vote -1 Vote +1

  6. Rays Fan says:

    I got Pickemfirst running with my Yahoo league, and it’s pretty cool. It took a few tries… I’m having fun lookin through the leaderboard pages on Fangraphs, I can sort by wOBA and see which leaders are taken in my league.

    One error that stood out immediately is that Ryan Braun had a green square next to his name (indicating he was available in my league) when he definitely is not available (I checked really quick when I saw that & know the owner, not letting him go).

    Vote -1 Vote +1

    • Rays Fan says:

      Same deal for Chris Young the OF with Arizona. I get a green box next to him indicating he is available when he is taken. But Chris Young the SP is available, so I’m wondering if there is a glitch there for players with the same name.

      Not sure why Ryan Braun is shown as available though, he’s been taken the whole year. When I use Pickemfirst to parse the team page that Ryan Braun is on it still shows up with a green square. Oh well. For the most part it’s a pretty cool app…

      Vote -1 Vote +1

      • Pickemfirst says:

        The reason is simple: There are 2 players called Ryan Braun and 2 players called Chris Young.
        If you click on the green icon Pickemfirst will open a disambiguation window, and you will see right away whicj one is available and which one is taken…

        a future version of Pickemfirst will be smarter and try to guess the player based on the page context…

        Vote -1 Vote +1

  7. FantasySP says:

    FantasySP is another website that utilizes the Yahoo API. Though few people have heard of it. Incredibly easy to use,and even has a mobile website. Best of all, new signups get all advertisements removed.

    FantasySP collects fantasy player news from dozens of top sources (rotoworld, fanball, fangraph, cbssports, rotowire, etc etc). This way when you Sync your fantasy league, they give you all the player news you could possibly want about your team’s players.

    Why waste time browsing the web for injury news when FantasySP already collected it for you?

    Vote -1 Vote +1

  8. JoeS says:

    Hey guys I’m running Chrome and I had the OAuth error too. I simply closed out and restarted the browser and it worked.

    One thing, I wish I didn’t have to click P1 on every site that I go on, I wish it would just automatically be on and I could click just to turn it off. Oh well, still a great tool. Thanks

    Vote -1 Vote +1

    • Pickemfirst says:

      Thanks for posting this, JoeS.
      I’m still struggling to understand these OAuth errors.
      it’s good to know that they sometimes disappear by themselves ;-)

      I thought about having Pickemfirst automatically on.
      I just need to write some code that recognizes which sports a particular web page refers to.
      Then I need to handle the (rare) case where a page refers to more than one sport.
      Nothing impossible, so this will probably come in the next version.

      Vote -1 Vote +1

  9. Jon G says:

    Pick’em First is pretty good. Just installed it a few days ago. I haven’t gotten it to work with Yahoo, but it works with my CBS league no prob. I definitely use it with this site all the time.

    Vote -1 Vote +1

    • Pickemfirst says:

      yes, Pickemfirst will also let you import leagues from ESPN, CBS, MyFantasyLeague, Rotowire…
      We provide a single access point to all your leagues, which is even more convenient if you play fantasy on multiple websites.

      to go back to the subject of this post, sites like ESPN and CBS do not provides APIs so if you play on one of their private leagues, then Pickemfirst needs to ask for your password…

      Vote -1 Vote +1

  10. eastsider says:

    This discussion seems to have turned into one about pickemfirst. I looked at their site, looks ok. You can get news about players, their availability in your leagues, and something about their recent performance. At least that is all that looks interesting to me…

    I’d like to turn the discussion over to the question of “what would you like to be able to learn with data from your league and does the yahoo API provide this.”

    I would like to see more trend information. The yahoo graph on the standings page is nice – I can see that I am in third in steals and closer to the fourth place team than second. But, am I pulling away from fourth and closer to second place? Am I starting to fall back? Maybe I should pick up a speedster, maybe I don’t need to. A nice trend graph for each stat would be nice. I made a scraper in perl to grab each day’s standings for each stat. Now I am working on making a script that would chart these using GD. The yahoo API is not going to help with the graphing, but depending on the data in the standings, it would make scraping unnecessary.

    What would help you?

    Vote -1 Vote +1

  11. Pickemfirst says:

    I’m happy to report that all the Yahoo Oauth errors are now fixed in Pickemfirst.

    Thanks to FanGraphs users for reporting them!

    Vote -1 Vote +1

  12. Friend says:

    Hi,
    I have done all of the URL integarations in my iphone app but not abke to get the URL of batting statistics of the teams that are currently playing.

    Thank u

    Vote -1 Vote +1

  13. Hi Guys,

    As a hobbyist, I created a few tools at http://www.rotocalculator.com

    Among them I have a Rotisserie Calculator for head-to-head leagues, and a week-by-week category tracker which allows you to see your stats over time and compare them to other teams and the league average. Check it out if you are interested.

    Vote -1 Vote +1

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *