Skip to contents

Get the list of in-play and pre-match events for a sport.

Returns a list of events without odds. The id returned here is the event_id consumed by toa_event_odds() and toa_event_markets().

Usage quota cost: Free. This endpoint does not count against your quota.

Usage

toa_sports_events(
  sport_key,
  date_format = "iso",
  event_ids = NULL,
  commence_time_from = NULL,
  commence_time_to = NULL,
  include_rotation_numbers = FALSE
)

Arguments

sport_key

(string, required): The sport_key to look up events for. See toa_sports() for a full lookup of sport_key values.

date_format

(string, optional): Format of returned timestamps. Options are iso (default) or unix.

event_ids

(string, optional): Comma-separated list of event ids to filter the response to. Defaults to NULL (all events).

commence_time_from

(string, optional): Filter to events that commence on and after this ISO 8601 timestamp (e.g. 2023-09-09T00:00:00Z).

commence_time_to

(string, optional): Filter to events that commence on and before this ISO 8601 timestamp (e.g. 2023-09-09T00:00:00Z).

include_rotation_numbers

(logical, optional): If TRUE, include the home_rotation and away_rotation columns when available. Defaults to FALSE.

Value

A tibble with one row per event:

col_nametypesdescription
idcharacterUnique event id. Use as event_id elsewhere.
sport_keycharacterSport key, e.g. basketball_nba.
sport_titlecharacterHuman-readable sport title, e.g. NBA.
commence_timecharacterEvent start time (ISO 8601 string or unix seconds).
home_teamcharacterHome team name.
away_teamcharacterAway team name.
home_rotationintegerHome rotation number (only when include_rotation_numbers = TRUE).
away_rotationintegerAway rotation number (only when include_rotation_numbers = TRUE).

See also

toa_sports() to discover sport_key values, toa_event_odds() to pull odds for a specific event by its id, and toa_event_markets() to see available market keys per bookmaker. Part of the SportsDataverse.

Other The Odds API: Sports & Events: toa_sports(), toa_sports_participants(), toa_sports_scores()

Examples

# \donttest{
   try(toa_sports_events(sport_key = 'basketball_nba'))
#> ── Sports Events data from the-odds-api.com ────────── oddsapiR 1.0.1 ──
#> ℹ Data updated: 2026-11-09 21:57:44 UTC
#> ℹ Odds API quota: 3959429 used, 1040571 remaining (last call cost 0)
#> # A tibble: 13 × 6
#>    id            sport_key sport_title commence_time home_team away_team
#>    <chr>         <chr>     <chr>       <chr>         <chr>     <chr>    
#>  1 07361a838120… basketba… NBA         2026-11-10T0… Atlanta … Los Ange…
#>  2 1df5ff8fe9c6… basketba… NBA         2026-11-10T0… Charlott… Clevelan…
#>  3 929b863acede… basketba… NBA         2026-11-10T0… Detroit … Washingt…
#>  4 56efae2815b3… basketba… NBA         2026-11-10T0… Toronto … Memphis …
#>  5 9866fa22adc8… basketba… NBA         2026-11-10T0… Dallas M… Indiana …
#>  6 dc61de43b5db… basketba… NBA         2026-11-10T0… Houston … Denver N…
#>  7 dc4eb6ae9979… basketba… NBA         2026-11-10T0… Phoenix … San Anto…
#>  8 3619e1cf4b0a… basketba… NBA         2026-11-10T0… Golden S… New Orle…
#>  9 cfa503c66cd5… basketba… NBA         2026-11-11T0… Philadel… Boston C…
#> 10 a6555e8b7252… basketba… NBA         2026-12-25T1… New York… San Anto…
#> 11 d60e7fc0690e… basketba… NBA         2026-12-25T1… Boston C… Miami He…
#> 12 dfd908bad3a3… basketba… NBA         2026-12-25T2… Los Ange… Philadel…
#> 13 85a2379bc491… basketba… NBA         2026-12-26T0… Golden S… Denver N…
# }