API Reference

initialize

Initializes the native Incode SDK. Must be called at least once per app lifecycle before any other operation.

Signature

IncodeSdk.initialize({
  testMode?: boolean;
  apiConfig: {
    key?: string;
    url: string;
    e2eeUrl?: string;
  };
  sdkMode?: 'standard' | 'captureOnly' | 'submitOnly';
  waitForTutorials?: boolean;
  sslPinningConfig?: { enabled: boolean };
  disableJailbreakDetection?: boolean;
  externalAnalyticsEnabled?: boolean;
  loggingEnabled?: boolean;
  externalScreenshotsEnabled?: boolean;
  clientExperimentId?: string | null;
}): Promise<void>

Required Parameters

Optional Parameters

Returns / Callbacks

Example

try {
  await IncodeSdk.initialize({
    testMode: false,
    apiConfig: {
      key: 'YOUR_API_KEY',
      url: 'YOUR_API_URL',
    },
  });
  console.log('Incode initialized successfully');
} catch (error) {
  const e = error as IncodeSdkInitError;
  console.error(e.code + ' - ' + e.message);
}

isInitialized

Checks whether the native Incode SDK has finished initialization.

Signature

IncodeSdk.isInitialized(): Promise<boolean>

Parameters

Returns / Callbacks

Example

const ready = await IncodeSdk.isInitialized();
if (ready) {
  // Safe to start onboarding.
}

setSdkMode

Changes the SDK mode after initialization.

Signature

IncodeSdk.setSdkMode(
  sdkMode: 'standard' | 'captureOnly' | 'submitOnly'
): Promise<any>

Required Parameters

Returns / Callbacks

Example

await IncodeSdk.setSdkMode('captureOnly');

startOnboarding

Creates a session and runs a complete, locally-defined onboarding flow end to end.

Signature

IncodeSdk.startOnboarding({
  sessionConfig?: OnboardingSessionConfig;
  flowConfig?: OnboardingFlowConfig;
  recordSessionConfig?: OnboardingRecordSessionConfig;
}): Promise<OnboardingResponse>

Optional Parameters

Returns / Callbacks

Example

const result = await IncodeSdk.startOnboarding({
  sessionConfig: {
    region: 'ALL',
  },
  flowConfig: [
    { module: 'IdScan' },
    { module: 'SelfieScan' },
    { module: 'FaceMatch' },
  ],
});

setupOnboardingSession

Creates or attaches to an onboarding session for section-based flows.

Signature

IncodeSdk.setupOnboardingSession({
  sessionConfig?: OnboardingSessionConfig;
}): Promise<OnboardingSession>

Optional Parameters

Returns / Callbacks

Example

const session = await IncodeSdk.setupOnboardingSession({
  sessionConfig: {
    token: 'YOUR_TOKEN',
  },
});

console.log(session.interviewId, session.token);

startOnboardingSection

Starts one section in a section-based flow.

Signature

IncodeSdk.startOnboardingSection({
  flowConfig?: OnboardingFlowConfig;
  recordSessionConfig?: OnboardingRecordSessionConfig;
  sectionTag?: string;
}): Promise<OnboardingSectionResponse>

Optional Parameters

Returns / Callbacks

Example

const idSection = await IncodeSdk.startOnboardingSection({
  flowConfig: [{ module: 'IdScan' }],
  sectionTag: 'idSection',
});

if (idSection.status === 'success') {
  await IncodeSdk.startOnboardingSection({
    flowConfig: [{ module: 'SelfieScan' }],
    sectionTag: 'selfieSection',
  });
}

You can start multiple sections, but only one at a time. Call finishOnboardingFlow() after all sections complete.

finishOnboardingFlow

Finishes the current section-based onboarding session.

Signature

IncodeSdk.finishOnboardingFlow(): Promise<any>

Parameters

Returns / Callbacks

Example

await IncodeSdk.finishOnboardingFlow();

startFlow

