Classify the operation
- Read-only requests:
GEToperations are normally safe to retry when no response was received or a retryable status was returned. - Idempotent mutations: Retry only when the endpoint contract or an idempotency mechanism makes repeated execution safe.
- Non-idempotent actions: Do not automatically retry a timed-out
POSTthat can place a call, send a message, purchase a resource, or perform another side effect. First reconcile the resource or action state.
command_id or an idempotency key. Do not invent or send an idempotency header that the endpoint does not declare.
Decide by failure class
400,401,403,404, and422: Correct the request, credential, access, or resource state. Do not retry unchanged input.409: Reconcile current state and follow endpoint-specific conflict guidance.429: Delay according to the rate-limit response and retry within a bounded policy.500,502,503, and504: Retry only when the operation is safe to repeat.- Connection reset or timeout before a response: Treat the outcome as unknown for mutating operations.