Rate Limiting the Onboarding Checklist's Step Endpoint
The step-completion endpoint is small and called often, which makes it an easy target for retries, bugs and scripts. What to rate-limit, and by what key.
The step-completion endpoint is one of the smallest routes in a typical integration — it takes a step id, a user id, maybe a timestamp, and writes one row. That smallness is exactly what makes it easy to overlook when you're thinking about what needs protecting. The login endpoint, the billing webhook, the search box: those get rate limits because someone remembers they're expensive or sensitive. A route that just flips a boolean doesn't look dangerous, so it's the one most likely to ship with no limit at all, and the one most likely to get called far more often than the product design assumes, because the thing that calls it is rarely a human clicking once.
Who actually calls this endpoint more than once
A single real user completing a single real step calls the endpoint once. Everything above that volume is something else. A retrying client is the common case: a frontend that doesn't disable the button after the first click, or a mobile app that resubmits on a flaky connection, can turn one completion into three or four requests within a second, all with the same step id. A polling integration is another: some server-side integrations re-POST the same completion on every webhook replay rather than checking state first, because it's simpler to write and the write is supposed to be idempotent anyway — which it should be, but idempotent doesn't mean free. And then there's the case worth designing for even if it hasn't happened yet: a script, written by a user who found the endpoint in their network tab, hammering it to see what happens, or testing whether completing steps unlocks something. None of these are malicious in the way a login brute-force is, but all of them turn a route that should see a few requests per user per session into one that can see hundreds.
Rate limit by user, not by IP
The default instinct for a web API is to rate-limit by IP address, because that's what most rate-limiting middleware does out of the box. For this endpoint specifically, IP is close to the wrong key. The requests that matter are tied to an authenticated user completing their own steps, and a single IP — an office, a university network, a shared NAT behind a large mobile carrier — can represent hundreds of legitimate users on a popular host app, all of whom would share one bucket and start seeing 429s from each other's normal traffic. Keying the limit on the authenticated user id (or the API key plus user id, if the integration calls on the user's behalf) scopes the bucket to the thing that's actually bursting: one user's client misbehaving, or one user's script. IP-based limiting still earns a place as a second, much looser layer against unauthenticated traffic hitting the route at all, but it shouldn't be the only gate.
// bucket key, not the literal limiter call
key := fmt.Sprintf("step-complete:%s", userID)
// a short window with a small burst allowance covers the retry case
// without punishing a user who legitimately completes several steps in a row
The limit has to be generous enough for a real onboarding flow
A checklist with eight steps and a user who's motivated to finish in one sitting is going to generate eight completion calls in a short window, possibly seconds apart if several steps auto-complete off the same action. A limit tuned for "this should never happen more than once or twice a minute" will throttle that exact good case and make the fast path look broken to the one kind of user you most want to keep — someone finishing onboarding. The number to size against isn't an industry rate-limit default; it's the longest checklist shipped on this instance and how fast its steps can legitimately fire back to back, including the steps that auto-complete server-side off a single webhook (see the piece on steps that complete themselves, which can fire several completions from one event). A limit set from that number, with headroom, catches abuse without catching the thing the endpoint exists for.
What a limited request should return
A 429 with nothing else is a dead end for a legitimate retrying client — it has no way to know whether to try again in one second or one minute, so it either gives up (a step that should have completed silently fails) or retries immediately (making the problem worse). A `Retry-After` header with a concrete number of seconds turns the same response from a wall into an instruction a well-behaved client can follow. On the integration side, treating a 429 on step-completion as "already handled, don't surface an error to the user" is usually the right default too: the step is very likely already complete from an earlier call in the same burst, and surfacing a rate-limit error to the end user over something they experience as "I clicked a checklist item" teaches them that the product is flaky when the actual problem was a duplicate request the system already satisfied.
What to measure instead of guessing at a number
Whether a given limit is too tight, too loose or about right isn't something to set once from a gut number and leave — it's a distribution to look at: completion calls per user per minute, across real sessions, with the 99th-percentile burst size as the number that actually sizes the limit (the median user tells you nothing about the case the limit exists for). That distribution isn't something this site has collected yet; `GET /metrics` gives per-route request counts today but not per-user burst size, so the honest statement is that the right number for a given integration is currently a judgment call, not a measured one, until that's tracked. See the API reference for the endpoint's current behavior, and onboarding webhook events for the retry semantics on the integration side that feed into how often this endpoint actually gets hit.