Skip to main content
@useroutr/sdk is the official client for your server. It is written in TypeScript, ships its own types, and has no dependencies beyond Useroutr’s type package.

Install

Quickstart

Sandbox and production

The key picks the environment, so going live is a change of key and nothing else. Each environment refuses the other’s keys with a message that says so.

Options

baseUrl overrides the key’s environment, and so does the USEROUTR_BASE_URL environment variable when baseUrl is not given.

Resources

Every method takes a last, optional argument with idempotencyKey, timeoutMs and requestId. Response types come from @useroutr/types and are re-exported by the SDK:

Pagination

list returns one page. iterate walks every page for you:
See Pagination.

Errors

Every failure is a UseroutrError with code, statusCode, requestId, retryable and details, and a subclass tells you the kind:
See Errors for every class and code.

Retries and timeouts

Reads, and writes that carry an idempotency key, are retried on 408, 425, 429, 500, 502, 503 and 504, on timeouts and on connection errors, up to maxRetries times, honouring Retry-After. Writes without a key are never retried, so a network error can never create a duplicate. A timeout surfaces as a ConnectionError with code: "TIMEOUT".

Webhooks

constructEvent verifies the signature and returns the typed event. See Webhooks for complete handlers.

Anything else

request calls any endpoint directly and also returns the request id and whether an idempotent call was replayed: