Unofficial Documentation for the Draft Kings API

Sean Drummy
4 min readApr 14, 2021

--

Description

This is unofficial documentation for the Draft Kings API. Draft Kings very much does NOT intend to have this API used by the public, but then again they don’t lock the API down either. If you’ve ever dealt with APIs that are only intended to be used by the company deploying them, you would know that this documentation is completely without warranty and could go out of date at any moment. Similarly, Draft Kings absolutely will not care at all if you build a big application based on their current API and then roll out a V2 the next day and deprecate V1. You have been warned. :-)

Core Data Structure

There’s a lot of information in the API documentation that is probably superfluous, so I’ll give a summary of what most people are probably reading this for: the slate for every draft group. But first, a quick note about the example URLs I’m about to use. Given how transient a lot of the data is (slates come and go quickly), many of the links are probably broken. Generally the part of the URL needing updating with fresh data is quite obvious, so they should still be helpful.

Anyway, the core data structure is as follows:

  1. Sports: Highest level entity which in turn consist of. You can get the sport in question by clicking the sport in the top nav bar. For instance, clicking LOL nets: https://www.draftkings.com/lobby#/LOL. This is useful because if you’re looking to get a JSON list of contests for a particular sport you can feed in the sport as a parameter (https://www.draftkings.com/lobby/getcontests?sport=LOL). Alternatively, you could stick to using the API by hitting https://api.draftkings.com/sites/US-DK/sports/v1/sports?format=json to return a JSON list.
  2. Games: Which are not the things you enter to win, they are basically rulesets. You can actually get the details of rulesets, or game types, from a DK API: https://api.draftkings.com/lineups/v1/gametypes/1/rules. Game rulesets are the basis for…
  3. Contests: Which are the individual things you can pay money to enter in. As was mentioned earlier, you can get all contests or contests for a specific sport using https://www.draftkings.com/lobby/getcontests?sport=LOL. This will return a ton of data but it is quite cryptically formatted. It’s easy enough to guess at the data points but if you want additional detail and fully labeled attributes, you could use this API by pulling the contest ID, for example: https://api.draftkings.com/contests/v1/contests/105313170?format=json
  4. Draft Groups: Each Contest has a Draft Group, which is basically a unique ID for that particular slate. It is the most important building block of getting to the information you want. Draft Groups house information like the teams on the slate, contest start time and most importantly…
  5. Draftables: This is probably what most of you are after. The players and salaries for a given Draft Group. You can get that paydirt by hitting this URL and of course replacing the ID at the end with whatever slate you’re after: https://api.draftkings.com/draftgroups/v1/draftgroups/46589/draftables

Example Retrieving Slates and Players

Ok now to the actual slate you’re no doubt impatiently waiting for. I’m going to use League of Legends for this example because I’m a nerd who enjoys doing data science stuff on esports. The high level code flow is:

  1. If you wanted to grab every slate as it becomes available for a specific sport you would first need the Draft Groups for the sport. Draft Groups are basically the ID for each slate, so they’re very important. Let’s say you don’t want to parse 100s of contests so you may want filter down to just a single sport. To do this you would call https://www.draftkings.com/lobby/getcontests?sport=LOL.
  2. From that you would want to get a distinct set of all the Draft Groups. These IDs have the key of [‘dg’] for “Draft Group” and they are found under [‘Contests’] which is a list of all contests. Grab all the Draft Groups IDs, filter them to a distinct set (if there are two slates, there would be two Draft Groups), and with that list of IDs you’re nearly there.
  3. Now you can loop through all the slates on deck for that particular sport using these IDs. To do this, use the Draftables API to get players, salaries, etc. which is found here: https://api.draftkings.com/draftgroups/v1/draftgroups/46589/draftables
  4. This page will have all the knowledge you would want to host a fantasy league, programmatically run a lineup optimizer, etc. etc.

Alright, how ‘bout some code? I’ll write this quick script with Node because for some reason I’m in the mood to use brackets everywhere and type “await” a lot.

That’s it! Not too much code to effortlessly get data into a script of your own for optimizing, calculating, etc. There are additional endpoints as well that may be of interest to fantasy sports junkies. For brevity, I’ll keep the granular details out of this article and instead direct you to my GitHub where the full documentation can be found.

Happy drafting!

--

--

Sean Drummy
Sean Drummy

Written by Sean Drummy

Hey, I’m Sean. I’m the Senior Director of Product at Vee24. UX Guru Wannabe, Python nerd, closet .NET Fan, Self Deprecation Aficionado

Responses (3)