Skip to main content

draftkingsapi (Python)

Python client for draftkingsapi.com: DraftKings Pick6 lines and line history, DFS salaries, contests and slates, sportsbook odds and price history, and box scores. Standard library only, no dependencies, typed.

draftkingsapi.com is an independent API. It is not affiliated with or endorsed by DraftKings. "DraftKings" is a trademark of its owner and is used here only to describe the data.

pip install draftkingsapi

No key needed

The keyless feeds are delayed and capped, cost no credits, and need no account:

from draftkingsapi import Client

dk = Client()  # reads DRAFTKINGS_API_KEY if set; keyless calls never send it

board = dk.public_board(league="nba", limit=3)
for prop in board["props"]:
    print(prop["player"], prop["stat"], prop["line"], prop["more_multiplier"])

games = dk.public_sportsbook(league="nfl", limit=2)
for game in games["games"]:
    print(game["away"], "at", game["home"], [(m["market"], m["side"], m["line"], m["american"]) for m in game["markets"]])

moves = dk.public_line_moves(market="pick6", limit=5)
costs = dk.credit_costs()            # credits per endpoint
status = dk.status()                 # measured collection status
sample = dk.demo("odds", limit=1)    # frozen sample rows, for the response shape only

Output of the first loop, run on 15 Nov 2026 (live data, so yours will differ; a prop with no current line prints None):

Giannis Antetokounmpo Points 32.5 0.8
Cade Cunningham Points 30.5 1
Bam Adebayo Points None None

With a key

Get a free key (100 credits a month, no card) at https://draftkingsapi.com/sign-up, then:

export DRAFTKINGS_API_KEY=dk_...
from draftkingsapi import Client

dk = Client(user_request="Build a prop screen from current Pick6 lines")

lines = dk.pick6_projections(sport="NBA", limit=100)
history = dk.pick6_line_history(lines["data"][0]["pickable_id"], change_type="line_move")
odds = dk.odds(sport="NFL", market="moneyline")
salaries = dk.dfs_players(sport="NFL", format="csv")      # CSV text
box = dk.stats_player_games("NBA", 2026, limit=50)
edges = dk.ev(league="nba", min_edge=2)

user_request is optional: one plain sentence about the task, sent as X-User-Request. Never put personal data in it.

Pagination

List routes return pagination.has_more with a cursor. paginate() follows it with a page budget, so a loop cannot spend your whole allowance:

for row in dk.paginate(dk.odds, sport="NBA", max_pages=5):
    ...

It follows next_cursor (sent back as cursor), next on the stats routes and next_after on the change feeds (both sent back as after).

Errors

Every non-2xx response raises a subclass of DraftKingsAPIError with the API's own message:

Status Exception What to do
400 InvalidRequestError e.error["query_help"] often has a corrected example
401 AuthenticationError missing or wrong key; raised before any request when a keyed method has no key
402 PaymentRequiredError e.error["upgrade_url"]
404 NotFoundError e.error["closest_endpoints"]
429 RateLimitError wait e.retry_after seconds; if e.error["limit"] == "month", stop retrying
503 DatasetUnavailableError dataset temporarily unavailable; not charged, retry later
from draftkingsapi import Client, RateLimitError

try:
    Client().odds(sport="NFL")
except RateLimitError as e:
    print("retry in", e.retry_after, "seconds:", e.message)

Methods

Keyless: public_board, public_sportsbook, public_line_moves, demo(dataset), credit_costs, directory, status, history_coverage.

Keyed: coverage, events, odds, history, pick6_projections, pick6_history, pick6_line_history, projections, changes, dfs_sports, dfs_contests, dfs_slates, dfs_players, dfs_changes, compare, compare_books, ev, arbitrage, stats_games, stats_player_games, stats_team_games, context_games, context_player_stats, context_team_stats, sportsbook_scopes, sportsbook_snapshot, stream_snapshot.

Optional filters are keyword arguments, passed through unchanged. Every route's parameters are in the OpenAPI document and the docs. Not wrapped: the server-sent event stream, the native sportsbook WebSocket, and account, billing and sign-up routes.

Plans

Free 100 credits a month, Developer $49, Production $149, Scale $499 a month. Credits per endpoint: Client().credit_costs() or https://draftkingsapi.com/api/v1/credit-costs.

Tests

python -m unittest discover -s tests            # mocked, no network
DRAFTKINGS_LIVE=1 python -m unittest tests.test_live -v   # live keyless endpoints, no key, no credits

MIT License.

Metadata

Release files for draftkingsapi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for draftkingsapi 0.1.0
File Size Uploaded Provenance Actions
draftkingsapi-0.1.0.tar.gz 14.0 kB With provenance Details for draftkingsapi-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for draftkingsapi 0.1.0
File Interpreter ABI Platform Actions
draftkingsapi-0.1.0-py3-none-any.whl Python 3 none any Details for draftkingsapi-0.1.0-py3-none-any.whl

Total release size: 25.1 kB

Release files / draftkingsapi-0.1.0.tar.gz

Download URL draftkingsapi-0.1.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
912ef87e798689d45e02b754aa7f219a4a8e7f29c01faa85c1c4918143912b0e
BLAKE2b-256 checksum
How to use checksums
06de2325e70c3af6d9ba6e472ae264b0015c8e9313e3603e4c14132a1cd12e5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / draftkingsapi-0.1.0-py3-none-any.whl

Download URL draftkingsapi-0.1.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca90215057497e089d13edb529886972bde53787b3764da05e8d827c2fcf12d9
BLAKE2b-256 checksum
How to use checksums
686e4571f8d440f60dc7b800c3c7836e15779eecc06f6b735075be807f8f2ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for draftkingsapi 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for draftkingsapi-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page