parlayapiR

R client for ParlayAPI, a real-time sports odds API with 30+ sportsbook sources, player props and historical endpoints. Availability varies by sport, bookmaker, market, date and account access. The package provides HTTP clients and local calculations for devigging and Kelly sizing; those calculations depend on their inputs and do not establish a profitable betting strategy.

Browse the searchable R function reference for package arguments, return values and examples.

Built for the R modeling community: everything returns plain data frames, the math functions are pure R with no network dependency, and the sandbox provides keyless examples for current odds, scores and props. Archive requests require a key.

Start with an offline tutorial

Rebuild what was known at a decision time replays late observations and withdrawals using base R. Try six cutoffs in your browser or run the same example offline.

Choose the right fixture for a two-sided report uses two games between the same teams. Download the base-R exercise to see which away price the editor could publish at each deadline.

Prevent accidental many-to-many joins in R uses synthetic quotes to show why event, period, outcome and handicap line belong in a comparison key. Run it with base R, no packages or API key.

Featured as a Highlight in R Weekly 2026-W38. The tutorial includes a next step for checking your own books, markets and request budget before selecting a paid plan.

Plan the first private request

Use the free API workload planner to record active time, refresh interval, required endpoints and pages, separately polled sports and active days. It needs no key and makes no API request. Leave credit cost unknown until you verify the cost for your exact request shape.

For several request shapes with different or unknown unit costs, use the offline request-budget kit. It includes a CSV template, exact JSON export and a self-contained notebook for Python 3.9 or later. Unpriced work keeps the total credit estimate unknown.

Installation

Install the released source package from the ParlayAPI R repository. Base R reads the package index and uses CRAN for dependencies.

install.packages(
  "parlayapiR",
  repos = c(ParlayAPI = "https://jacobiusmakes.github.io/parlayapiR/r",
            CRAN = "https://cloud.r-project.org"),
  type = "source"
)
packageVersion("parlayapiR")

This repository supports R 4.1 or later. For development builds, use pak::pak("JacobiusMakes/parlayapiR"). The CRAN submission notes track the separate CRAN process.

Inspect a completed score

Use the documented R package for this keyless example. The sandbox returns fictional NBA events with team names, scores and a completion flag.

games <- parlayapiR::pa_scores("basketball_nba", sandbox = TRUE)
finals <- games[games$completed %in% TRUE, ]
if (nrow(finals)) finals$scores[[1]]

Quickstart, no key needed

Sandbox mode routes requests to keyless /v1/sandbox/ endpoints that serve synthetic but structurally identical data:

library(parlayapiR)

pa_sports(sandbox = TRUE)

# Short league names work too, including nba, nfl, mlb, nhl and epl.
events <- pa_odds("nba", markets = "h2h", sandbox = TRUE)
events$home_team

props <- pa_props("basketball_nba", sandbox = TRUE)
head(props[, c("bookmaker", "player_name", "market_key", "line",
               "over_price", "under_price")])

The math functions never touch the network at all:

# Remove the bookmaker margin from a -110 / -110 market
# Both sides of one fictional two-way market quoted by the same book
100 * pa_hold(c(-110, -110), odds_format = "american")
#> [1] 4.761905
pa_devig(c(-110, -110), odds_format = "american")
#>     implied fair_prob fair_decimal
#> 1 0.5238095       0.5            2
#> 2 0.5238095       0.5            2

# Three-way market, power method (shrinks long shots harder)
pa_devig(c(2.45, 3.40, 3.10), method = "power")

# Kelly stake: 55% win probability at +110, quarter Kelly, 1000 bankroll
pa_kelly(0.55, +110, odds_format = "american", fraction = 0.25,
         bankroll = 1000)

Going live

Once your sandbox request works, create a free account to get your own API key. Check the current plans and credit allowances for your workload. Set the key in your R session before making a live request.

pa_auth("your-api-key")   # or set PARLAY_API_KEY in .Renviron

events <- pa_odds("basketball_nba", markets = "h2h,spreads,totals")
props  <- pa_props("baseball_mlb", markets = "player_strikeouts")

# Closing lines, the calibration target for backtests
closes <- pa_closing_odds("basketball_nba", season = "2024")

Look up a game date

Start with the free archive lookup for your sport and source. The earliest and latest dates can have gaps between them. Choose a UTC game date inside your plan's lookback. When you are ready to spend credits, this request uses 10 for one region and one moneyline market, even if the lookup returns no events.

# Replace the example date with your chosen UTC game date.
games <- pa_historical("basketball_nba", date = "2026-11-29",
                       regions = "us", markets = "h2h")

Passing a timestamp still selects its first ten characters for the game-date lookup. For example, 2026-11-29T23:30:00-05:00 falls on November 30 UTC. Pass "2026-11-30" if that is the game date you intend. To replay the price your system saw at a particular time, retain timestamped quote arrivals as shown in the decision-time tutorial.

Functions

Function What it does
pa_sports() List available sports
pa_odds() Game odds across books, The Odds API v4 event shape
pa_props() Player props as a flat over/under quote table
pa_historical() Available archived game odds for a UTC game date
pa_closing_odds() Historical closing lines, including prop closes
pa_hold() Calculate quoted overround for one complete market
pa_devig() Remove the vig: multiplicative, additive, or power
pa_kelly() Kelly criterion stake sizing (vectorized, clamped at 0)
pa_implied_prob(), pa_american_to_decimal(), pa_decimal_to_american() Odds conversions
pa_auth(), pa_sandbox() Key management and sandbox toggle

The vignette walks through a full workflow on sandbox data:

vignette("line-shopping-and-devigging", package = "parlayapiR")

The Odds API compatibility

pa_odds() uses nested event, bookmaker, market and outcome objects and accepts familiar filters such as regions, markets and bookmakers. Check the actual returned R structures, supported parameters, event identities and odds formats when migrating an existing client. Similar JSON shapes do not guarantee unchanged parsing or equivalent coverage.

Notes for modelers

Private data use

Use your own account and API key for personal analysis or internal tools. The package's code license does not grant rights to publicly display odds, share a data feed or redistribute API data. Sandbox examples are synthetic; inspect actual coverage and source timestamps when working with your key.

License

MIT. R packages are often GPL-licensed by tradition, but MIT is fully CRAN-compatible (via the standard MIT + file LICENSE template) and matches the rest of the ParlayAPI SDK family.


Part of the ParlayAPI ecosystem: a real-time sports odds API with a free tier of 1,000 credits per month, no card required. Explore all the tools at github.com/JacobiusMakes.