Skip to content

@oneplatform/sdk


@oneplatform/sdk / createClient

Function: createClient()

createClient(options): OnePlatformClient

Defined in: packages/sdk/src/client.ts:149

Creates a new OnePlatform API client.

Construction is synchronous and performs no I/O — connection errors surface on the first API call. Multiple independent client instances can coexist in the same process (zero global state).

Parameters

options

ClientOptions

Client configuration including baseUrl and auth.

Returns

OnePlatformClient

A fully-initialised OnePlatformClient.

Throws

ConfigurationError when required options are missing or invalid.

Examples

Node.js with API key

const client = createClient({
  baseUrl: 'https://api.example.com',
  auth: { apiKey: 'op_live_...' },
});

Browser with PKCE

const client = createClient({
  baseUrl: 'https://api.example.com',
  auth: { browser: { clientId: 'my-app' } },
});