Interface SeclaiOptions

Configuration for the Seclai client.

interface SeclaiOptions {
    accessToken?: string | AccessTokenProvider;
    accountId?: string;
    allowUnknownApiVersion?: boolean;
    apiKey?: string;
    apiKeyHeader?: string;
    apiVersion?: ApiVersion;
    autoRefresh?: boolean;
    baseUrl?: string;
    configDir?: string;
    defaultHeaders?: Record<string, string>;
    fetch?: FetchLike;
    profile?: string;
}

Properties

accessToken?: string | AccessTokenProvider

Static bearer access token or a provider function that returns one. Mutually exclusive with apiKey.

accountId?: string

Target organization account ID. Sent as X-Account-Id header. Overrides the profile's sso_account_id when using SSO auth.

allowUnknownApiVersion?: boolean

Permit an apiVersion this release was not built against.

Off by default. A newer API version can change response shapes, and this client would decode them incorrectly rather than reject them — a request-side mistake answers 422, but a reshaped response just mis-decodes, silently. Prefer upgrading the package.

apiKey?: string

API key used for authentication. Defaults to process.env.SECLAI_API_KEY when available.

apiKeyHeader?: string

Header name to use for the API key. Defaults to x-api-key.

apiVersion?: ApiVersion

Dated API version (YYYY-MM-DD) sent as the Seclai-Version header, opting this client into backward-incompatible API changes released on or before that date.

Left unset the header is omitted and the account's pinned baseline applies, so responses keep their current shapes and upgrading the SDK alone never changes the wire contract. Pin the account instead with Seclai.updateApiVersion, and read what a request resolves to with Seclai.getApiVersion.

From 2026-07-27 the API rejects undeclared query parameters with a 422 rather than ignoring them, and list endpoints return the canonical {data, pagination} envelope.

autoRefresh?: boolean

Whether to auto-refresh expired SSO tokens. Defaults to true. Set to false in environments that should not write to disk.

baseUrl?: string

API base URL. Defaults to process.env.SECLAI_API_URL when available, else SECLAI_API_URL.

configDir?: string

Override the config directory path (default: SECLAI_CONFIG_DIR env var or ~/.seclai/).

defaultHeaders?: Record<string, string>

Extra headers to include on every request.

fetch?: FetchLike

Optional fetch implementation for environments without a global fetch.

profile?: string

SSO profile name to load from ~/.seclai/config. Defaults to process.env.SECLAI_PROFILE, then "default".