API Directory › ⚽ Sports › TheSportsDB
No authHTTPSCORS

TheSportsDB API

Free sports data — teams, players, events and logos across many sports.

Category
Auth
No auth needed
HTTPS
Yes
CORS
Yes
Open TheSportsDB docs ↗

What it does

TheSportsDB is a crowd-sourced, multi-sport database API: teams, players, leagues, seasons, past and upcoming events, tables, and lots of media (badges, jerseys, stadium photos, highlight links) across football, basketball, American football, baseball, motorsport and more.

Base URL

https://www.thesportsdb.com/api/v1/json/{KEY}

Authentication

A public test key (3) is embedded in the URL path for development. A Patreon membership gives you a personal key, higher limits and access to the richer v2 API (/api/v2/json/).

Code examples

curl
curl -s "https://www.thesportsdb.com/api/v1/json/3/searchteams.php?t=Arsenal"
curl -s "https://www.thesportsdb.com/api/v1/json/3/eventsnextleague.php?id=4328"
Python
import requests

r = requests.get("https://www.thesportsdb.com/api/v1/json/3/searchteams.php",
                 params={"t": "Golden State Warriors"}, timeout=10)
t = r.json()["teams"][0]
print(t["strTeam"], t["strLeague"], t["strStadium"])

Rate limits & quotas

The free test key is rate-limited (roughly a couple of requests per second) and some endpoints (full event lists, v2 features) are Patreon-only. Endpoints return null in place of the array ({"teams": null}) when nothing matches — check for that.

Key response fields

teams[].idTeam / strTeam / strLeagueTeam identity
teams[].strBadge / strStadium / intFormedYearMedia and background
(events) events[].dateEvent / strHomeTeam / strAwayTeam / intHomeScoreFixture/result rows
(players) player[].strPlayer / strPosition / strNationalityPlayer data
(table) table[].intRank / intPoints / intGoalDifferenceLeague standings

Common errors

null instead of arrayNo match — test for data['teams'] is None before iterating.
(Patreon-only)Some endpoints return an error or empty result on the free key — check the docs’ tier labels.
429Test key rate limit — slow down or get a personal key.

When to use it (and alternatives)

The best free option when you want one API across many sports plus logos and imagery — team pages, fixture widgets, quiz apps. For deep single-sport stats use a specialist: API-Football (soccer), balldontlie (NBA), MLB Stats API.

FAQ

Is the free test key OK for a real site?

For low traffic, yes — but it is shared and rate-limited, and richer endpoints need a Patreon key. Support the project if you rely on it.

How do I find a league or team id?

Use all_leagues.php and the search* endpoints to discover ids, then switch to the lookup* / events* endpoints which take ids.

How current is the data?

It is community-maintained, so major leagues are kept fresh but niche competitions can lag. Scores for big fixtures update within minutes to hours, not real time.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

JSON Formatter

Related Sports APIs

← Back

More Sports APIs · All 196 APIs