Requests, Retries, Cache
Configure request timeouts, retries, and caching.
Request configuration
Set your store's domain and optional apiKey in the
client configuration. Configure timeouts,
retries, and caching globally or override them for individual SDK calls.
Retry behavior
Automatic retries happen for 5xx responses on idempotent requests (GET, HEAD,
PUT, and DELETE). State-changing POST requests are not replayed by default,
because a proxy can return 502 after the upstream API has already processed the
operation. Count and delay are configurable globally and per request.
const res = await client.orders.list(undefined, {
retries: 2,
timeout: 8000,
});Setting retries explicitly on an individual POST opts that request into replay.
Only enable this when repeating the operation cannot create duplicate changes.
Cache behavior
- GET responses may be cached per module.
- Non-GET requests invalidate related GET cache keys.
- Cache can be disabled per request with
cache: false.
await client.products.list({ page: 1 }, { cache: true });
await client.products.list({ page: 1 }, { cache: false });Modules with highly dynamic state such as cart and orders are not cached by default.