JavaScript / TypeScript
Timeouts, retries and cancellation
- Each attempt has a timeout (
timeout, 30 s by default). - GET requests are retried after a network error, 429, 502, 503 or 520, up to
maxRetries(2), with exponential backoff and jitter. ARetry-Afterfrom the API is honored when it is up to 30 s; longer waits are not retried and surface as the error, withretryAfterset. - POST (
tools.splitHunt) is never retried. - Pass an
AbortSignalto cancel a call, including any pending retry:
ts
const controller = new AbortController();
setTimeout(() => controller.abort(), 5_000);
await client.highscores.list({}, { signal: controller.signal, maxRetries: 0 });Next: API keys.