Skip to content

Configuration

The SDK accepts a configuration object when you create a new CircadifySDK instance. Only apiKey is required.

Pass a CircadifyConfig object to the constructor. Only apiKey is required — everything else has sensible defaults.

import { CircadifySDK } from '@circadify/sdk';
const sdk = new CircadifySDK({
apiKey: 'ck_test_your_key_here',
});
const sdk = new CircadifySDK({
apiKey: 'ck_test_your_key_here',
baseUrl: 'https://api.circadify.com',
measurementDuration: 30,
debug: false,
onProgress: (event) => {
console.log(`${event.phase}: ${event.percent}%`);
},
onQualityWarning: (warning) => {
console.warn(warning.type, warning.message);
},
});
OptionTypeDefaultDescription
apiKeystringRequired. Your API key (ck_test_* for test, ck_live_* for production).
baseUrlstring'https://api.circadify.com'Custom API base URL.
measurementDurationnumber30Target measurement duration in seconds.
debugbooleanfalseEnable debug logging to the browser console.
onProgressfunctionundefinedCalled during measurement with progress updates.
onQualityWarningfunctionundefinedCalled when scan quality degrades (lighting, motion, face position, occlusion).
wasmConfigWasmConfigundefinedOverride CDN URLs for self-hosted WASM modules.
interface CircadifyConfig {
apiKey: string;
baseUrl?: string;
measurementDuration?: number;
debug?: boolean;
onProgress?: (event: MeasurementProgress) => void;
onQualityWarning?: (warning: QualityWarning) => void;
wasmConfig?: WasmConfig;
}

The onProgress callback fires throughout measurement with a MeasurementProgress object:

interface MeasurementProgress {
percent: number; // 0-100
phase: 'initializing' | 'readiness' | 'capturing' | 'uploading' | 'processing';
elapsed: number; // Seconds since measurement started
remaining?: number; // Estimated seconds remaining (when available)
}
PhaseProgressWhat’s happening
initializing0–5%Creating session, loading vision engine
readiness5–10%Opening camera, waiting for quality checks to pass
capturing10–60%Capturing and preprocessing frames
uploading60–80%Uploading preprocessed data
processing80–100%Backend inference running

The onQualityWarning callback fires when capture quality degrades:

interface QualityWarning {
type: 'lighting' | 'motion' | 'face_position' | 'occlusion';
message: string;
severity: 'low' | 'medium' | 'high';
}

Use this to show guidance to the user — “Hold still”, “Move to better lighting”, etc.

For air-gapped or regulated environments, host the vision engine files on your own infrastructure:

interface WasmConfig {
mediapipeWasmUrl?: string;
mediapipeModelUrl?: string;
opencvUrl?: string;
}
const sdk = new CircadifySDK({
apiKey: 'ck_live_your_key_here',
wasmConfig: {
mediapipeWasmUrl: 'https://cdn.yourcompany.com/circadify/wasm/',
mediapipeModelUrl: 'https://cdn.yourcompany.com/circadify/models/',
opencvUrl: 'https://cdn.yourcompany.com/circadify/geometry.js',
},
});

Contact support@circadify.com for the WASM distribution package.