Quickstart
Get from zero to live data in under 5 minutes.
Prerequisites
- An API key — request one here
curl, or your language of choice (Node 18+, Python 3.9+, Go 1.21+)
Step 1 — Save your API key
Export it as an environment variable so you don't commit it to git:
export SPORTAPI_KEY="sk_test_xxxxxxxxxxxx"Never put API keys in client-side bundles or commit them to source control. Use environment variables or a secret manager.
Step 2 — Make your first request
Fetch tonight's live NBA scores:
curl "https://api.sportapi.io/v1/nba/scores/live" \
-H "Authorization: Bearer $SPORTAPI_KEY"In Node.js (with the SDK):
import { Sportapi } from '@sportapi/node';
const client = new Sportapi(process.env.SPORTAPI_KEY);
const games = await client.nba.scores.live();
console.log(games);In Python:
from sportapi import Client
client = Client(api_key=os.environ["SPORTAPI_KEY"])
games = client.nba.scores.live()
print(games)In Go:
import "github.com/sportapi/sportapi-go"
client := sportapi.NewClient(os.Getenv("SPORTAPI_KEY"))
games, err := client.NBA.Scores.Live(ctx)Step 3 — Parse the response
You'll get back JSON like this:
{
"games": [
{
"game_id": "0022500412",
"status": "in_progress",
"period": 3,
"clock": "07:42",
"home": { "team": "BOS", "score": 78 },
"away": { "team": "LAL", "score": 71 },
"last_play": "J. Tatum makes 3-pt jumper from 25 ft",
"updated_at": "2025-11-14T03:42:18Z"
}
],
"meta": { "count": 1, "request_id": "req_8f3a2b1c" }
}Every response includes a meta.request_id — include it when you contact support and we can trace the exact request in our logs.
Step 4 — Subscribe to live updates
Polling every few seconds works for many apps, but for true live UX use the WebSocket stream — same auth, lower latency, no rate-limit overhead:
const ws = client.stream();
ws.subscribe('nba.scores.live');
ws.on('update', game => {
console.log('Score update:', game);
});That's it. You're live. Sub-second latency on the real-time tier, no infrastructure on your side.
Next steps
- Browse the API reference for every endpoint
- Read authentication for production key management
- Learn rate-limit behavior and the recommended retry pattern
- Set up error handling — every error has a code and a retry hint