Overview
Tempo retries requests that fail with a network error, a timeout, or a status in retryOn. Non-idempotent methods (POST, PATCH) are only retried when you opt in.
Options
attemptsDefault3numberTries in total, including the first.backoffDefault"exponential""fixed" | "linear" | "exponential"How the delay grows between tries.delayDefault300numberBase delay in milliseconds.jitterDefaulttruebooleanAdds up to 20% at random, so clients don't retry in step.retryOnDefault[408, 429, 500, 502, 503, 504]number[]Statuses that trigger a retry.methodsDefault["GET", "PUT", "DELETE"]string[]Methods that may be retried.
| Option | Type | Default |
|---|---|---|
attemptsTries in total, including the first. | number | 3 |
backoffHow the delay grows between tries. | "fixed" | "linear" | "exponential" | "exponential" |
delayBase delay in milliseconds. | number | 300 |
jitterAdds up to 20% at random, so clients don't retry in step. | boolean | true |
retryOnStatuses that trigger a retry. | number[] | [408, 429, 500, 502, 503, 504] |
methodsMethods that may be retried. | string[] | ["GET", "PUT", "DELETE"] |
Retry-After
A 429 or 503 with a Retry-After header waits as long as the server asks, up to timeout, instead of the backoff delay.
Per-request overrides
ts
await api.post("/payments", { body, retry: { attempts: 2, methods: ["POST"] },});Retry a POST only with an idempotency key
Otherwise a timeout after the server committed charges twice. Send an
Idempotency-Key header the server checks.