Guide
Replace cron scrapers with a sports API: what you stop owning
Short answer: a sports API removes the collection layer of a data pipeline: changing page formats, source outages, scheduling and season backfills. It does not remove your client code, retries, storage or checks. A full NBA season backfill took two calls and 4 credits, and one 1-credit call reports the freshness of every dataset.
This guide is for people who already run collection jobs and want an honest accounting of what they would hand off and what they would keep.
What a home-grown collection job costs over time
A first version of a collector is cheap, and that is why it gets built. A script fetches a page on a schedule, parses it and writes a table. The cost shows up later and arrives as a series of small, unplanned interruptions. Five come up again and again.
Schema drift. A field is renamed, a column moves, a value that was a number starts to arrive as a string, or a section of a page changes order. Nothing errors loudly. The parser returns nulls, a join silently drops rows, and a model trains on a feature that is now mostly empty. The cost is not the fix, which is usually small. It is the days between the change and the moment someone notices.
Retries and rate limits. Sources time out, return errors, and throttle. A job without retry logic loses a day's data when the source has a bad hour. A job with naive retry logic hammers the source, gets throttled harder and loses more. Getting this right takes a backoff policy, a cap and a way to tell a temporary error from a permanent one.
Backfills. The job you wrote collects from today onward. A model wants five seasons. Backfilling means writing a second code path that walks history, handles pagination, respects limits and produces rows identical to the live path. The two paths drift apart over time, and the rows from one stop matching the rows from the other.
Identity and joins. Players, teams and games carry different ids in different places. Every new source needs a crosswalk, and every crosswalk needs upkeep when a player moves or a team changes its name.
Monitoring. A job that runs is not a job that works. You need to know that today's table is not empty, that row counts are in the usual range and that the last update is recent. Most teams build this after the first silent failure, not before.
None of these is hard in isolation. Together they are a standing tax on whoever owns the pipeline, and the tax is paid in attention more than in hours.
What an API changes
An API moves the first, third and fourth items to someone else and gives you tools for the fifth. It leaves the second and part of the fifth with you.
| Concern | In-house collection | With a sports API |
|---|---|---|
| Format changes | You find out when a parser breaks | The provider absorbs them; the response shape is documented and changes are listed in a public changelog |
| Retries and limits | You build both ends | You build the client end; a 429 is a clear signal to back off |
| Backfill | A second code path | The same call with a season or date range, paged with next_offset |
| Identity | Your crosswalk | Ids from one endpoint are accepted by the others, such as a game id from list_games |
| Freshness checks | Custom per source | One call that reports every dataset |
| Corrections | Whatever your parser sees today | Records are overwritten when a source corrects them; no revision history |
| Your own storage and checks | Yours | Still yours |
The last two rows are the honest ones. An API does not give you history of corrections, and it does not validate your pipeline.
A backfill that is one loop
Collecting a full season of final games from scratch is a short loop that follows next_offset. This client also retries on 429 and server errors with a capped backoff, which is the minimum a production caller needs.
import json, os, time, urllib.request, urllib.error
KEY = os.environ["DUNKAPI_API_KEY"]
BASE = "https://mcp.dunkapi.com/v1/"
def call(tool, body, tries=5):
for attempt in range(tries):
req = urllib.request.Request(BASE + tool, data=json.dumps(body).encode(),
headers={"Content-Type": "application/json", "x-api-key": KEY})
try:
with urllib.request.urlopen(req, timeout=60) as r:
return r.status, json.load(r)
except urllib.error.HTTPError as e:
if e.code == 429 or e.code >= 500:
time.sleep(min(30, 2 ** attempt)); continue
return e.code, {"error": e.read().decode()[:200]}
return 599, {"error": "gave up"}
def backfill(season):
games, offset = [], 0
while offset is not None:
status, body = call("list_games", {"season": season, "status": "final", "limit": 200, "offset": offset})
assert status == 200, (status, body)
page = body.get("data", body)
games += page["games"]; offset = page.get("next_offset")
return games
EXPECTED = {"game_id", "season", "date", "starts_at", "status", "home", "away"}
def check_shape(games):
return [g.get("game_id") for g in games if not EXPECTED <= g.keys()]
games = backfill(2027)
print("final games", len(games), "rows missing fields", len(check_shape(games)))
# final games 388 rows missing fields 0The run returned 388 final NBA games from the 2026-27 season in two pages, 200 and 188, for 4 credits at 2 credits a page. The shape check is yours to keep. It is a few lines, and it is what catches the day a field disappears.
Monitoring that does not need a scraper
The freshness problem has a direct answer. get_data_status returns, for each dataset, its last update, its cadence, whether it is fresh, due or stale, and known gaps. On December 6, 2026 the NBA summary was five fresh, none due, none stale. The datasets and cadences were:
| Dataset | Status | Cadence |
|---|---|---|
| games | fresh | daily at about 10:00 UTC |
| odds | fresh | hourly for games in the next four days |
| standings | fresh | daily at about 10:00 UTC |
| player_game_stats | fresh | daily at about 10:00 UTC |
| plays | fresh | daily at about 10:00 UTC |
The odds entry also lists a known gap: no lines before 2012-13. A check for a daily job is a few lines.
def stale_datasets(league="nba"):
status, body = call("get_data_status", {"league": league})
ds = body.get("data", body)
return [d["dataset"] for d in ds["datasets"] if d.get("status") not in ("fresh", "off-season")]
print(stale_datasets()) # [] run from cron, alert when the list is not emptyEmpty answers also explain themselves. A team with nobody on the injury report returns the report's date, and a game played in the last day and a half with no lines yet says when its lines arrive, so an empty result is easier to tell apart from a broken one. Calls that return nothing are not charged. Each response carries X-Credits-Used and X-Credits-Remaining headers, so spend can be tracked in the same client.
A rollout that limits risk
Replacing a working collector is a project, and a gradual one is safer than a cutover.
- Run both side by side for two weeks. Compare row counts and key fields per day, and list the games where they disagree.
- Move the backfill first. It has no deadline and shows you the response shape.
- Move the live path next, behind the shape check and the freshness alert above.
- Keep the raw responses. Store what you receive with your own timestamp. This gives you the revision history the API does not keep.
- Retire the old jobs one at a time, not in a single weekend.
When not to do this
- You need a dataset the API does not carry. Coverage is listed per sport, and a gap there is a gap in your pipeline.
- Your volume is tiny. A single weekly pull for a hobby project may not be worth a migration.
- You must redistribute the data. The terms allow storing, modeling and backtesting, and products that show users what you derive. They do not allow selling the data on as a dataset, feed or API.
- You need history of corrections. Not available from the API. Build it by storing responses.
Limits
- No cost comparison. We did not measure the engineering hours of any specific in-house setup, and we do not give a dollar figure for one.
- One league sampled. The code and numbers here are NBA data. Other sports have their own datasets and cadences.
- Rate limits are real. Heavy loops can see 429 responses, as ours did on a first pass, so the backoff above is not optional.
- The API is not your pipeline. You still own storage, scheduling, tests and the checks that tell you something broke.
Get a free key Or download whole seasons as Parquet
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.