Skip to content

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-key header or the apiKey query param.

Making Requests Manually

Reference Docs Tool

You can make requests directly from our API Reference page:

  1. Navigate to sportsgameodds.com/docs/reference.
  2. Enter your API key in the Token field under API KEY (Either ApiKeyHeader or ApiKeyParam should be selected).
  3. Select an endpoint from the left sidebar (Events, Teams, Sports, etc.).
  4. Click Test Request to open the interactive request panel.
  5. Use the Query (or Query Parameters) section to set request parameters
  6. Click Send to execute the request.
  7. 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.

  1. Install Postman: postman.com/downloads and install it.
  2. Download our collection: SportsGameOdds Postman Collection
  3. Import the collection: In Postman, click Import, then drag select the file you just downloaded.
  4. Set your API key: Ensure SportsGameOdds API is selected → Go to the Variables tab → replace YOUR_API_KEY_HERE with your actual API key → click Save.
  5. Make a request: Expand the Events folder → click Get Events → Adjust parameters (ex: set oddsAvailable to true) → click Send

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=3

You 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:

js
// 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));
python
# 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())
ruby
# 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
php
// 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;
java
// 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:

bash
npm install sports-odds-api
yarn add sports-odds-api # if you're using yarn
pnpm add sports-odds-api # if you're using pnpm
bash
pip install sports-odds-api
bash
gem install sports-odds-api
bash
go get github.com/SportsGameOdds/sports-odds-api-go
groovy
// 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:

js
import SportsGameOdds from "sports-odds-api";

const client = new SportsGameOdds({
  apiKeyHeader: "YOUR_API_KEY",
});

const sports = await client.sports.get(); 
console.log(sports.data); 
python
from sports_odds_api import SportsGameOdds

client = SportsGameOdds(
    api_key_param='YOUR_API_KEY'
)

# Fetch sports data
sports = client.sports.get() 
print(sports.data) 
ruby
require "sports_odds_api"

client = SportsOddsAPI::Client.new(
  api_key_param: 'YOUR_API_KEY'
)

# Fetch sports data
sports = client.sports.get
puts sports.data
go
package 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) 
}
java
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.