InsionInsion
TypeScript

Configuration

Configure authentication, retries, timeouts, headers, and request overrides

Overview

Configuration is optional. The SDK's defaults are suitable for most integrations, so you only need this guide when you want fine-grained control over behavior such as retries, timeouts, headers, and per-request overrides.

Pass shared settings to InsionClient:

import { InsionClient } from "@insion/client";

const client = new InsionClient({
  token: process.env.INSION_API_KEY!,
  timeoutInSeconds: 30,
  maxRetries: 2,
  headers: { "X-Application": "community-api" },
});

Keep the API key on a trusted server. Never expose it in browser code, mobile apps, logs, or source control.

The default timeout is 60 seconds and the default retry limit is two. token may also be an async supplier when credentials rotate.

Per-request options

Every method accepts an optional second argument. It can override timeoutInSeconds, maxRetries, headers, queryParams, additionalBodyParameters, and abortSignal for one call.

await client.listRecords(
  { limit: 50 },
  {
    timeoutInSeconds: 10,
    maxRetries: 0,
    headers: { "X-Request-ID": crypto.randomUUID() },
    abortSignal: AbortSignal.timeout(10_000),
  },
);

Client settings apply everywhere; request settings take precedence for that call.

How is this guide?

On this page

Latest Release

View the TypeScript SDK on npmTypeScript SDK versionTypeScript SDK license