Retries with backoff
Fern SDKs will automatically retry failed requests with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit.
Retryable status codes
A request is deemed retryable when any of the following HTTP status codes is returned:
In the Java SDK, retryOnStatusCodes on the client builder replaces this default set. The configured codes are the only ones retried, and any other response (including other 5XX codes) is returned as-is. Each code must be between 100 and 599. The retry limit, backoff settings, and Retry-After handling are unchanged, and the setting applies to both sync and async clients.
Overriding the retry limit
By default, the SDK will retry a failed request up to 2 times. SDK users can override the global default retry limit when instantiating the client.
It’s also possible to override the retry limit on a per-request basis.
Customizing the backoff schedule
The Java SDK exposes client builder options to tune the exponential backoff applied between retries, alongside maxRetries.
To use a fixed retry schedule instead of exponential backoff, pass retryDelays. The n-th retry waits for the n-th duration, and retrying stops once the list is exhausted, so the list size replaces maxRetries (a per-request maxRetries override can still lower it). Delays are used as-is without jitter, and initialRetryDelayMillis, maxRetryDelayMillis, and retryJitterFactor are ignored. A Retry-After or X-RateLimit-Reset response header still takes precedence for that attempt. An empty list disables retries.