Getting Started
There are only 2 things you need to get started - an API key and a way to make requests.
API Key
- Get an API key here. An API key is required to make requests and retrieve data from the API.
- We offer an eternally free plan. Simply select the “Amateur” plan. During checkout, it may require you to add a credit card but it will never be charged unless you later decide to upgrade.
- Your key will be sent to your email address. If you haven’t received your API key within a couple of minutes of checking out, please check your spam folder. If it isn’t there either, please reach out to support at support@sportsgameodds.com and we’ll re-generate it for you.
- Keep your API key secret. Never expose it publicly. Your API key is your password to the API.
- Include your API key in all requests. It can be added in either the
x-api-keyheader or theapiKeyquery param.
Making Requests Manually
Reference Docs Tool
You can make requests directly from our API Reference page:
- Navigate to sportsgameodds.com/docs/reference.
- Enter your API key in the Token field under API KEY (Either ApiKeyHeader or ApiKeyParam should be selected).
- Select an endpoint from the left sidebar (Events, Teams, Sports, etc.).
- Click Test Request to open the interactive request panel.
- Use the Query (or Query Parameters) section to set request parameters
- Click Send to execute the request.
- The response will be displayed in the Response section under Body.
TIP
The reference docs page can also give you additional ready-to-use code snippets in multiple languages
Postman
Postman is a popular tool for testing APIs. We provide an official collection you can import.
- Install Postman: postman.com/downloads and install it.
- Download our collection: SportsGameOdds Postman Collection
- Import the collection: In Postman, click
Import, then drag select the file you just downloaded. - Set your API key: Ensure
SportsGameOdds APIis selected → Go to theVariablestab → replaceYOUR_API_KEY_HEREwith your actual API key → clickSave. - Make a request: Expand the
Eventsfolder → clickGet Events→ Adjust parameters (ex: setoddsAvailabletotrue) → clickSend
Directly in the Browser
You can make requests directly in your browser’s address bar using the apiKey parameter to authenticate. Simply visit a URL like this:
https://api.sportsgameodds.com/v2/sports/?apiKey=YOUR_API_KEY&leagueID=NBA,NFL,MLB&oddsAvailable=true&limit=3You can add or remove query parameters to adjust the data you receive. For example to only get moneylines, add &oddIDs=points-home-game-ml-home,points-away-game-ml-awayto the end of the URL.
WARNING
API responses can be large and may slow/crash your browser tab. This method is great for quick/simple tests but not recommended for regular usage.
Making Requests In Code
With HTTP Libraries
Replace YOUR_API_KEY with your actual API key in the examples below:
// This example uses fetch() but you can use any HTTP library
fetch("https://api.sportsgameodds.com/v2/sports/", {
method: "GET",
headers: { "X-Api-Key": "YOUR_API_KEY" },
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error(error));# This example uses the requests library
import requests
headers = {
'X-Api-Key': 'YOUR_API_KEY'
}
url = 'https://api.sportsgameodds.com/v2/sports/'
response = requests.get(url, headers=headers)
print(response.json())# This example uses the net/http library
require 'net/http'
require 'json'
uri = URI('https://api.sportsgameodds.com/v2/sports/')
request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
parsed_response = JSON.parse(response.body)
puts parsed_response// This example uses cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.sportsgameodds.com/v2/sports/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Api-Key: YOUR_API_KEY']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;// This example uses HttpURLConnection
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
URL url = new URL("https://api.sportsgameodds.com/v2/sports/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("X-Api-Key", "YOUR_API_KEY");
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
conn.disconnect();
System.out.println(content.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}With Our SDK
First, install the SDK:
npm install sports-odds-api
yarn add sports-odds-api # if you're using yarn
pnpm add sports-odds-api # if you're using pnpmpip install sports-odds-apigem install sports-odds-apigo get github.com/SportsGameOdds/sports-odds-api-go// Maven (pom.xml)
<dependency>
<groupId>com.sportsgameodds.api</groupId>
<artifactId>sports-odds-api</artifactId>
<version>1.0.0</version>
</dependency>
// Gradle (build.gradle)
implementation 'com.sportsgameodds.api:sports-odds-api:1.0.0'Then, make a request. Simply replace YOUR_API_KEY with your actual API key in the examples below:
import SportsGameOdds from "sports-odds-api";
const client = new SportsGameOdds({
apiKeyHeader: "YOUR_API_KEY",
});
const sports = await client.sports.get();
console.log(sports.data); from sports_odds_api import SportsGameOdds
client = SportsGameOdds(
api_key_param='YOUR_API_KEY'
)
# Fetch sports data
sports = client.sports.get()
print(sports.data) require "sports_odds_api"
client = SportsOddsAPI::Client.new(
api_key_param: 'YOUR_API_KEY'
)
# Fetch sports data
sports = client.sports.get
puts sports.datapackage main
import (
"context"
"fmt"
sportsoddsapi "github.com/SportsGameOdds/sports-odds-api-go"
"github.com/SportsGameOdds/sports-odds-api-go/option"
)
func main() {
client := sportsoddsapi.NewClient(
option.WithAPIKeyParam("YOUR_API_KEY"),
)
// Fetch sports data
ctx := context.Background()
sports, _ := client.Sports.Get(ctx)
fmt.Println(sports.Data)
}import com.sportsgameodds.api.client.SportsGameOddsClient;
import com.sportsgameodds.api.client.okhttp.SportsGameOddsOkHttpClient;
public class Main {
public static void main(String[] args) {
SportsGameOddsClient client = SportsGameOddsOkHttpClient.builder()
.apiKeyHeader("YOUR_API_KEY")
.build();
// Fetch sports data
var sports = client.sports().get();
System.out.println(sports.items());
}
}Learn More About the SDK
Check out our SDK Guide for comprehensive documentation including pagination, error handling, filtering, and advanced features.
