Client SDKs
Official STAT-API client libraries in TypeScript, Python, Go, and Java. Each one wraps the same REST surface with a typed, zero-config client: read your key from STAT_API_KEY, call client.<league>.<table>.list(…), and page through results with a built-in auto-paging iterator. Same key, same data, same metering as the REST, GraphQL, and MCP APIs.
All libraries version in lockstep (currently v0.3.1). Source lives under github.com/stat-api.
TypeScript
@stat-api/clientnpm install @stat-api/clientQuickstart
// Hello, NBA
// Generated from schema/api/examples/hello-stat-api.yml — do not edit.
import { StatApi } from '@stat-api/client'
const api = new StatApi() // reads STAT_API_KEY from the environment
// List a few teams
const teams = (await api.nba.teams.list({ limit: 3 })).teams
// Print what came back
console.log(JSON.stringify(teams, null, 2))Python
statapipip install stat-api-clientQuickstart
# Hello, NBA
# Generated from schema/api/examples/hello-stat-api.yml — do not edit.
from statapi import StatApi
import json
api = StatApi() # reads STAT_API_KEY from the environment
# List a few teams
teams = api.nba.teams.list(limit=3).rows
# Print what came back
print(json.dumps(teams, indent=2, default=str))Go
github.com/stat-api/stat-api/gogo get github.com/stat-api/stat-api/go@latestQuickstart
// Hello, NBA
// Generated from schema/api/examples/hello-stat-api.yml — do not edit.
package main
import (
"context"
"encoding/json"
"fmt"
statapi "github.com/stat-api/stat-api/go"
"log"
)
func main() {
client, err := statapi.New()
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
// List a few teams
teamsPage, err := client.NBA.Teams.List(ctx, &statapi.NBATeamsListParams{Limit: statapi.Int(3)})
if err != nil {
log.Fatal(err)
}
teams := teamsPage.Rows
// Print what came back
teamsJSON, err := json.MarshalIndent(teams, "", " ")
if err != nil {
log.Fatal(err)
}
fmt.Println(string(teamsJSON))
}Java
com.statapigit clone https://github.com/stat-api/stat-apiQuickstart
// Hello, NBA
// Generated from schema/api/examples/hello-stat-api.yml — do not edit.
package com.statapi.cookbook;
import com.statapi.StatApi;
import com.statapi.nba.*;
import java.util.*;
public final class NbaHelloStatApi {
public static void main(String[] args) {
StatApi api = new StatApi(); // reads STAT_API_KEY from the environment
// List a few teams
List<NBATeam> teams = api.nba().teams().list(new NBATeamsListParams().limit(3L)).rows();
// Print what came back
System.out.println(teams);
}
}Client surface matrix
Browse 31 SIM & Optimizer cookbook recipes →| Surface | Method family | Capabilities | Reference |
|---|---|---|---|
| League Tables | <league>.<table>.{list,get,iter} | Keyset cursor paging, filter typing, auto-retry on GET | API Reference |
| NFL SIM | sim.nfl.run / nfl.weeks | Play-by-play draws, bell curves, 6 archetypes, CRN overrides | SIM Cookbook |
| NBA SIM | sim.nba.run / nba.weeks | Possession-by-possession draws, rotations, spread/total overrides | NBA SIM Docs |
| DFS Fast Optimizer (mode="optimizer") | dfs.slates.optimizerLineups* | Sub-second MILP builds (mode="optimizer"), stacks, player groups, late swap, CSV | Lineups Docs |
| DFS SIM Lineups, Scenarios & Jobs | dfs.slates.simLineups* / dfs.contests.buildLineups* / simSelectPool / simJob | Auto optimal SIM (scenarios[] & live NFL/NBA correlations), <50ms pool_id re-pick, GET /dfs/jobs/{job_id} | Contest Lineups · Jobs |
Prefer no install?
Every endpoint in the API reference shows a raw curl tab alongside the SDK calls, and the MCP server lets an agent query the whole catalog with no client at all.