TheSportsDB Multi-Sport API Wrapper
TheSportsDB Multi-Sport API Wrapper
Fetch leagues, teams, players, and match events from TheSportsDB — the free multi-sport metadata API covering soccer, basketball, baseball, American football, ice hockey, and dozens more sports worldwide.
What You Get
Each run returns one of five data types:
| Data Type | Description | Sample Fields |
|---|---|---|
leagues |
All leagues worldwide | league_id, league_name, sport |
teams |
All teams in a named league | team_id, team_name, team_stadium, team_country |
players |
Player search by name | player_id, player_name, player_position, player_nationality |
events |
Past match results for a league | event_id, event_name, home_team, away_team, home_score, away_score, season |
seasons |
Seasons available for a league | season, league_id, league_name |
All records include a record_type field, plus sport and league context where available.
Input
| Field | Required | Default | Description |
|---|---|---|---|
apiKey |
No | 3 |
TheSportsDB API key. The free key 3 works for testing (~30 req/min). Get a Patreon key at https://www.patreon.com/thesportsdb for higher limits. |
dataType |
Yes | leagues |
Which data to fetch: leagues, teams, players, events, or seasons. |
leagueName |
Conditional | — | Required when dataType is teams, events, or seasons. Example: English Premier League. |
playerSearch |
Conditional | — | Required when dataType is players. Example: Ronaldo. |
maxItems |
No | 100 |
Maximum records to return. Set to 0 for no limit. |
Examples
Fetch all leagues
{
"apiKey": "3",
"dataType": "leagues",
"maxItems": 100
}
Sample output:
{
"record_type": "league",
"league_id": "4328",
"league_name": "English Premier League",
"sport": "Soccer"
}
Fetch teams in the NBA
{
"apiKey": "3",
"dataType": "teams",
"leagueName": "NBA",
"maxItems": 30
}
Search players
{
"apiKey": "3",
"dataType": "players",
"playerSearch": "Ronaldo",
"maxItems": 10
}
Sample output:
{
"record_type": "player",
"player_id": "34145937",
"player_name": "Cristiano Ronaldo",
"player_team": "Al-Nassr",
"sport": "Soccer",
"player_nationality": "Portugal",
"player_position": "Forward"
}
Fetch past match results
{
"apiKey": "3",
"dataType": "events",
"leagueName": "English Premier League",
"maxItems": 50
}
Sample output:
{
"record_type": "event",
"event_id": "1116564",
"event_name": "Arsenal vs Chelsea",
"event_date": "2024-04-23",
"sport": "Soccer",
"league_name": "English Premier League",
"home_team": "Arsenal",
"away_team": "Chelsea",
"home_score": "5",
"away_score": "0",
"season": "2023-2024"
}
API Key
The free demo key 3 is rate-limited to approximately 30 requests per minute and is suitable for small-volume lookups. For higher throughput or access to premium V2 endpoints, obtain a Patreon key from https://www.patreon.com/thesportsdb.
Notes
- This actor uses the TheSportsDB v1 API, which is publicly available with the free key.
- All data is fetched in a single API call per run — no pagination required.
- The free key returns up to 10 results per endpoint. A Patreon key returns full datasets.
- Results are schema-normalised with consistent field names across all data types.
Output
Results are saved to the Apify dataset. Each item has a record_type field (league, team, player, event, or season) plus the relevant metadata fields. Null/missing fields are omitted from the output.