API requests may fail due to various reasons, such as network issues, rate limits, timeouts, or service disruptions.
Retries
To improve reliability, implement a retry mechanism following these best practices:
- Retry on Specific Status Codes: Retry only for these HTTP status codes:
5xx
(Server Errors)429
(Rate Limits)408
(Timeouts)
- Exponential Backoff with Jitter: Prevent server overload by using exponential backoff and/or jitter in your retry logic.
- Idempotency Keys: Use idempotency keys when supported to avoid processing the same request multiple times.
Timeouts
Our APIs are optimized for rapid failure detection and retry support. Setting client-side timeouts ensures consistency in request handling.
- SaaS Timeout Limit: In SaaS environments, API requests timeout after 29 seconds.
Note
Midaz open-source users can modify timeout settings in the Helm file.