InsionInsion
TypeScript

Configuration

Configure authentication, base URLs, retries, and timeouts

Pass configuration when you create InsionApiClient.

const client = new InsionApiClient({
  token: process.env.INSION_API_KEY!,
  baseUrl: "https://api.insion.co",
  timeoutInSeconds: 30,
  maxRetries: 2,
});

token is required. Use baseUrl for a custom environment, timeoutInSeconds to change the 60-second default, and maxRetries to change the default of two retries.

Per-request options

Every method accepts a second options argument. Use it for a one-off timeout, retry limit, headers, query parameters, or cancellation.

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

Set options on the client when they should apply everywhere; set them on an individual call when only that request needs different behavior.

On this page