DocsAPI ReferenceMCPSDKs
AltSportsData

Authentication

Learn how ALT Sports Data issues credentials and how to use them in the API, SDKs, and interactive docs.

Authentication

ALT Sports Data gives you an API credential directly. Once you have it, you can use it across the public API, official SDKs, and MCP workflows.

How access works

  1. ALT Sports Data issues your credential
  2. You use that credential in the interactive docs, the SDKs, or direct HTTP requests
  3. You can validate access immediately from the API Reference

The fastest way to confirm access is:

  1. open a route in the API Reference
  2. enter your credential
  3. send the request from the right-side testing panel
  4. confirm the response before you write code

Authentication methods

For direct HTTP requests, use the credential in a request header.

X-API-KEY header

Use this as the default pattern in your own requests:

X-API-KEY: YOUR_API_KEY

SDK usage

If you use an SDK, you pass the same credential into the client configuration and the SDK handles the rest.

import { AltSportsData } from 'altsportsdata';

const client = new AltSportsData({
  apiKey: process.env.ALTSPORTSDATA_API_KEY,
});

const sports = await client.sports.list();
console.log(sports.data);
from altsportsdata import AltSportsData

client = AltSportsData(api_key="YOUR_API_KEY")

sports = client.sports.list()
print(sports.data)
curl -X GET "https://api.altsportsdata.com/api/v1/public/sports" \
  -H "X-API-KEY: YOUR_API_KEY"
const response = await fetch("https://api.altsportsdata.com/api/v1/public/sports", {
  headers: {
    "X-API-KEY": "YOUR_API_KEY"
  }
});

const data = await response.json();
console.log(data);
require 'net/http'
require 'json'

uri = URI('https://api.altsportsdata.com/api/v1/public/sports')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-API-KEY'] = 'YOUR_API_KEY'

response = http.request(request)
puts JSON.parse(response.body)
<?php
$ch = curl_init('https://api.altsportsdata.com/api/v1/public/sports');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-KEY: YOUR_API_KEY'
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

print_r($data);
?>
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-KEY", "YOUR_API_KEY");

var response = await client.GetStringAsync("https://api.altsportsdata.com/api/v1/public/sports");
Console.WriteLine(response);
req, _ := http.NewRequest("GET", "https://api.altsportsdata.com/api/v1/public/sports", nil)
req.Header.Set("X-API-KEY", "YOUR_API_KEY")

resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()

body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
URL url = new URL("https://api.altsportsdata.com/api/v1/public/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 line;
StringBuilder response = new StringBuilder();
while ((line = in.readLine()) != null) response.append(line);
in.close();

System.out.println(response.toString());

Interactive testing

You can test the same credential inside the documentation experience:

  • open the API Reference
  • pick a route
  • use the right-side panel to send a request
  • compare the real response with the schema

Error Responses

Status CodeDescription
401 UnauthorizedMissing or invalid API key
403 ForbiddenAPI key does not have access to the requested resource
429 Too Many RequestsRate limit exceeded

Security Best Practices

  • Never expose API keys in client-side code or public repositories
  • Use environment variables to store API keys (ALTSPORTSDATA_API_KEY)
  • Rotate keys regularly for enhanced security
  • Use HTTPS only — all API requests are served over TLS (enforced)
  • Treat your credential as reusable infrastructure access for API, SDK, and MCP use

Need Help?

For API access, technical support, or partnership inquiries, contact connect@altsportsdata.com.

On this page