initAmplifySDK() once at application startup.
Import
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your Paxos Labs API key (format: pxl_...) |
options | SDKInitOptions | No | Configuration options for telemetry and logging |
SDKInitOptions
| Option | Type | Default | Description |
|---|---|---|---|
telemetry | boolean | true | Enable PostHog error tracking |
logLevel | LogLevel | LogLevel.ERROR | Minimum log level to output |
logger | Logger | Built-in console logger | Custom logger implementation |
Return Type
Examples
- Basic
- With Options
- Custom Logger
Behavior
- Validates API key - Ensures key follows expected format (
pxl_...) - Pre-populates cache - Fetches vaults and assets during initialization
- Configures telemetry - Sets up PostHog if enabled
- Configures logging - Sets log level and optional custom logger
- Idempotent - Multiple calls with same key are no-ops
- Re-initialization - Different key clears cache and reconfigures
Error Handling
| Error Code | Description | Resolution |
|---|---|---|
SDK_NOT_INITIALIZED | SDK used before initAmplifySDK() | Call initAmplifySDK() first |
INVALID_API_KEY | API key validation failed | Check API key format |
Related
- Logging Guide - Configure logging levels
- Project Setup - SDK initialization patterns