Starts a dashboard-configured flow.

Signature

IncodeSdk.startFlow({
  sessionConfig?: OnboardingSessionConfig;
  moduleId?: string;
}): Promise<OnboardingResponse>

Required Parameters

Optional Parameters

Returns / Callbacks

Example

await IncodeSdk.startFlow({
  sessionConfig: {
    configurationId: 'YOUR_CONFIGURATION_ID',
  },
  moduleId: 'EMAIL',
});

startWorkflow

Starts a dashboard-configured workflow.

Signature

IncodeSdk.startWorkflow({
  sessionConfig?: OnboardingSessionConfig;
}): Promise<OnboardingResponse>

Required Parameters

Optional Parameters

Returns / Callbacks

Example

const result = await IncodeSdk.startWorkflow({
  sessionConfig: {
    configurationId: 'YOUR_CONFIGURATION_ID',
  },
});

startFlowFromDeepLink

Starts a flow from a deep link URL.

Signature

IncodeSdk.startFlowFromDeepLink(
  url?: string,
  isShortened?: boolean
): Promise<OnboardingResponse>

Optional Parameters

Returns / Callbacks

Example

await IncodeSdk.startFlowFromDeepLink('YOUR_DEEP_LINK_URL', false);

onSessionCreated

Subscribes to onboarding session creation events.

Signature

IncodeSdk.onSessionCreated(
  listener: (session: OnboardingSession) => void
): () => void

Required Parameters

Returns / Callbacks

Example

const unsubscribe = IncodeSdk.onSessionCreated((session) => {
  console.log('Onboarding session created, interviewId: ' + session.interviewId);
});

onStepCompleted

Subscribes to step completion events for a specific module.

Signature

IncodeSdk.onStepCompleted({
  module: string;
  listener: (event: StepCompletedEvent) => void;
}): () => void

Required Parameters

Returns / Callbacks

Example

const unsubscribe = IncodeSdk.onStepCompleted({
  module: 'SelfieScan',
  listener: (event) => {
    console.log('SELFIE SCAN completed', event.result);
  },
});

onStepUpdated

Subscribes to in-progress step update events.

Signature

IncodeSdk.onStepUpdated({
  module: 'Conference' | 'IdScanFront' | 'IdScanBack' | 'SelfieScan';
  listener: (event: StepUpdatedEvent) => void;
}): () => void

Required Parameters

Returns / Callbacks

Example

const unsubscribe = IncodeSdk.onStepUpdated({
  module: 'IdScanFront',
  listener: (event) => {
    console.log('ID Scan Front Attempt: ', event.result);
    console.log('allAttemptsExhausted:', event.result.allAttemptsExhausted);
  },
});

onStepError

Subscribes to module error events.

Signature

IncodeSdk.onStepError({
  module: string;
  listener: (event: StepErrorEvent) => void;
}): () => void

Required Parameters

Returns / Callbacks

Example

const unsubscribe = IncodeSdk.onStepError({
  module: 'FaceMatch',
  listener: (event) => {
    console.log('FaceMatch error', event);
  },
});

onEvents

Subscribes to tracking events.

Signature

IncodeSdk.onEvents(
  listener: (events: Events) => void
): () => void

Required Parameters

Returns / Callbacks

Example

const unsubscribe = IncodeSdk.onEvents((eventBatch) => {
  for (const event of eventBatch.events) {
    console.log(event.event, event.data);
  }
});

approve

Programmatically initiates approval of the current user.

Signature

IncodeSdk.approve({
  forceApproval: boolean;
}): Promise<ApprovalResult>

Required Parameters

Older text may call this setting forceApprove; in the React Native SDK config object the current parameter is forceApproval.

Returns / Callbacks

Example

IncodeSdk.approve({ forceApproval: false })
  .then((result) => {
    console.log('approve finished: ', result);
  })
  .catch((error) => {
    console.log('approve error: ', error);
  });

getUserScore

