OpenAPI Specification
Download and reference the AltSportsData OpenAPI 3.0 specification
OpenAPI Specification
The AltSportsData API is fully described using the OpenAPI 3.0 standard. You can use the spec to generate client libraries, import into API tools, or build automations.
Specification URLs
| Format | URL |
|---|---|
| Swagger JSON (Live) | https://api.altsportsdata.com/public/docs/swagger-json |
| Swagger UI (Interactive) | https://api.altsportsdata.com/public/docs/swagger |
| Local Copy | /openapi.json |
Quick Download
# Download the OpenAPI spec
curl -o openapi.json https://api.altsportsdata.com/public/docs/swagger-json
# Pretty-print it
cat openapi.json | python3 -m json.tool > openapi-formatted.json
# List all endpoints
cat openapi.json | python3 -c "
import json, sys
spec = json.load(sys.stdin)
for path, methods in sorted(spec['paths'].items()):
for method in methods:
print(f'{method.upper():6s} {path}')
"import requests
import json
# Download the spec
response = requests.get("https://api.altsportsdata.com/public/docs/swagger-json")
spec = response.json()
# Save locally
with open("openapi.json", "w") as f:
json.dump(spec, f, indent=2)
# List all endpoints
for path, methods in sorted(spec["paths"].items()):
for method, details in methods.items():
print(f"{method.upper():6s} {path} — {details.get('summary', '')}")
# List all schemas
schemas = spec.get("components", {}).get("schemas", {})
print(f"\n{len(schemas)} schemas available:")
for name in sorted(schemas.keys()):
print(f" - {name}")// Download and inspect the OpenAPI spec
const response = await fetch(
"https://api.altsportsdata.com/public/docs/swagger-json"
);
const spec = await response.json();
// List all endpoints
for (const [path, methods] of Object.entries(spec.paths)) {
for (const [method, details] of Object.entries(methods)) {
console.log(`${method.toUpperCase().padEnd(6)} ${path} — ${details.summary || ""}`);
}
}
// Save locally
const fs = await import("fs");
fs.writeFileSync("openapi.json", JSON.stringify(spec, null, 2));// Use with openapi-typescript to generate types
// npm install openapi-typescript
import fs from "fs";
const response = await fetch(
"https://api.altsportsdata.com/public/docs/swagger-json"
);
const spec = await response.json();
// Save the spec
fs.writeFileSync("openapi.json", JSON.stringify(spec, null, 2));
// Generate TypeScript types (CLI)
// npx openapi-typescript openapi.json -o src/api-types.ts
console.log(`Spec: ${spec.info.title} v${spec.info.version}`);
console.log(`Endpoints: ${Object.keys(spec.paths).length}`);
console.log(`Schemas: ${Object.keys(spec.components?.schemas || {}).length}`);require 'net/http'
require 'json'
uri = URI('https://api.altsportsdata.com/public/docs/swagger-json')
response = Net::HTTP.get(uri)
spec = JSON.parse(response)
# Save locally
File.write('openapi.json', JSON.pretty_generate(spec))
# List endpoints
spec['paths'].sort.each do |path, methods|
methods.each do |method, details|
puts "#{method.upcase.ljust(6)} #{path} — #{details['summary']}"
end
endpackage main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"sort"
)
func main() {
resp, _ := http.Get("https://api.altsportsdata.com/public/docs/swagger-json")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
// Save locally
os.WriteFile("openapi.json", body, 0644)
// Parse and list endpoints
var spec map[string]interface{}
json.Unmarshal(body, &spec)
paths := spec["paths"].(map[string]interface{})
keys := make([]string, 0, len(paths))
for k := range paths {
keys = append(keys, k)
}
sort.Strings(keys)
for _, path := range keys {
methods := paths[path].(map[string]interface{})
for method, details := range methods {
d := details.(map[string]interface{})
fmt.Printf("%-6s %s — %s\n", method, path, d["summary"])
}
}
}using System.Text.Json;
var client = new HttpClient();
var json = await client.GetStringAsync(
"https://api.altsportsdata.com/public/docs/swagger-json"
);
// Save locally
await File.WriteAllTextAsync("openapi.json", json);
// Parse
var spec = JsonSerializer.Deserialize<JsonElement>(json);
var paths = spec.GetProperty("paths");
Console.WriteLine("AltSportsData API Endpoints:");
foreach (var path in paths.EnumerateObject())
{
foreach (var method in path.Value.EnumerateObject())
{
var summary = method.Value.TryGetProperty("summary", out var s)
? s.GetString() : "";
Console.WriteLine($" {method.Name.ToUpper(),-6} {path.Name} — {summary}");
}
}import java.net.http.*;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import org.json.JSONObject;
public class FetchSpec {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.altsportsdata.com/public/docs/swagger-json"))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
// Save locally
Files.writeString(Path.of("openapi.json"), response.body());
// Parse and list endpoints
var spec = new JSONObject(response.body());
var paths = spec.getJSONObject("paths");
for (String path : paths.keySet()) {
var methods = paths.getJSONObject(path);
for (String method : methods.keySet()) {
var details = methods.getJSONObject(method);
System.out.printf("%-6s %s — %s%n",
method.toUpperCase(), path,
details.optString("summary", ""));
}
}
}
}Spec Overview
The AltSportsData Public API spec includes:
- 11 endpoints across Events, Futures, and Sports
- 52 response schemas with full field descriptions
- 31 supported sport types (F1, PBR, WSL, Power Slap, DGPT, and more)
- 16 odds market types (eventWinner, headToHead, podiums, exacta, etc.)
Endpoints Summary
Events
| Method | Path | Description |
|---|---|---|
GET | /api/v1/public/events | Fetch all events with filtering |
GET | /api/v1/public/events/{eventId} | Fetch single event |
GET | /api/v1/public/events/{eventId}/participants | Fetch event participants |
GET | /api/v1/public/events/{eventId}/heats/{heatId} | Get heat scores / lap times |
GET | /api/v1/public/events/{eventId}/{oddType} | Get event odds by market type |
GET | /api/v1/public/events/jaialai/{id} | Jai Alai event details |
GET | /api/v1/public/events/jaialai/{id}/odds | Jai Alai event odds |
POST | /api/v1/public/events/{eventId}/sgp | Calculate Same Game Parlay |
Futures
| Method | Path | Description |
|---|---|---|
GET | /api/v1/public/futures | Fetch all futures |
GET | /api/v1/public/futures/{sportType}/tour/{tourId}/odds/{futureType} | Get futures odds |
Sports
| Method | Path | Description |
|---|---|---|
GET | /api/v1/public/sports | Fetch all sports with supported markets |
Supported Sport Types
| Code | Sport | Code | Sport |
|---|---|---|---|
f1 | Formula 1 | pbr | PBR Bull Riding |
wsl | World Surf League | bkfc | Bare Knuckle FC |
sls | Street League Skateboarding | powerslap | Power Slap |
nrx | Nitrocross | dgpt | Disc Golf Pro Tour |
motogp | MotoGP | nhra | NHRA Drag Racing |
motocrs | Motocross | jaialai | Jai Alai |
sprmtcrs | SuperMotocross | masl | Major Arena Soccer |
mxgp | MXGP | nll | National Lacrosse League |
fdrift | Formula Drift | gsoc | Golden Curling |
motoamerica | MotoAmerica | byb | BYB Extreme Fighting |
usac | USAC Racing | hlrs | Hot Laps Racing |
worldoutlaws | World of Outlaws | xgame | X Games |
spr | Supercross | athletesunlimited | Athletes Unlimited |
cdc | CDC | lux | LUX |
raf | RAF | mltt | MLTT |
spectation | Spectation |
Odds Market Types
| Code | Description |
|---|---|
eventWinner | Outright event winner |
secondPlace | Second place finish |
podiums | Podium finish (top 3) |
raceTop5 | Top 5 finish |
raceTop10 | Top 10 finish |
raceTop3 | Top 3 finish |
headToHead | Head-to-head matchup |
heatWinner | Heat/round winner |
fastestLap | Fastest lap |
overUnder | Over/under markets |
multiOverUnder | Multi over/under |
propBets | Proposition bets |
shows | Show bets |
dreamTeam | Dream team |
eventExacta | Exacta (1st + 2nd in order) |
heatExacta | Heat exacta |
Generate Client Libraries
Use the spec to auto-generate typed clients:
# Generate TypeScript types
npx openapi-typescript https://api.altsportsdata.com/public/docs/swagger-json \
-o src/api-types.ts
# Or generate a full client with openapi-fetch
npm install openapi-fetch
npx openapi-typescript https://api.altsportsdata.com/public/docs/swagger-json \
-o src/api-types.ts# Generate Python client
pip install openapi-python-client
openapi-python-client generate \
--url https://api.altsportsdata.com/public/docs/swagger-json \
--output-path ./altsportsdata-client# Generate Go client with oapi-codegen
go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest
oapi-codegen -generate types,client \
-package altsportsdata \
https://api.altsportsdata.com/public/docs/swagger-json > client.go# Generate Java client with OpenAPI Generator
npx @openapitools/openapi-generator-cli generate \
-i https://api.altsportsdata.com/public/docs/swagger-json \
-g java \
-o ./altsportsdata-java-client \
--additional-properties=library=nativeImport Into API Tools
The spec works with all major API development tools:
- Postman: Import → Link → paste the Swagger JSON URL
- Insomnia: Design → Import → from URL
- Swagger UI: Already available at
/public/docs/swagger - Redocly:
npx @redocly/cli preview-docs openapi.json - Stoplight Studio: Import from URL
Versioning
The API uses URL-based versioning:
- Current:
/api/v1/public/... - Breaking changes will create new version paths (
/api/v2/...) - Deprecated fields are marked in the spec and via response headers before removal