
Find in-play and upcoming events for a sport through the Odds API
Source:R/toa_sports_events.R
toa_sports_events.RdGet 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_keyto look up events for. Seetoa_sports()for a full lookup ofsport_keyvalues.- date_format
(string, optional): Format of returned timestamps. Options are
iso(default) orunix.- 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 thehome_rotationandaway_rotationcolumns when available. Defaults toFALSE.
Value
A tibble with one row per event:
| col_name | types | description |
| id | character | Unique event id. Use as event_id elsewhere. |
| sport_key | character | Sport key, e.g. basketball_nba. |
| sport_title | character | Human-readable sport title, e.g. NBA. |
| commence_time | character | Event start time (ISO 8601 string or unix seconds). |
| home_team | character | Home team name. |
| away_team | character | Away team name. |
| home_rotation | integer | Home rotation number (only when include_rotation_numbers = TRUE). |
| away_rotation | integer | Away 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.0 ──
#> ℹ Data updated: 2026-08-24 08:27:41 UTC
#> ℹ Odds API quota: 10535 used, 4989465 remaining (last call cost 0)
#> # A tibble: 41 × 6
#> id sport_key sport_title commence_time home_team away_team
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 26b036ff107f… basketba… NBA 2026-10-20T1… Detroit … Boston C…
#> 2 2b042ddad3d3… basketba… NBA 2026-10-20T2… New York… Philadel…
#> 3 bccd283de569… basketba… NBA 2026-10-21T0… San Anto… Oklahoma…
#> 4 85e6e4e2404e… basketba… NBA 2026-10-21T2… Orlando … Atlanta …
#> 5 164cc0396837… basketba… NBA 2026-10-21T2… Washingt… Milwauke…
#> 6 47cc511bb5ce… basketba… NBA 2026-10-21T2… Brooklyn… Charlott…
#> 7 93cdd8e4ade5… basketba… NBA 2026-10-21T2… Miami He… Minnesot…
#> 8 fd33c09c84ab… basketba… NBA 2026-10-22T0… New Orle… Indiana …
#> 9 e6769c813dd6… basketba… NBA 2026-10-22T0… Memphis … Utah Jazz
#> 10 af2f08407539… basketba… NBA 2026-10-22T0… Houston … Dallas M…
#> # ℹ 31 more rows
# }