# API Reference

This page is the complete reference for every public API on the Flutter SDK's `IncodeOnboardingSdk` class. Each entry documents the method's signature, parameters, return value, and a short example.

For module-specific configuration parameters (those used when adding modules to a flow), see [Modules](./flutter-modules). For the shape of result objects and listener event payloads, see [Results](./flutter-results). For implementation patterns showing how methods compose into a full flow, see [Common Implementation Patterns](./flutter-common-implementation-patterns).

## init

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

**Signature**

```dart
IncodeOnboardingSdk.init({
  bool loggingEnabled = true,
  String? apiKey,
  String? apiUrl,
  String? e2eeUrl,
  bool? testMode,
  bool? waitForTutorials,
  bool? disableJailbreakDetection,
  bool? externalAnalyticsEnabled,
  bool? externalScreenshotsEnabled,
  String? clientExperimentId,
  bool? sslPinningEnabled,
  bool? forceSSLPinning,
  required Function() onSuccess,
  required Function(String error) onError,
})
```

**Optional Parameters**

- `loggingEnabled`: If `true`, the SDK logs debug information to the console. Defaults to `true`.
- `apiKey`: API key provided by Incode.
- `apiUrl`: API base URL provided by Incode.
- `e2eeUrl`: E2EE base URL provided by Incode.
- `testMode`: Set to `true` when running the app on a simulator.
- `waitForTutorials`: If `true`, the SDK waits for the user to complete tutorials before starting the onboarding flow. Defaults to `false`.
- `disableJailbreakDetection`: If `true`, the SDK does not check for jailbroken or rooted devices. Defaults to `false`.
- `externalAnalyticsEnabled`: If `true`, the SDK sends analytics events to the external analytics provider. Defaults to `false`.
- `externalScreenshotsEnabled`: If `true`, the SDK allows screenshots to be taken. Defaults to `false`.
- `clientExperimentId`: If set, the SDK sends this value to the server for A/B testing. Defaults to `null`.
- `sslPinningEnabled`: If `true`, the SDK enables SSL pinning. Defaults to `false`.
- `forceSSLPinning`: If `true`, the SDK forces SSL pinning even if the server does not support it. Defaults to `false`.

**Returns / Callbacks**

- `onSuccess()`: Called when the SDK is initialized successfully.
- `onError(String error)`: Called when initialization fails. The `error` String can be converted to an `IncodeSdkInitError` enum via `error.toIncodeSdkInitError()`. See [Results](./flutter-results).

**Example**

```dart
IncodeOnboardingSdk.init(
  apiKey: 'YOUR_API_KEY',
  apiUrl: 'YOUR_API_URL',
  testMode: false,
  onError: (String error) {
    print('Incode init failed: $error');
  },
  onSuccess: () {
    print('Incode initialized successfully!');
  },
);
```

See [Installation](./flutter-installation).

## isInitialized

Checks whether the native Incode SDK has finished initialization. This method never throws; any platform error is handled internally and reported as `false`, so it is safe to use as a quick readiness check before starting a flow.

**Signature**

```dart
Future<bool> IncodeOnboardingSdk.isInitialized()
```

**Returns / Callbacks**

- Returns a `Future<bool>` that resolves to `true` when the SDK is ready to be used, and `false` otherwise.

**Example**

```dart
final bool ready = await IncodeOnboardingSdk.isInitialized();
if (ready) {
  // Safe to start onboarding
}
```

## startOnboarding

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

**Signature**

```dart
IncodeOnboardingSdk.startOnboarding({
  required OnboardingSessionConfiguration sessionConfig,
  required OnboardingFlowConfiguration flowConfig,
  OnboardingRecordSessionConfiguration? recordSessionConfig,
  required Function() onSuccess,
  required Function(String error) onError,
  Function(SelfieScanResult result)? onSelfieScanCompleted,
  Function(SelfieScanResult result)? onSelfieScanAttemptCompleted,
  Function(FaceMatchResult result)? onFaceMatchCompleted,
  Function(GeoLocationResult result)? onGeolocationCompleted,
  Function(PhoneNumberResult result)? onAddPhoneNumberCompleted,
  Function(VideoSelfieResult result)? onVideoSelfieCompleted,
  Function(OnboardingSessionResult result)? onOnboardingSessionCreated,
  Function(ApprovalResult result)? onApproveCompleted,
  Function(UserScoreResult result)? onUserScoreFetched,
  Function(GovernmentValidationResult result)? onGovernmentValidationCompleted,
  Function(AntifraudResult result)? onAntifraudCompleted,
  Function(DocumentScanResult result)? onDocumentScanCompleted,
  Function(SignatureResult result)? onSignatureCollected,
  Function(CaptchaResult result)? onCaptchaCompleted,
  Function(CurpValidationResult result)? onCurpValidationCompleted,
  Function(OCREditResult result)? onOCREditCompleted,
  Function(EKYBResult result)? onEKYBCompleted,
  Function(EKYCResult result)? onEKYCCompleted,
  Function(IdScanResult result)? onIdFrontCompleted,
  Function(IdScanResult result)? onIdBackCompleted,
  Function(IdScanResult result)? onIdFrontAttemptCompleted,
  Function(IdScanResult result)? onIdBackAttemptCompleted,
  Function(String ocrData)? onIdProcessed,
  Function(AddEmailResult result)? onAddEmailCompleted,
  Function(AddFullNameResult result)? onAddFullNameCompleted,
  Function(MLConsentResult result)? onMLConsentCompleted,
  Function(CustomWatchlistResult result)? onCustomWatchlistCompleted,
  Function(AesResult result)? onAesCompleted,
  Function(UserConsentResult result)? onUserConsentCompleted,
  Function(QRScanResult result)? onQRScanCompleted,
  Function(GlobalWatchlistResult result)? onGlobalWatchlistCompleted,
  Function(CombinedConsentResult result)? onCombinedConsentCompleted,
  Function(NFCScanResult result)? onNFCScanCompleted,
  Function(FaceAuthenticationResult result)? onFaceAuthenticationCompleted,
  Function()? onSSLPinningFailed,
  Function(OnEventsResult result)? onEvents,
  Function()? onUserCancelled,
})
```

**Required Parameters**

- `sessionConfig`: An `OnboardingSessionConfiguration` object that contains the configuration for the onboarding session.
- `flowConfig`: An `OnboardingFlowConfiguration` object that contains the configuration for the onboarding flow.

**Optional Parameters**

- `recordSessionConfig`: An `OnboardingRecordSessionConfiguration` object that contains the configuration for recording the onboarding session.

You can provide any of the following parameters to the `OnboardingSessionConfiguration` constructor:

- `region`: Defaults to `ALL`.
- `onboardingValidationModules`: List of `OnboardingValidationModule` items. Determines which modules are used for verification and onboarding score calculation. If `null`, the defaults are used: id, faceRecognition, and liveness.
- `queue`: Name of the video conference queue. Defaults to `null`, which uses the default queue.
- `customFields`: Custom fields sent to the server.
- `externalId`: User identifier outside of the Incode Omni database. If a session with the same `externalId` already exists, it is resumed; otherwise, a new session is created.
- `externalCustomerId`: Identifier linking the onboarding session to an entity in an external system. Typically used to represent a prospect ID or customer ID from your own database.
- `interviewId`: Unique identifier of an existing session. Resumes that session.
- `token`: Token of an existing session. Resumes that session. See [Token-Based Setup](./flutter-token-based-setup).
- `configurationId`: Flow URL/ID from Dashboard. On this pattern, the locally configured flow still executes; the `configurationId` does not take precedence. To run a Dashboard-configured Flow, see [Run Flows Configured Online](./flutter-run-flows-configured-online).
- `e2eEncryptionEnabled`: Enables End-to-End Encryption for the session. See [End-to-End Encryption (E2EE)](./flutter-e2ee).
- `voiceConsentLanguage`: Language code used for the voice consent reading during the Video Selfie step. Supported values: `en`, `es`, `pt`, `he`. Other values fall back to `en`. Codes are mapped to specific locales: `en` → `en-US`, `es` → `es-ES`, `pt` → `pt-BR`, `he` → `he-IL`.

**Returns / Callbacks**

- `onSuccess()`: Called when the onboarding flow completes successfully.
- `onError(String error)`: Called when an error occurs. The `error` String can be converted to an `IncodeSdkFlowError` enum via `error.toIncodeSdkFlowError()`. See [Results](./flutter-results).
- `onUserCancelled()`: Called when the user cancels the onboarding flow.
- Per-module step callbacks: Add the callbacks for modules whose results you want to receive as they complete. See [Results](./flutter-results) for the full list of available listeners and their payloads.
- `onSSLPinningFailed()`: Called when SSL pinning fails.
- `onEvents(OnEventsResult result)`: Called when a tracking event occurs during the onboarding flow. See [Results](./flutter-results).

**Example**

```dart
OnboardingSessionConfiguration sessionConfig = OnboardingSessionConfiguration();

OnboardingFlowConfiguration flowConfig = OnboardingFlowConfiguration();
flowConfig.addIdScan();
flowConfig.addSelfieScan();
flowConfig.addFaceMatch();

OnboardingRecordSessionConfiguration recordSessionConfig = OnboardingRecordSessionConfiguration(
  recordSession: true,
  forcePermission: false,
);

IncodeOnboardingSdk.startOnboarding(
  sessionConfig: sessionConfig,
  flowConfig: flowConfig,
  recordSessionConfig: recordSessionConfig,
  onSuccess: () {
    print('Incode Onboarding completed!');
  },
  onError: (String error) {
    print('Incode onboarding error: $error');
  },
  onSelfieScanCompleted: (SelfieScanResult result) {
    print('Selfie completed result: $result');
  },
  onIdFrontCompleted: (IdScanResult result) {
    print('onIdFrontCompleted result: $result');
  },
  onIdBackCompleted: (IdScanResult result) {
    print('onIdBackCompleted result: $result');
  },
  onIdProcessed: (String ocrData) {
    print('onIdProcessed result: $ocrData');
  },
);
```

See [Configure Flows Locally and Run End to End](./flutter-configure-flows-locally-and-run-end-to-end).

## setupOnboardingSession

Creates an onboarding session without starting any flow. Before calling any other Onboarding SDK component that operates on a session (for example, [`startNewOnboardingSection`](./flutter-api-reference#startnewonboardingsection)), you must set up an onboarding session first.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setupOnboardingSession({
  required OnboardingSessionConfiguration sessionConfig,
  required Function(OnboardingSessionResult result) onSuccess,
  required Function(String error) onError,
})
```

**Required Parameters**

- `sessionConfig`: An `OnboardingSessionConfiguration` object. Can be configured in the same way as for [`startOnboarding`](./flutter-api-reference#startonboarding).

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(OnboardingSessionResult result)`: Delivers the created session details.
- `onError(String error)`: Delivers the error message on failure.

**Example**

```dart
OnboardingSessionConfiguration sessionConfiguration = OnboardingSessionConfiguration();

IncodeOnboardingSdk.setupOnboardingSession(
  sessionConfig: sessionConfiguration,
  onError: (String error) {
    print('Incode onboarding session error: $error');
  },
  onSuccess: (OnboardingSessionResult result) {
    print('Incode Onboarding session created! $result');
  },
);
```

See [Configure Flows Locally and Run Step by Step](./flutter-configure-flows-locally-and-run-step-by-step).

## startNewOnboardingSection

Once a new onboarding session is created (see [`setupOnboardingSession`](./flutter-api-reference#setuponboardingsession)), you can separate the Onboarding SDK flow into multiple sections based on your needs. Each section runs the modules defined in its `flowConfig` and is identified by a `flowTag`.

**Signature**

```dart
IncodeOnboardingSdk.startNewOnboardingSection({
  required OnboardingFlowConfiguration flowConfig,
  required String flowTag,
  OnboardingRecordSessionConfiguration? recordSessionConfig,
  required Function(String error) onError,
  Function(String flowTag)? onOnboardingSectionCompleted,
  // ...optional per-module step callbacks (see startOnboarding)
})
```

**Required Parameters**

- `flowConfig`: An `OnboardingFlowConfiguration` object that defines which modules run in this section.
- `flowTag`: A required identifier for the section. Returned via `onOnboardingSectionCompleted`.

**Optional Parameters**

- `recordSessionConfig`: An `OnboardingRecordSessionConfiguration` object that contains the configuration for recording the session.

**Returns / Callbacks**

- `onError(String error)`: Called when an error occurs during the section.
- `onOnboardingSectionCompleted(String flowTag)`: Called when the section completes. The `flowTag` parameter contains the identifier of the completed section.
- `onUserCancelled()`: Called when the user cancels the section.
- Per-module step callbacks: This method also accepts the same optional per-module step callbacks as [`startOnboarding`](./flutter-api-reference#startonboarding) (for example, `onSelfieScanCompleted`, `onIdFrontCompleted`, `onIdBackCompleted`, `onIdProcessed`, `onFaceMatchCompleted`, `onEvents`).

**Example**

```dart
OnboardingFlowConfiguration flowConfig = OnboardingFlowConfiguration();
flowConfig.addIdScan();

IncodeOnboardingSdk.startNewOnboardingSection(
  flowConfig: flowConfig,
  flowTag: 'idSection',
  onError: (String error) {
    print('Incode onboarding session error: $error');
  },
  onIdFrontCompleted: (IdScanResult result) {
    print('onIdFrontCompleted result: $result');
  },
  onIdBackCompleted: (IdScanResult result) {
    print('onIdBackCompleted result: $result');
  },
  onIdProcessed: (String ocrData) {
    print('onIdProcessed result: $ocrData');
  },
  onOnboardingSectionCompleted: (String flowTag) {
    print('section completed');
  },
);
```

See [Configure Flows Locally and Run Step by Step](./flutter-configure-flows-locally-and-run-step-by-step).

## finishFlow

Finishes the current onboarding session for section-based flows. Call `finishFlow()` at the end of the flow, when you are sure the user has finished all onboarding modules and you won't be reusing the same `interviewId` again.

`finishFlow()` is only required for section-based flows (those started with [`startNewOnboardingSection`](./flutter-api-reference#startnewonboardingsection)). Do not call it for flows started with [`startOnboarding`](./flutter-api-reference#startonboarding).

**Signature**

```dart
Future<void> IncodeOnboardingSdk.finishFlow({
  Function()? onSuccess,
  Function(String error)? onError,
})
```

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess()`: Called when the flow is finished successfully.
- `onError(String error)`: Called when finishing the flow fails.

**Example**

```dart
IncodeOnboardingSdk.finishFlow();
```

## startFlow

Starts a server-configured Flow based on the `OnboardingSessionConfiguration` provided. Specify the `configurationId`, and optionally the `interviewId` to resume a session and/or `moduleId` to start from a specific step within the flow.

**Signature**

```dart
IncodeOnboardingSdk.startFlow({
  required OnboardingSessionConfiguration sessionConfig,
  String? moduleId,
  required Function() onSuccess,
  required Function(String error) onError,
  Function()? onUserCancelled,
  // ...optional per-module step callbacks (see startOnboarding)
})
```

**Required Parameters**

- `sessionConfig`: An `OnboardingSessionConfiguration` object. Set its `configurationId` and optionally `interviewId`.

**Optional Parameters**

- `moduleId`: Identifier of the step to start from within the flow (for example, `"PHONE"`). See [Modules](./flutter-modules) for the list of valid module IDs.

**Returns / Callbacks**

- `onSuccess()`: Called when the Flow completes successfully.
- `onError(String error)`: Called when an error occurs during the Flow.
- `onUserCancelled()`: Called when the user cancels the Flow.
- Per-module step callbacks: This method also accepts the same optional per-module step callbacks as [`startOnboarding`](./flutter-api-reference#startonboarding).

**Example**

```dart
OnboardingSessionConfiguration sessionConfig = OnboardingSessionConfiguration(
  configurationId: "YOUR_CONFIGURATION_ID",
  interviewId: "YOUR_INTERVIEW_ID", // optional
);

IncodeOnboardingSdk.startFlow(
  sessionConfig: sessionConfig,
  moduleId: 'YOUR_MODULE_ID', // optional, e.g., "PHONE"
  onError: (String error) {
    print('Incode startFlow error: $error');
  },
  onSuccess: () {
    print('Incode startFlow completed!');
  },
  onUserCancelled: () {
    print('User cancelled');
  },
);
```

See [Run Flows Configured Online](./flutter-run-flows-configured-online).

## startWorkflow

Starts a server-defined Workflow for the provided `OnboardingSessionConfiguration`. The set of modules that run is determined by the Workflow configured in Dashboard, rather than by a locally-defined `flowConfig`.

**Signature**

```dart
IncodeOnboardingSdk.startWorkflow({
  required OnboardingSessionConfiguration sessionConfig,
  required Function() onSuccess,
  required Function(String error) onError,
  Function()? onUserCancelled,
  // ...optional per-module step callbacks (see startOnboarding)
})
```

**Required Parameters**

- `sessionConfig`: An `OnboardingSessionConfiguration` object. Set its `configurationId` to point at the Workflow configured in Dashboard.

**Returns / Callbacks**

- `onSuccess()`: Called when the Workflow completes successfully.
- `onError(String error)`: Called when an error occurs during the Workflow.
- `onUserCancelled()`: Called when the user cancels the Workflow.
- Per-module step callbacks: This method also accepts the same optional per-module step callbacks as [`startOnboarding`](./flutter-api-reference#startonboarding).

**Example**

```dart
OnboardingSessionConfiguration sessionConfig = OnboardingSessionConfiguration(
  configurationId: "YOUR_CONFIGURATION_ID",
);

IncodeOnboardingSdk.startWorkflow(
  sessionConfig: sessionConfig,
  onError: (String error) {
    print('Incode startWorkflow error: $error');
  },
  onSuccess: () {
    print('Incode startWorkflow completed!');
  },
  onUserCancelled: () {
    print('User cancelled');
  },
);
```

See [Run Flows Configured Online](./flutter-run-flows-configured-online).

## faceMatch

Programmatically initiates a face match between the photo from the ID and the selfie. Matches silently in the background, in contrast to the regular `FaceMatch` module that shows UI feedback to the user. This API can only be used during an active session.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.faceMatch({
  FaceMatchType? faceMatchType,
  String? interviewId,
  IdCategory? idCategory,
  required Function() onSuccess,
  required Function(String error) onError,
  Function(FaceMatchResult faceMatchResult)? onFaceMatchCompleted,
  Function()? onUserCancelled,
})
```

**Optional Parameters**

- `faceMatchType`: `FaceMatchType.idSelfie`, `FaceMatchType.nfcSelfie`, or `FaceMatchType.nfc3Way`. Selects which sources are compared.
- `interviewId`: Identifier of the session to run the match against.
- `idCategory`: `IdCategory.primary` or `IdCategory.secondary`. Selects which scanned ID to use.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess()`: Called when the face match completes successfully.
- `onError(String error)`: Called when the operation fails.
- `onFaceMatchCompleted(FaceMatchResult result)`: Delivers the `FaceMatchResult` payload. See [Results](./flutter-results).
- `onUserCancelled()`: Called when the user cancels.

**Example**

```dart
IncodeOnboardingSdk.faceMatch(
  onError: (String error) {
    print('FaceMatch error: $error');
  },
  onSuccess: () {
    print('FaceMatch completed!');
  },
  onUserCancelled: () {
    print('FaceMatch cancelled by user.');
  },
  onFaceMatchCompleted: (FaceMatchResult result) {
    print('FaceMatch result: $result');
  },
);
```

## setTheme

Applies a custom theme to the SDK UI.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setTheme({
  required Map<String, dynamic> theme,
})
```

**Required Parameters**

- `theme`: A map describing the theme. JSON-encoded internally before being passed to the native SDK.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.

**Example**

```dart
await IncodeOnboardingSdk.setTheme(theme: {
  'primaryColor': '#0000FF',
});
```

See [Customization](./flutter-customization) for the full theme schema.

## setSdkMode

Sets the SDK operating mode, controlling whether the SDK captures data, submits it, or both.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setSdkMode({
  required SdkMode sdkMode,
})
```

**Required Parameters**

- `sdkMode`: `SdkMode.captureOnly`, `SdkMode.submitOnly`, or `SdkMode.standard`.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.

**Example**

```dart
await IncodeOnboardingSdk.setSdkMode(sdkMode: SdkMode.standard);
```

See [SDK Modes](./flutter-sdk-modes).

## showCloseButton

Displays an 'X' button on the top right of each module so the user can cancel the flow at any point.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.showCloseButton({
  required bool allowUserToCancel,
})
```

**Required Parameters**

- `allowUserToCancel`: If `true`, the close button is shown and the user can cancel the flow.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.

**Example**

```dart
IncodeOnboardingSdk.showCloseButton(allowUserToCancel: true);
```

## setLocalizationLanguage

Overrides the language used for the SDK UI strings.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setLocalizationLanguage({
  required String language,
})
```

**Required Parameters**

- `language`: The language code to use (for example, `"en"` or `"es"`). See [Customization](./flutter-customization) for the full list of supported codes.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.

**Example**

```dart
await IncodeOnboardingSdk.setLocalizationLanguage(language: 'es');
```

## setString

Overrides individual UI strings by key, allowing custom copy without changing the localization language.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setString({
  required Map<String, dynamic> strings,
})
```

**Required Parameters**

- `strings`: A map of string keys to their override values.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.

**Example**

```dart
await IncodeOnboardingSdk.setString(strings: {
  'selfie_scan_title': 'Take a selfie',
});
```

See [Customization](./flutter-customization) for platform-specific string key references.

## getUserScore

Fetches the current onboarding session user score at any point.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.getUserScore({
  UserScoreFetchMode? fetchMode,
  required Function(UserScoreResult result) onSuccess,
  required Function(String error) onError,
})
```

**Optional Parameters**

- `fetchMode`: `UserScoreFetchMode.fast` or `UserScoreFetchMode.accurate`. Controls the trade-off between speed and accuracy.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(UserScoreResult result)`: Delivers the score.
- `onError(String error)`: Called when the operation fails.

**Example**

```dart
IncodeOnboardingSdk.getUserScore(
  onSuccess: (UserScoreResult result) {
    print("userScore: $result");
  },
  onError: (String error) {
    print("userScore error: $error");
  },
);
```

## idProcess

Processes IDs programmatically without displaying a user interface (non-UI ID processing).

**Signature**

```dart
Future<void> IncodeOnboardingSdk.idProcess({
  IdCategory? idCategory,
  required Function(IdProcessResult result) onSuccess,
  required Function(String error) onError,
})
```

**Optional Parameters**

- `idCategory`: `IdCategory.primary` or `IdCategory.secondary`. Selects which ID to process.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(IdProcessResult result)`: Called when processing completes. See [Results](./flutter-results) for the `IdProcessResult` shape.
- `onError(String error)`: Called when the operation fails.

**Example**

```dart
IncodeOnboardingSdk.idProcess(
  idCategory: IdCategory.primary,
  onSuccess: (IdProcessResult result) {
    print(result);
  },
  onError: (String error) {
    print(error);
  },
);
```

## startFaceLogin

Authenticates a returning user by their face. A prerequisite for successful Face Login is that the user has an approved account with an enrolled face. Pass a `customerUUID` on the `FaceLogin` object to perform a 1:1 comparison, or omit it to perform a 1:N database lookup.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.startFaceLogin({
  required FaceLogin faceLogin,
  required Function(FaceLoginResult result) onSuccess,
  required Function(String error) onError,
})
```

**Required Parameters**

- `faceLogin`: A `FaceLogin` object describing how the login should run. For the full set of configuration parameters (authentication modes, face mask check, lenses check, log authentication, E2EE), see [Face Login](./flutter-face-login).

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(FaceLoginResult result)`: Called when the login completes. See [Results](./flutter-results) for the full `FaceLoginResult` shape.
- `onError(String error)`: Called when the login fails.

**Example**

1:1 Face Login:

```dart
IncodeOnboardingSdk.startFaceLogin(
  faceLogin: FaceLogin(customerUUID: "yourCustomerUUID"),
  onSuccess: (FaceLoginResult result) {
    print(result);
  },
  onError: (String error) {
    print(error);
  },
);
```

1:N Face Login:

```dart
IncodeOnboardingSdk.startFaceLogin(
  faceLogin: FaceLogin(),
  onSuccess: (FaceLoginResult result) {
    print(result);
  },
  onError: (String error) {
    print(error);
  },
);
```

See [Face Login](./flutter-face-login).

## addNOM151Archive

Generates and fetches a NOM-151 archive for the current session.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.addNOM151Archive({
  required Function(AddNom151Result result) onSuccess,
  required Function(String error) onError,
})
```

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(AddNom151Result result)`: Called when the archive is generated. The result contains `signature` and `archiveUrl` String fields.
- `onError(String error)`: Called when the operation fails.

**Example**

```dart
IncodeOnboardingSdk.addNOM151Archive(
  onSuccess: (AddNom151Result addNom151Result) {
    String? signature = addNom151Result.signature;
    String? archiveUrl = addNom151Result.archiveUrl;
  },
  onError: (String error) {
    print('Incode addNOM151Archive error: $error');
  },
);
```

## addFace

Adds a single identity to the local database. Used with the SDK `-l` variant for 1:N `FaceAuthMode.local` Face Login.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.addFace({
  required FaceInfo faceInfo,
  required Function(bool result) onSuccess,
  required Function(String error) onError,
})
```

**Required Parameters**

- `faceInfo`: A `FaceInfo` object containing:
  - `faceTemplate`: String. Biometric representation of a user's face.
  - `customerUUID`: String. Unique customer identifier in Incode's database.
  - `templateId`: String. Unique identifier of the biometric face representation in Incode's database.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(bool result)`: Called when the identity is added. `result` is `true` on success.
- `onError(String error)`: Called when the operation fails.

**Example**

```dart
FaceInfo faceInfo = FaceInfo(template, uuid, templateId);

IncodeOnboardingSdk.addFace(
  faceInfo: faceInfo,
  onSuccess: (bool result) {
    print(result);
  },
  onError: (String error) {
    print(error);
  },
);
```

See [Face Login](./flutter-face-login).

## removeFace

Removes a single identity from the local database.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.removeFace({
  required String customerUUID,
  required Function(bool result) onSuccess,
  required Function(String error) onError,
})
```

**Required Parameters**

- `customerUUID`: The unique customer identifier of the identity to remove.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(bool result)`: Called when the identity is removed. `result` is `true` on success.
- `onError(String error)`: Called when the operation fails.

**Example**

```dart
IncodeOnboardingSdk.removeFace(
  customerUUID: "your_customer_uuid",
  onSuccess: (bool result) {
    print(result);
  },
  onError: (String error) {
    print(error);
  },
);
```

See [Face Login](./flutter-face-login).

## getFaces

Fetches all currently stored identities from the local database.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.getFaces({
  required Function(List<FaceInfo> result) onSuccess,
  required Function(String error) onError,
})
```

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(List<FaceInfo> result)`: Called with the list of stored identities.
- `onError(String error)`: Called when the operation fails.

**Example**

```dart
IncodeOnboardingSdk.getFaces(
  onSuccess: (List<FaceInfo> faceInfos) {
    print("faceInfos: $faceInfos");
  },
  onError: (String error) {
    print(error);
  },
);
```

See [Face Login](./flutter-face-login).

## setFaces

Replaces the local database with the provided list of identities. Wipes all currently stored identities before adding the new ones. Pass an empty list to clear the database.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setFaces({
  required List<FaceInfo> faces,
  required Function(bool result) onSuccess,
  required Function(String error) onError,
})
```

**Required Parameters**

- `faces`: The list of `FaceInfo` objects to store. Pass an empty list (`List.empty()`) to clear the database.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(bool result)`: Called when the identities are stored. `result` is `true` on success.
- `onError(String error)`: Called when the operation fails.

**Example**

Replace existing identities with a new set:

```dart
final faceInfos = <FaceInfo>[
  FaceInfo("your_face_template", "your_customer_uuid", "your_template"),
  FaceInfo("your_face_template2", "your_customer_uuid2", "your_template2"),
];

IncodeOnboardingSdk.setFaces(
  faces: faceInfos,
  onSuccess: (bool result) {
    print("result: $result");
  },
  onError: (String error) {
    print(error);
  },
);
```

Clear the local database by passing an empty list:

```dart
IncodeOnboardingSdk.setFaces(
  faces: List.empty(),
  onSuccess: (bool result) {
    print("result: $result");
  },
  onError: (String error) {
    print(error);
  },
);
```

See [Face Login](./flutter-face-login).

## getUserOCRData

Fetches the user OCR data for a specific session.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.getUserOCRData({
  String? token,
  required Function(GetUserOCRDataResult result) onSuccess,
  required Function(String error) onError,
})
```

**Optional Parameters**

- `token`: Session token identifying the session to fetch OCR data for.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.
- `onSuccess(GetUserOCRDataResult result)`: Called with the OCR data. The result's `ocrData` String field contains the full OCR data in JSON format.
- `onError(String error)`: Called when the operation fails.

**Example**

```dart
IncodeOnboardingSdk.getUserOCRData(
  token: "{SESSION_TOKEN}",
  onSuccess: (GetUserOCRDataResult result) {
    print(result);
  },
  onError: (String error) {
    print(error);
  },
);
```

## setFaceAuthenticationHint

Provides an identity hint to speed up face authentication by indicating which identity is expected.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setFaceAuthenticationHint({
  required String identityId,
})
```

**Required Parameters**

- `identityId`: The identifier of the identity to hint at.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.

**Example**

```dart
await IncodeOnboardingSdk.setFaceAuthenticationHint(identityId: 'your_identity_id');
```

## setUXConfig

Applies a custom UX configuration to the SDK.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.setUXConfig({
  required Map<String, dynamic> jsonConfig,
})
```

**Required Parameters**

- `jsonConfig`: A map describing the UX configuration. JSON-encoded internally before being passed to the native SDK.

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the native call resolves.

**Example**

```dart
await IncodeOnboardingSdk.setUXConfig(jsonConfig: {
  'showProgressBar': true,
});
```

For the supported UX configuration keys, see the [Android customization guide](./android-sdk) or the [iOS customization guide](./ios-sdk).

## deleteLocalUserData

Deletes all locally stored user data on the device.

**Signature**

```dart
Future<void> IncodeOnboardingSdk.deleteLocalUserData()
```

**Returns / Callbacks**

- Returns a `Future<void>` that completes once the data has been deleted.

**Example**

```dart
await IncodeOnboardingSdk.deleteLocalUserData();
```

See [Delete Local Session Data](./flutter-delete-local-session-data).
