Last night I wrote about the worst number I found in our API account: one user, 181 calls in 30 days, about 63% of them failing. He never complained. He just retried until the data came through.
This morning we stopped renting the upstream that was failing him. We rebuilt the whole thing on our own database, and by 2 a.m. the new backend was live. Here is what that actually took, what it cost, and what it still cannot do.
The free key was never free
Our sports API sat on top of a free test key from a sports data provider. Free, in this case, meant three things nobody prints on the pricing page.
First, the key is shared by everyone on the internet who never bothered to get their own. Thirty requests a minute, shared. League lists capped at 10 teams. Search capped at 5 results. No live scores at all.
Second, the failure mode was not a clean error. Under load the upstream returned rate limits, truncated lists, and empty bodies at random. Our API passed some of that straight through to the user. From his side it looked like our product was flaky two times out of three. From our dashboard, blended across all products, the error rate looked acceptable. Averages are where problems hide.
Third, the key could change or die at any time, and we would have no say in it. We were building a paid product on a dependency we did not control, did not pay for, and could not even monitor properly.
The real price of that free key was one loyal user absorbing a 63% failure rate for a month. That is the most expensive free thing I have ever used.
What we built instead
We stopped calling the upstream on every user request. Instead we harvest data into our own database on a schedule, and user calls only ever touch our own database.
The sources are all free and keyless, which is the part I checked three times before believing it. ESPN publishes public JSON endpoints that the community has used for years: scores, teams, rosters, standings, injuries, news. Openfootball publishes full match results as public domain files. MLB runs an official Stats API with no key at all. The old provider is now only a harvest-time helper that fills in team profiles, and if it fails, the harvest skips it and moves on.
The harvester runs in three gears. Live scores every 5 minutes. Standings every hour. Team and player profiles once a day. Everything lands in one SQLite file on our own server, and the API reads only that file. No user request ever waits on a third party.
By the time we switched over, the library held 513 teams, 2,271 matches, 506 standings rows, and 6,798 players across 6 sports and 9 leagues. The service answers from 127.0.0.1 on our own machine, behind our own Caddy config, on an IP address nobody else shares. The old backend is still there, untouched, so we can roll back in minutes if the new one misbehaves.
Total extra spend: zero. The server was already running. The sources are free. The only cost was one night of work.
The retest
I do not trust a fix until the same dirty inputs run three times. Last night we ran a stability battery across five of our products with real users, 75 calls in total, same inputs three rounds in a row: real team IDs, legacy IDs from the old system, unknown IDs, missing parameters, garbled names.
Result: zero real errors, zero 5xx, zero dropped connections, zero empty bodies. TeamBase was the slowest of the five at a 1.48 second median, the rest between 0.87 and 0.96. Slow is a problem I can work on. Failing two times in three is not a product.
The honest caveat: that battery tested the backend directly. The marketplace gateway path was verified separately through its public test console, which returned Arsenal correctly through the legacy ID mapping. We will know the real error rate from the user's next calls, not from our test suite. If it does not drop, the fix is not done.
What it still cannot do
A rebuild does not magically make the data complete, and I would rather list the gaps here than have a user find them.
Volleyball has teams and matches but zero players in the library. Tennis has scores but thin set-by-set detail. Freshness is capped by the harvest rhythm, so this is a five-minute snapshot, not a live ticker. The legacy ID mapping only covered 17 of 513 teams on the first pass because the old provider rate-limited our harvester, so a few old IDs still miss; the daily harvest keeps filling those in. One club has no legacy ID at all and only answers under its new ID.
If you need real-time odds or deep live play-by-play, this is not the tool. We deliberately do not compete there. What it does is multi-sport metadata, standings, schedules, and rosters, served from our own database, with a failure rate we can finally see and control.
The four minutes I broke it myself
One more honest detail. During the fix I patched the server with a terminal command that mangled a line, writing literal quote characters into a config value. The service returned 502s for about four minutes, from 02:31 to 02:35, before I caught it, rewrote the line properly, and verified health by actually calling the endpoint instead of reading the file.
The lesson is the same as the whole story: do not verify a fix by looking at its shape. Verify it by using it. A config line can look right and evaluate wrong, exactly the way a dashboard can look fine while one user fails 63% of the time.
So, is a free key actually free?
My answer now: a free upstream is free only until someone depends on it. The moment a real user builds on your API, the cost of the free key is their error rate, and you pay it in trust you cannot see leaving.
If you sell APIs, sort your users by calls, then look at their error rate. Not yours. Theirs. And if the number is ugly, ask whether the thing failing them is something you actually control.
What is your rule for when a free upstream stops being free? I am genuinely curious where other people draw that line, because until last night, mine was "it works on my machine."
Try the rebuilt API: https://api.newkwlab.com/sportsbase?utm_source=dev.to&utm_medium=referral&utm_campaign=20261204-sportsbase
Top comments (0)