Fetches the current user score programmatically.

Signature

IncodeSdk.getUserScore(config?: {
  mode?: 'accurate' | 'fast';
}): Promise<UserScore>

Optional Parameters

Returns / Callbacks

Example

IncodeSdk.getUserScore({ mode: 'accurate' })
  .then((score) => console.log(score))
  .catch((error) => {
    console.error('Get user score failed', error);
  });

faceMatch

Programmatically initiates face match between photo from the ID and Selfie.

Signature

IncodeSdk.faceMatch(): Promise<FaceMatchCompleteEvent>

Parameters

Returns / Callbacks

Example

IncodeSdk.faceMatch()
  .then((faceMatchResult) => {
    console.log('Face match result: ', faceMatchResult);
  })
  .catch((error) => {
    console.error('Face match failed', error);
  });

startFaceLogin

Starts Face Login authentication. A prerequisite for a successful Face Login is that the user has an approved account with an enrolled face.

Signature

IncodeSdk.startFaceLogin({
  showTutorials: boolean;
  customerUUID?: string;
  faceMaskCheck?: boolean;
  lensesCheck?: boolean;
  brightnessThreshold?: number;
  logAuthenticationEnabled?: boolean;
  e2eeEncryptionEnabled?: boolean;
}): Promise<FaceLoginResult>

Required Parameters

Optional Parameters

Returns / Callbacks

Example

1:1 Face Login performs a 1:1 face comparison and returns a successful match if the two faces match. For 1:1 Face Login, you need the user's customerUUID. If the user was approved during onboarding on the mobile device, you should have received customerUUID as a result of the Approve step.

const result = await IncodeSdk.startFaceLogin({
  showTutorials: true,
  customerUUID: 'YOUR_CUSTOMER_UUID',
  faceMaskCheck: false,
  lensesCheck: false,
  logAuthenticationEnabled: false,
  e2eeEncryptionEnabled: false,
});

1:N Face Login performs a database face lookup and returns a successful match if the face is found in the database. Omit customerUUID for 1:N Face Login.

const result = await IncodeSdk.startFaceLogin({
  showTutorials: true,
  faceMaskCheck: false,
  lensesCheck: false,
  logAuthenticationEnabled: false,
  e2eeEncryptionEnabled: false,
});

To enable faceMaskCheck on Android, add:

Gradle

implementation 'com.incode.sdk:model-mask-detection:2.0.0'

deleteLocalUserData

Deletes locally stored onboarding session data on Android devices.

Signature

IncodeSdk.deleteLocalUserData(): Promise<any>

Parameters

Returns / Callbacks

Older text may refer to this method as deleteUserLocalData; the current React Native SDK method is deleteLocalUserData.

Example

await IncodeSdk.deleteLocalUserData();

showCloseButton

Shows or hides the close button during SDK flows.

Signature

IncodeSdk.showCloseButton(
  shouldShowCloseButton: boolean
): Promise<void>

Required Parameters

Returns / Callbacks

Example

IncodeSdk.showCloseButton(true);

setLocalizationLanguage

Sets runtime localization language.

Signature

IncodeSdk.setLocalizationLanguage(
  language: string
): Promise<string>

Required Parameters

Returns / Callbacks

Example

await IncodeSdk.setLocalizationLanguage('en');

Android requires:

Gradle

implementation 'com.incode.sdk:extensions:1.2.1'

setString

Sets and updates string resources at runtime.

Signature

IncodeSdk.setString(
  strings: { [key: string]: string }
): Promise<void>

Required Parameters

Returns / Callbacks

Some native documentation writes this as IncodeSDK.setString; in React Native, call IncodeSdk.setString.

Example

IncodeSdk.setString({
  // iOS labels
  'incdOnboarding.idChooser.idButton': 'Id',
  // Android labels
  onboard_sdk_btn_passport: 'Passport',
});

Android requires:

Gradle

implementation 'com.incode.sdk:extensions:1.2.1'

