Skip to main content

parlay-api

Python 3.9+ SDK for ParlayAPI. The default install has no runtime dependencies and includes a one-request odds-to-CSV starter.

First response, no key

python -m pip install --upgrade parlay-api
python -m parlay_api

The second command requests the public MLB demo once and prints CSV to your terminal. It ignores any API key in your environment. Save the response or choose another supported sport:

python -m parlay_api --sport americanfootball_nfl > odds.csv
python -m parlay_api --help

The demo returns at most the first five US moneyline events, with a shared limit of 60 requests per hour per IP. Supported demo sports are baseball_mlb, basketball_nba, americanfootball_nfl, icehockey_nhl, soccer_epl and mma_mixed_martial_arts. The demo has no market, bookmaker or live filter. Availability varies by sport, event and source; a sample does not establish full coverage. An empty response produces a CSV header and a diagnostic.

CSV preserves source prices and source timestamps. Ambiguous duplicate groups and invalid outcomes are excluded with diagnostics on stderr. Missing timestamps stay empty; timestamps are not freshness guarantees. The starter makes no rankings or profit claims, and has no automatic retries, polling or key storage.

Continue with your own account

Create your own account, then set PARLAY_API_KEY in your terminal. Keep your key private. Explicitly add --full to make one account request and export it for your own analysis:

python -m parlay_api --full > my-odds.csv
python -m parlay_api --full --markets h2h,spreads,totals --no-include-live > pregame.csv

Account requests use US regions and American odds, with include_live=true explicit by default. --no-include-live requests pregame data. The same six sports are supported by the starter, and full mode accepts h2h, spreads and totals. Requested markets are not a promise that every event or book supplies them. Your account allowance applies; without --full, the command continues to use the demo even when a key is set.

Use the Odds workspace to configure a request and estimate refresh credits. Current plans, allowances and rate limits are at parlay-api.com/pricing. Choose capacity for your intended requests and refresh schedule; this starter does not start a scheduled job.

Use the Python client in your project

The library remains available for application code. Pass your key explicitly:

import os
from parlay_api import ParlayAPI

client = ParlayAPI(api_key=os.environ["PARLAY_API_KEY"])
events = client.odds("baseball_mlb", regions="us", markets="h2h")
if not events:
    print("No events returned for this request.")
else:
    for event in events:
        print(event.get("id"), event.get("home_team"), event.get("away_team"))

For existing integrations, ParlayAPI() also accepts the legacy PARLAYAPI_KEY environment variable. The command-line starter uses PARLAY_API_KEY only.

The client includes sports, odds, events, scores, historical odds, player props, futures, usage and other endpoint methods. Check current API documentation for parameters, plan requirements and coverage. If migrating from another API, verify your actual request and response handling against the migration guide; endpoint similarities do not establish identical coverage or behavior.

from parlay_api import InvalidAPIKeyError, ParlayAPIError, RateLimitedError

try:
    events = client.odds("baseball_mlb", markets="h2h")
except InvalidAPIKeyError:
    print("Check the API key for this account.")
except RateLimitedError:
    print("Rate limit reached; review the request schedule.")
except ParlayAPIError as error:
    print(type(error).__name__)

After a successful SDK request, client.last_quota contains the returned usage headers. Header fields may be None when the service does not provide them.

Optional WebSocket examples require python -m pip install 'parlay-api[ws]'. WebSocket access is Business tier and up; see the current docs before connecting.

Existing examples

The installed command and the standalone odds_workspace.py download use the same source file. With no package installation, download that file and run python3 odds_workspace.py; the same flags apply. See the source.

The repository also contains:

  • ev_scanner.py: illustrates a chosen fair-price baseline and an edge calculation. Results depend on assumptions and available inputs.
  • arb_finder.py: illustrates implied-probability and stake calculations. Quotes and execution can change; a computed opportunity does not guarantee profit.
  • websocket_stream.py: illustrates consuming a WebSocket stream with your own account.

These additional files are repository examples. Download or clone them separately; pip install parlay-api does not create an examples directory.

License and data use

The software is MIT licensed; see LICENSE. Installing or sharing this code grants no data distribution rights. API data use is governed by the applicable Terms and any written agreement. This starter is intended for personal analysis and does not offer a shared community feed. These tool defaults do not amend existing customer agreements. Each person running it should use their own account and key.

Development and support

From a checkout, run the standalone offline tests with python -m unittest discover -s examples -p 'test_odds_workspace.py'. After installing a built wheel into a clean environment, run python /absolute/path/to/tests/test_installed_package.py from outside the checkout to verify the installed entry point and replay the same fixture tests. All test requests are mocked.

Report bugs at GitHub issues or contact support.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parlay_api-0.3.3.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parlay_api-0.3.3-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file parlay_api-0.3.3.tar.gz.

File metadata

  • Download URL: parlay_api-0.3.3.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for parlay_api-0.3.3.tar.gz
Algorithm Hash digest
SHA256 36848612b2d43b308431a3d4a12647eb87bbb5580494438d6140110f0969005b
MD5 22b2e7309ab6bab704f50d1810257639
BLAKE2b-256 8d4be16f53deb67ff1062a06b5a678a6b5b721bc80d81e921f09a07b9602b0fb

See more details on using hashes here.

File details

Details for the file parlay_api-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: parlay_api-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for parlay_api-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62cdfe96c5d4e81c71328db85d0e2318602d4eaed3bcea04cb0e5e5f8731780a
MD5 a4b28c4a7a47100125987b9aba23c439
BLAKE2b-256 51a88246c56847273ede712084cbecbeed721c8236ab315122c2a8f70a9035b0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.1.0

2 files

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