Query the Live Tennis API from SQL - live matches, upcoming fixtures and player search as table functions
Installing and Loading
INSTALL livetennis FROM community;
LOAD livetennis;
Example
LOAD livetennis;
-- A free API key (no card) is self-serve at https://livetennisapi.com/subscribe/free
CREATE SECRET (TYPE livetennis, API_KEY 'ltk_...');
-- Matches on court right now, with the latest score
SELECT tournament, p1_name, p2_name, sets, games, points
FROM live_tennis_matches();
-- Upcoming ATP fixtures (also: wta, challenger, itf, juniors; omit for all tours)
SELECT start_time, tournament, round, player1_name, player2_name
FROM live_tennis_fixtures('atp')
WHERE start_time IS NOT NULL
ORDER BY start_time;
-- Player search
SELECT player_id, name, tour, country, ranking
FROM live_tennis_players('alcaraz');
About livetennis
This extension exposes the Live Tennis API as DuckDB
table functions: live_tennis_matches() (matches currently in play),
live_tennis_fixtures([tour]) (upcoming scheduled fixtures) and
live_tennis_players(search) (player search). Coverage spans ATP, WTA,
Challenger, ITF and junior Grand Slam draws.
An API key is required; the free tier (30 requests/minute, 100/day, no card)
covers everything the extension exposes. The key can be provided with
CREATE SECRET (TYPE livetennis, API_KEY '...'), the livetennis_api_key
setting, or the LIVE_TENNIS_API_KEY environment variable.
This extension is maintained by the Live Tennis API team.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| live_tennis_fixtures | table | NULL | NULL | |
| live_tennis_matches | table | NULL | NULL | |
| live_tennis_players | table | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases |
|---|---|---|---|---|
| livetennis_api_key | API key for the Live Tennis API (https://livetennisapi.com) | VARCHAR | GLOBAL | [] |
| livetennis_base_url | Override the Live Tennis API base URL (default https://api.livetennisapi.com/api/public/v1) | VARCHAR | GLOBAL | [] |