For iOS, see Localization Guide. For Android, see Dynamic Localization.

setQuantityStrings

Sets Android plural strings at runtime.

Signature

IncodeSdk.setQuantityStrings(
  strings: { [key: string]: any }
): Promise<any>

Required Parameters

Returns / Callbacks

Example

await IncodeSdk.setQuantityStrings({
  en: {
    onboard_sdk_validation_attempts_remaining: {
      one: '%d attempt remaining',
      other: '%d attempts remaining',
    },
  },
});

setTheme

Applies a JSON theme.

Signature

IncodeSdk.setTheme({
  jsonTheme: string;
}): Promise<any>

Required Parameters

Returns / Callbacks

Example

await IncodeSdk.setTheme({
  jsonTheme: JSON.stringify({
    colors: {
      accent: '#00B2FD',
      primary: '#20263D',
    },
  }),
});

setUXConfig

Applies UX configuration for V2 ID scan and Selfie experiences.

Signature

IncodeSdk.setUXConfig({
  jsonConfig: string;
}): Promise<any>

Required Parameters

Returns / Callbacks

Example

await IncodeSdk.setUXConfig({
  jsonConfig: JSON.stringify({}),
});

setFaceAuthenticationHint

Provides a face authentication hint for the FaceAuthentication module.

Signature

IncodeSdk.setFaceAuthenticationHint(
  faceAuthenticationHint: string | { faceAuthenticationHint: string }
): Promise<void>

Required Parameters

Returns / Callbacks

Example

await IncodeSdk.setFaceAuthenticationHint('customer@example.com');

onResourceDownloadProgressUpdated

Subscribes to Dynamic Delivery resource download progress.

Signature

IncodeSdk.onResourceDownloadProgressUpdated(
  listener: (event: { progress: Number }) => void
): () => void

Required Parameters

Returns / Callbacks

Example

const unsubscribe = IncodeSdk.onResourceDownloadProgressUpdated(({ progress }) => {
  console.log(progress);
});

checkOnDemandResourcesDownloaded

Checks whether Dynamic Delivery resources are already downloaded.

Signature

IncodeSdk.checkOnDemandResourcesDownloaded(config?: {
  moduleName: string;
}): Promise<any>

Optional Parameters

Returns / Callbacks

Example

await IncodeSdk.checkOnDemandResourcesDownloaded({ moduleName: 'IdScan' });

downloadOnDemandResources

Downloads Dynamic Delivery resources.

Signature

IncodeSdk.downloadOnDemandResources(config?: {
  moduleName: string;
}): Promise<any>

Optional Parameters

Returns / Callbacks

Example

await IncodeSdk.downloadOnDemandResources({ moduleName: 'IdScan' });

removeOnDemandResources

Removes Dynamic Delivery resources.

Signature

IncodeSdk.removeOnDemandResources(config?: {
  moduleName: string;
}): Promise<any>

Optional Parameters

Returns / Callbacks

Example

await IncodeSdk.removeOnDemandResources({ moduleName: 'IdScan' });

Shared types

Signature

type OnboardingSessionConfig = {
  region?: string;
  queue?: string;
  interviewId?: string;
  token?: string;
  configurationId?: string;
  externalId?: string;
  externalCustomerId?: string;
  customFields?: { [key: string]: string };
  validationModules?: ValidationModule[];
  e2eEncryptionEnabled?: boolean;
  mergeSessionRecordings?: boolean;
  voiceConsentLanguage?: string;
};

type OnboardingRecordSessionConfig = {
  recordSession: boolean;
  forcePermissions: boolean;
};

type OnboardingResponse = {
  status: 'success' | 'userCancelled';
};

type OnboardingSession = {
  interviewId: string;
  token: string;
};

type OnboardingSectionResponse = OnboardingResponse & {
  sectionTag: string;
};

OnboardingSessionConfig Fields

OnboardingRecordSessionConfig Fields