Every time I wire a new SaaS API into my stack, I make the same wrong assumption, and it took an Airtable base to finally beat it out of me. The assumption is that the API key is the unit of permission. One key gets throttled, so add a second key and double your throughput. Three workers, three keys, three budgets — that was the whole mental model, and it is wrong in a way that is invisible right up until the moment you are on a deadline. I keep a running set of notes on this class of mistake in my self-hosting security notes, but this one deserves its own walk-through, because the fix is a small design decision and the failure is a whole morning of retry storms.
The short version: Airtable rate limits are per base, not per token. Multiple API keys hitting the same base share one budget. If you design your client around the key as the rate-limit unit, you will build something that looks parallel and behaves exactly like a single serial client — except noisier, because now several processes are competing for the same allowance and each one thinks the others are the problem.
The morning the writes stopped
My job was boring and that is what made it infuriating: push a batch of records into a base, every night, unattended. Nothing clever. A queue of rows, a loop, a write. It ran fine for weeks at low volume, which is the classic way to build false confidence — the pacing was decided by the data volume, not by me. Then the source feed grew and the batch got bigger, and the job went from finishing comfortably to crawling and then to stalling outright. Some nights it finished in the small hours. Some nights it left half the batch unwritten and exited without an error I could see from the cron mail.
My first fix was the obvious one, and it is the fix that makes everything worse: I parallelized. I split the queue across workers so the writes would go out concurrently. When that got throttled, I gave each worker its own API key, reasoning that a fresh credential would come with a fresh allowance. That is the intuition the rest of this post is about, and it is precisely backwards.
What I assumed about keys
Here is the mental model I was running, stated plainly so you can check whether you are running it too. A credential is a principal. Rate limits exist to stop one principal from monopolizing a service. Therefore, N credentials equal N allowances, and splitting work across credentials is a legitimate scaling strategy — the same move as giving each team its own service account so one team’s batch job cannot starve another’s.
That reasoning is not stupid. It is correct for a lot of APIs, because a lot of APIs really do meter per key or per account. The mistake is not the reasoning; the mistake is assuming it without reading the sentence in the documentation that says what the limit attaches to. I had read the rate-limit page. I had read the number. What I had not read carefully was the noun. The number was attached to the base, and I had silently substituted “key” for “base” because key was the thing I was holding in my hand.
And it gets worse than flat throughput. With several workers each holding a key and each believing it had a private budget, they were not politely sharing anything — they were racing. Worker A would get throttled, back off, and retry right as Worker B’s retry landed. Each retry consumed shared allowance, so the retries themselves degraded the throughput of the other workers, which triggered more retries. Classic retry amplification, except the amplification was crossing process boundaries and I could not see it in any single worker’s log.
What “per base” actually means
The base is the container — the database-like object that holds the tables and the records. It is the thing you are reading and writing. That is the natural place to put a limit, because the base is what the service is protecting: the underlying storage and the query engine behind it. The token is just the envelope you send the request in. A service can hand you as many envelopes as you like; the mailbox is still one mailbox.
So the correct sentence in my head should have been: “this base accepts work at a certain rate, and everything I send to it — regardless of which credential I send it with — draws from that one allowance.” Once you phrase it that way, the multi-key plan stops sounding clever. It is not a way to get more capacity. It is a way to get the same capacity through more doors, with no coordination between the people using the doors.
There is a second-order consequence that I did not appreciate until later: because the budget is shared, per-key metrics are actively misleading. Each of my workers looked healthy in isolation. Each had its own error rate, its own retry count, its own “I am being throttled” story, and each story blamed the service. The only place the truth existed was in the aggregate — the total request rate against that one base — and I was not measuring that anywhere, because I did not believe there was a single thing to measure.
How I proved it to myself
I did not want to redesign the job on the strength of a sentence in a docs page. So I tested it the cheapest way I could: I stopped the workers and ran the load from one place, then compared. The comparison that mattered was not “one key versus three keys” in the abstract, it was “total requests against the base” versus “throttling”. When I let a single process push at a steady pace, it held. When I let three processes with three keys push the same aggregate pace, it fell over — and it fell over at roughly the point the aggregate rate crossed the same line the single process had been flirting with.
That is the shape of every proof of this kind: the limit follows the shared noun, not the credential. If you want to verify it for an API you are about to build against, the experiment is the same and it costs an afternoon. Move the load into one client, push the aggregate rate up until it throttles, note where the line is, then split the same aggregate rate across multiple credentials and push again. If the line moves, the limit is per credential and you can scale by keys. If the line does not move, the limit is per shared object — the base, the account, the organization, the tenant — and splitting credentials bought you nothing except complexity.
I also learned to look for the tell in the error itself. When throttled responses from independent processes arrive in clusters, that is not a coincidence and it is not a scheduling artifact. It is the signature of a shared counter being drained by everyone at once. If three processes that never talk to each other all get told to slow down in the same few seconds, the thing they have in common is the thing being limited, and it is not the credential each of them is holding.
The redesign: make the base the unit
The fix is smaller than the diagnosis. The unit of concurrency in my client is now the base, not the worker. One limiter per base, and every request that targets that base goes through that limiter, regardless of which worker or which key originates it. The limiter owns the pace. Workers can be as parallel as they like, because parallelism now costs nothing at the API boundary — they queue at the limiter and it feeds the base at a rate I chose on purpose instead of a rate I discovered by accident.
The shape of it, in pseudocode, is deliberately dull:
# one limiter per BASE, shared by every worker and every key
limiter = Limiter(keyed_by = base_id, not api_key)
for record in batch:
limiter.wait() # the pace lives here, in one place
push(record, base_id)
Two lines and a comment, and it removes the entire failure mode. The comment is the important part. Keying the limiter by base id is an assertion that the limit is per base; if I am wrong about some future API, the bug is a one-word change in a single place rather than a redesign of the workers.
That single point of coordination also gives me a place to put the second half of the fix: backoff. Previously each worker had its own retry logic, which is how three processes conspired to hammer the same shared budget in lockstep. Now there is one backoff, and it is attached to the same object as the pace. When the base pushes back, the limiter is the thing that gets told, and it slows the whole client down together. The workers never see a throttle; they see a limiter that got slower. That is the correct layering — the workers should not know or care that a rate limit exists, and they definitely should not each be writing their own opinion about it.
Put jitter in the backoff, not in the schedule
One more detail that mattered in practice: retries that fire at identical intervals stay synchronized forever. If everything backs off by the same fixed amount, everything comes back at the same instant, and the thundering herd reassembles itself precisely when the service is least able to absorb it. Adding randomness to the wait breaks the synchronization. The point is not to make retries fast; the point is to make concurrent clients stop agreeing with each other about when to try again.
I mention it here because this class of bug is where the per-base mistake hides. If I had one shared limiter with scattered retries, the herd would still form inside the limiter. The limiter is the right place to hold the pace, but the retry timing needs to be spread out or the shared budget gets spent in bursts instead of a smooth stream, and bursts are what trip the limit in the first place.
The same trap, everywhere
Airtable is where I learned it, but the note I wrote down for myself is general: the same trap exists across many SaaS APIs, and the only defense is to read the docs for what the limit actually applies to. Every serious API has a rate-limit page, and those pages differ in one crucial noun. Per token. Per key. Per account. Per organization. Per tenant. Per base. Per IP. Per endpoint. Per workspace. Each of those is a different answer to “what am I sharing, and with whom?” — and getting it wrong produces the same signature every time: independent-looking processes that mysteriously throttle together, healthy per-worker metrics, and a total throughput that refuses to improve no matter how much parallelism you throw at it.
Some of those units are worse than others because they cross boundaries you do not control. A per-account limit means a colleague’s runaway script can starve your batch job, and no amount of key hygiene on your side helps. A per-organization limit means the budget is shared with everything else the company runs. A per-IP limit means two services on the same host can collide even though they have never heard of each other. If I had assumed per-key on any of those, I would have built the same broken thing and spent the same morning on it.
The corollary is that the credential is almost never the interesting unit. Credentials are easy to mint, so services that meter per credential are telling you the credential is cheap enough to be the principal. Services that meter per resource — the base, the account, the tenant — are telling you the resource is what costs them money, and the resource is what you will be sharing with everyone else who touches it, whether or not you know they exist.
A pre-flight checklist for any new API client
This is now the list I run before I let a new integration into the nightly pipeline, and it is short enough that I actually do it:
- Find the noun. Open the rate-limit page and copy the exact sentence. Write down what the limit is attached to, in the service’s own words. If the docs are vague, assume the most pessimistic unit — the one shared by the most things — until you can prove otherwise.
- Identify every client that touches that noun. Not just the one you are writing. Every script, every worker, every other integration, every human with a key. They are all in the same budget whether or not they know it.
- Put one limiter on the shared noun. If three things write to the same base, they need to share one pace, even if they are separate processes. Shared state, one rate.
- Keep retries inside the limiter. One backoff policy, one place, with randomness in the wait so concurrent retries do not resynchronize into a burst.
- Measure the aggregate, not the worker. The health metric that matters is total request rate against the shared noun, plus the throttle rate at that same aggregate. Per-worker dashboards will lie to you by omission.
- Re-read the docs when the volume changes. A limit you understood at low volume is a limit you have not tested. The batch that grew and broke my job did not change the rules; it just moved me across a line I had not found.
What I would do differently
Two things, and neither is technical. First, I would have asked “what is the limit attached to?” before I wrote the first parallel path, not after it broke. The question takes one minute and it determines the entire concurrency design — whether parallelism is real throughput or just more contention. The number on the docs page is the least important part of that page. The noun is the whole answer.
Second, I would have built the aggregate measurement before I built the parallelism. If I had one graph of total requests per base per minute, the diagnosis would have taken minutes instead of a morning, because the graph would have shown the workers’ retries stacking on top of each other. The reason I could not see the shared budget was that I was not looking at anything shared. Adding a second key felt like adding capacity; adding a second gauge would have told me I had not added any.
The outcome, for the record, is a boring nightly job that finishes in a predictable window and does not wake me up. It is slower on paper than the parallel version I imagined. It is much faster in reality than the parallel version I actually shipped, because the parallel version spent most of its time retrying into a budget it had already exhausted. That is the trade this whole post is about: one shared limit, respected once, beats any number of keys pretending they each have their own.
Related
- systemctl –user Fails as Root: “No Medium Found”
- Fixing ECONNRESET on a Self-Hosted HTTP Bridge
- Deploy n8n Workflows via CLI, Not SQLite
- The Free-Tier 403 That Means Pay Us, Not Your Bug
- Repairing a Corrupt SQLite Database with .dump and COMMIT
Guides & explainers
Filed under: Ops & Automation, Automation, Self-Hosting