SYNTIQORA SYSTEMS / DIGITAL SYSTEMS STUDIO

API Failures Are Product States

Design resilient API errors with Problem Details, bounded retries, idempotency, correlation, and honest asynchronous status.

Make failure explicit An API response is part of the product contract. Distinguish invalid input, authentication failure, authorization failure, rate limiting, dependency failure, timeout, conflict, and unavailable service. Return the correct HTTP status and a stable machine-readable error type. A client should know whether to correct the request, ask a user for permission, wait, or stop. Give every failure a useful identity Use a problem-details response with a stable type, a short title, occurrence-specific detail, and an instance or correlation identifier. Keep internal stack traces, credentials, provider payloads, and database details out of public responses. The client can show a safe explanation while operators use the correlation identifier to find structured logs and traces. Retries need a budget Retry only failures that are plausibly temporary. Use deadlines, exponential backoff with jitter, a maximum attempt count, and a retry budget. Do not retry malformed requests, permission failures, or conflicts as if another attempt could make them valid. If several layers retry the same request, the attempt count can multiply and turn a small overload into a cascading failure. Design partial success and recovery For asynchronous work, return a durable job identity and expose state transitions such as accepted, running, succeeded, failed, and cancelled. Make mutations idempotent so a client can safely retry after an ambiguous network response. Preserve the difference between accepted work and completed work; an HTTP 202 is not proof that the business action succeeded. Research basis RFC 9457 defines Problem Details for HTTP APIs, including type, title, status, detail, instance, and extensible fields. Google’s SRE guidance documents how naive retries can amplify overload