thesportsdb-client
    Preparing search index...

    Class Helpers

    Common tasks in one call. Each helper uses v2 with a premium key and v1 with a free key (then the free keys' small limits apply). Any key other than the free keys that the API accepts is a paid key, so no extra call is made to find out. Events come back sorted by start time.

    Index
    • A league's current season name, e.g. "2026-2027"; null if the league is unknown.

      Parameters

      • leagueId: number

      Returns Promise<string | null>

    • Events starting on day in IANA time zone timeZone (e.g. "America/Toronto"). The API files events under their UTC date, so a local day can span two API days; this fetches each UTC day it overlaps and keeps the events that start on the local day. Free keys: at most 3 per UTC day.

      Parameters

      • day: Day
      • timeZone: string
      • options: { leagueId?: number; sport?: string } = {}

      Returns Promise<Event[]>

    • A league's teams with badges. Free keys: looks up the league name, then up to 10 teams.

      Parameters

      • leagueId: number

      Returns Promise<Team[]>

    • Games in progress. Premium: v2. Free keys: v1's undocumented feed, which needs a sport; for a league, its sport is looked up and the feed filtered. Entries can be stale: check updated.

      Parameters

      • options: { leagueId?: number; sport?: string } = {}

      Returns Promise<LiveScore[]>

    • A league's latest results. Premium: about 20. Free keys: 1.

      Parameters

      • leagueId: number

      Returns Promise<Event[]>

    • One round (matchday). Premium: filtered from the season. Free keys: eventsround.php (undocumented; the whole round). Premium keys get 404 from that endpoint, hence two routes.

      Parameters

      • leagueId: number
      • round: number
      • Optionalseason: string

      Returns Promise<Event[]>

    • Every event of a season (default: current). Premium: one call. Free keys: the first 5.

      Parameters

      • leagueId: number
      • Optionalseason: string

      Returns Promise<Event[]>

    • A team's schedule. Premium: past and future, all competitions. Free keys: next + last, home games only.

      Parameters

      • teamId: number

      Returns Promise<Event[]>

    • A country's TV listings for days days. Premium: the country's week in one call, filtered. Free keys: one call per day, which needs a sport.

      Parameters

      • country: string
      • options: { days?: number; sport?: string; start?: Day } = {}

      Returns Promise<TvListing[]>

    • Events in the next days UTC days from start (default: today, UTC). Premium: filtered from the season. Free keys: one eventsday.php call per day (3 events a day).

      Parameters

      • leagueId: number
      • days: number = 7
      • Optionalstart: Day

      Returns Promise<Event[]>