API error handling: telling a client what went wrong and what to do
API error handling is a design decision, not a fallback. Which status codes to use, what an error body should contain, and the distinction that decides whether a client retries.
API key rotation fails when it is a single swap with no overlap. How to run it with two valid keys, what to do about keys you cannot find, and why rotation only matters if revocation works.
Everybody agrees keys should be rotated and almost nobody does it, because the obvious method — delete the old key, create a new one, update everything — guarantees an outage somewhere you forgot. API key rotation only becomes routine when the process allows two valid keys at once, which turns a synchronised cutover into an ordinary deployment.
Three reasons, in order. Nobody knows where the keys are used, because they were pasted into a config during an incident two years ago. There is no usage visibility, so "is anything still using this" is unanswerable except by switching it off and waiting for complaints. And there is no owner — a key belonging to everyone belongs to nobody, and nobody volunteers to be the person who broke the nightly job. Fixing the inventory is most of fixing rotation.
One key per integration, named for what uses it. Shared keys make rotation an all-or-nothing event and make a leak unattributable — you cannot tell which system was compromised, so you have to assume all of them were.
The point of rotating on a schedule is to limit how long a leaked credential stays useful. That only holds if revocation is genuinely immediate and genuinely complete — if a disabled key keeps working for ten minutes because of caching, your actual exposure window is the schedule plus the cache. Test revocation the same way you test backups: by doing it, once, deliberately, and confirming the request fails.
The Ettex Api issues keys scoped to a verified domain and revocable at any time, which is the property rotation depends on. Where an agent calls on your behalf through the MCP server, give it its own key for the same reason: a separate credential is what makes the blast radius answerable.
Often enough that the process stays practised — quarterly is common. A yearly rotation nobody has rehearsed tends to fail in ways a quarterly one would have exposed.
Yes, if the system allows two valid keys during the overlap. Without overlap you are performing a synchronised cutover, which is where the outages come from.
Revoke immediately rather than waiting for a rotation window, then investigate what it could reach. This is the argument for one key per integration: the answer is narrow instead of "everything".
API error handling is a design decision, not a fallback. Which status codes to use, what an error body should contain, and the distinction that decides whether a client retries.
Idempotency is what stops a retried request charging a card twice. How idempotency keys work, which operations need them, and what the server has to remember.
API versioning is a promise about what will not break. Which changes are safe, how to version without forking your codebase, and how to deprecate without stranding integrations.