API key rotation: changing credentials without an outage
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.
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.
Most integration time is spent on failures, not on the happy path — and most of that time is spent guessing. API error handling decides whether a developer reads your response and knows what to do, or opens a support ticket because "it returns 500 sometimes". The useful question when designing one is not what went wrong but what the caller should do next.
Split every failure into two groups: the caller can fix it, or they cannot. A malformed request, a missing field, an invalid identifier — those are the caller's to fix, and retrying unchanged will fail identically forever. A timeout, a dependency outage, a rate limit — those are transient, and retrying is the correct behaviour. If your response does not let a client tell these apart, every integration either retries things that will never succeed or gives up on things that would have worked on the second attempt.
Keep the error shape identical across every endpoint, including the ones added later. A client writes one error handler; a second shape means that handler silently fails to parse exactly when something has already gone wrong.
Error cases designed at the end become whatever the framework produced by default, which is how stack traces reach production and how one endpoint answers in a shape nothing else uses. Listing the failure modes while designing the endpoint takes ten minutes and usually improves the success path too — several of them turn out to be avoidable by changing the input rather than by reporting a failure.
The Ettex Api documents the authentication model and the endpoint catalogue in one place, and the same error contract applies to every endpoint it exposes. Where retries are involved, the error body and idempotency work together: the first tells a client it may retry, the second makes the retry safe.
Both. The status tells intermediaries and generic clients what class of failure it is; the body carries the stable code a client branches on.
400 for a request that cannot be parsed or is structurally wrong, 422 for one that parses but fails business validation. The distinction only helps if applied consistently.
No. Write them for the developer reading logs; let the client decide what to show a person, because only the client knows the context.
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.
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.