TheSportsDB
www.thesportsdb.com · Media
Free crowd-sourced sports database — teams, players, events, leagues, and artwork across NFL, NBA, NHL, MLB, Premier League, and 100+ other sports. Free V1 API, V2 requires $9/mo.
Authentication
Sample Requests
Search for a sports team by name.
Hover any highlighted part to learn what it does
curl -X GET "https://www.thesportsdb.com/api/v1/json/3/searchteams.php?t=Arsenal"
import requests
params = {
"t": "Arsenal"
}
response = requests.get(
"https://www.thesportsdb.com/api/v1/json/3/searchteams.php",
params=params,
)
print(response.json())const url = new URL('https://www.thesportsdb.com/api/v1/json/3/searchteams.php');
url.searchParams.set('t', 'Arsenal');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.thesportsdb.com/api/v1/json/3/searchteams.php")
q := baseURL.Query()
q.Set("t", "Arsenal")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.thesportsdb.com/api/v1/json/3/searchteams.php")
uri.query = URI.encode_www_form({
"t" => "Arsenal"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.thesportsdb.com/api/v1/json/3/searchteams.php?" . http_build_query([
"t" => "Arsenal"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Get all events for the Premier League 2023-2024 season.
Hover any highlighted part to learn what it does
curl -X GET "https://www.thesportsdb.com/api/v1/json/3/eventsseason.php?s=2023-2024&id=4328"
import requests
params = {
"s": "2023-2024",
"id": "4328"
}
response = requests.get(
"https://www.thesportsdb.com/api/v1/json/3/eventsseason.php",
params=params,
)
print(response.json())const url = new URL('https://www.thesportsdb.com/api/v1/json/3/eventsseason.php');
url.searchParams.set('s', '2023-2024');
url.searchParams.set('id', '4328');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.thesportsdb.com/api/v1/json/3/eventsseason.php")
q := baseURL.Query()
q.Set("s", "2023-2024")
q.Set("id", "4328")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.thesportsdb.com/api/v1/json/3/eventsseason.php")
uri.query = URI.encode_www_form({
"s" => "2023-2024",
"id" => "4328"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.thesportsdb.com/api/v1/json/3/eventsseason.php?" . http_build_query([
"s" => "2023-2024",
"id" => "4328"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Use "3" as your API key for the free tier
- Try GET https://www.thesportsdb.com/api/v1/json/3/searchteams.php?t=Liverpool
- Search players: /searchplayers.php?p=Messi
- League IDs: Premier League=4328, NBA=4387, NFL=4391
What can you build with TheSportsDB?
TheSportsDB is a Media API. Developers commonly use media APIs for:
- storing and delivering images, video, and audio
- building digital asset management and media libraries
- transcoding and optimising media for the web
- adding video streaming and playback to your app
- automating content tagging and metadata extraction
API Key authentication. You'll receive a key after signing up. Send it with every request — in a header or query parameter. Keep it out of client-side code and never commit it to version control. TheSportsDB is free to use up to a usage limit, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide