1---
2title: '@urql/exchange-retry'
3order: 5
4---
5
6# Retry Exchange
7
8> **Note:** These API docs are deprecated as we now keep TSDocs in all published packages.
9> You can view TSDocs while using these packages in your editor, as long as it supports the
10> TypeScript Language Server.
11> We're planning to replace these API docs with a separate web app soon.
12
13The `@urql/exchange-retry` package contains an addon `retryExchange` for `urql` that may be used to
14let failed operations be retried, typically when a previous operation has failed with a network
15error.
16
17[Read more about how to use and configure the `retryExchange` on the "Retry Operations"
18page.](../advanced/retry-operations.md)
19
20## Options
21
22| Option | Description |
23| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
24| `initialDelayMs` | Specify at what interval the `retrying` should start, this means that if we specify `1000` that when our `operation` fails we'll wait 1 second and then retry it. |
25| `maxDelayMs` | The maximum delay between retries. The `retryExchange` will keep increasing the time between retries so that the server doesn't receive simultaneous requests it can't complete. This time between requests will increase with a random `back-off` factor applied to the `initialDelayMs`, read more about the [thundering herd problem](https://en.wikipedia.org/wiki/Thundering_herd_problem). |
26| `randomDelay` | Allows the randomized delay described above to be disabled. When this option is set to `false` there will be exactly a `initialDelayMs` wait between each retry. |
27| `maxNumberAttempts` | Allows the max number of retries to be defined. |
28| `retryIf` | Apply a custom test to the returned error to determine whether it should be retried. |
29| `retryWith` | Apply a transform function allowing you to selectively replace a retried `Operation` or return a nullish value. This will act like `retryIf` where a truthy value retries (`retryIf` takes precedence and overrides this function.) |