Modules are the building blocks of an onboarding flow. They are passed in the `flowConfig` array (used by [`startOnboarding`](https://developer.incode.com/docs/cordova-api-reference#startonboarding) and [`startOnboardingSection`](https://developer.incode.com/docs/cordova-api-reference#startonboardingsection)), each as an object with a `module` key plus any parameters:

```javascript
{ module: "addId", showIdTypeChooser: "false", idType: "passport" }
```

> **All boolean parameters are passed as strings** (`"true" / "false"), and all integer parameters are passed as strings too (e.g. "3"). This matches how the native bridge expects them.

For the result object each module produces, see [Results](https://developer.incode.com/docs/cordova-results).

## UI Modules

### addPhone

**What it does:** Collects and verifies the user's phone number.

**When to use:** When you need a phone number as part of identity collection.

**Parameters**

- None.

JavaScript

```javascript
{ module: "addPhone" }
```

### addEmail

**What it does:** Collects the user's email address, optionally verifying it via OTP.

**When to use:** When you need an email address, optionally with verification.

**Parameters**

- `otpVerificationEnabled`: Enable OTP email verification. String `"true"/"false"`. Default is `"false"`.

JavaScript

```javascript
{ module: "addEmail", otpVerificationEnabled: "true" }
```

### addGeolocation

**What it does:** Captures the user's geolocation and derived address fields.

**When to use:** When you need to capture the user's location/address.

**Parameters**

- `isSkippable`: Allow user to skip geolocation. When `true`, skipping or denying location permission advances the flow instead of ending the session with a permission error. String `"true"/"false"`. Default is `"false"`.

JavaScript

```javascript
{ module: "addGeolocation", isSkippable: "true" }
```

**Note:** Requires the `cordova-plugin-geolocation` companion plugin.

### addUserConsent

**What it does:** Displays a consent screen with a custom title and body and records the user's response.

**When to use:** When you need explicit user consent (e.g. terms, privacy policy).

**Parameters**

- `title`: Consent screen title. String, required.
- `content`: Consent body text. String, required.

JavaScript

```javascript
{ module: "addUserConsent", title: "Privacy Policy", content: "I agree to the terms..." }
```

### addMachineLearningConsent

**What it does:** Captures consent for machine-learning / biometric processing under the chosen legal framework.

**When to use:** When you must collect ML/biometric consent (e.g. US BIPA or GDPR).

**Parameters**

- `consentType`: `"US"` or `"GDPR"`. Default is `"US"`.

JavaScript

```javascript
{ module: "addMachineLearningConsent", consentType: "GDPR" }
```

### addId

**What it does:** Captures and processes the user's identity document (front and back). Automatically adds `processId` internally to extract OCR data.

**When to use:** Whenever you need ID document capture and OCR. This is the core document step.

**Parameters**

- `showTutorials`: Show capture tutorials. String `"true"/"false"`. Default is `"true"`.
- `waitForTutorials`: Wait for tutorial animation. String `"true"/"false"`. Default is `"true"`.
- `idCategory`: `"FIRST"` or `"SECOND"`. Default is `"FIRST"`.
- `idType`: `"id"` or `"passport"`. Default: not set (user chooses).
- `showIdTypeChooser`: Show document type chooser screen. When `false`, hides the chooser (you must set `idType` or configure it on the dashboard). String `"true"/"false"`. Default is `"true"`.
- `enableFrontShownAsBackCheck`: Detect front shown as back. String `"true"/"false"`. Default is `"false"`.
- `enableBackShownAsFrontCheck`: Detect back shown as front. String `"true"/"false"`. Default is `"false"`.

JavaScript

```javascript
{
  module: "addId",
  showTutorials: "true",
  waitForTutorials: "false",
  idCategory: "FIRST",
  idType: "passport",
  showIdTypeChooser: "false",
  enableFrontShownAsBackCheck: "true",
  enableBackShownAsFrontCheck: "true"
}
```

### addSelfieScan

**What it does:** Captures a selfie with liveness and configurable face checks.

**When to use:** For selfie capture in a fresh onboarding flow (e.g. before face match).

**Parameters**

- `showTutorials`: Show selfie tutorials. String `"true"/"false"`. Default is `"true"`.
- `waitForTutorials`: Wait for tutorial animation. String `"true"/"false"`. Default is `"true"`.
- `cameraFacing`: `"FRONT"` or `"BACK"`. Default is `"FRONT"`.
- `maskCheckEnabled`: Enforce face mask check. String `"true"/"false"`. Default is `"true"` (changed in 4.5.0).
- `lensesCheckEnabled`: Check for glasses/lenses. String `"true"/"false"`. Default is `"false"`.
- `headCoverCheckEnabled`: Check for head coverings. String `"true"/"false"`. Default is `"false"`.
- `eyesClosedCheckEnabled`: Check for closed eyes. String `"true"/"false"`. Default is `"false"` (added 4.5.0).

JavaScript

```javascript
{
  module: "addSelfieScan",
  showTutorials: "true",
  waitForTutorials: "false",
  maskCheckEnabled: "true",
  lensesCheckEnabled: "true",
  eyesClosedCheckEnabled: "true"
}
```

### addFaceAuthentication

**What it does:** Performs a selfie scan to authenticate a returning user against an enrolled face.

**When to use:** As a standalone authentication step. It is **not** a replacement for `addSelfieScan` in a fresh onboarding flow.

**Parameters**

- `showTutorials`: Show tutorials. String `"true"/"false"`. Default is `"true"`.
- `autoCaptureTimeout`: Auto-capture timeout in seconds. String integer. Default is platform default.
- `captureAttempts`: Max capture attempts. String integer. Default is platform default.
- `eyesClosedCheck`: Check for closed eyes. String `"true"/"false"`. Default is `"true"` (changed in 4.5.0).
- `headCoverCheck`: Check for head coverings. String `"true"/"false"`. Default is `"true"` (changed in 4.5.0).
- `lensesCheck`: Check for glasses/lenses. String `"true"/"false"`. Default is `"true"` (changed in 4.5.0).
- `faceMaskCheck`: Check for face mask. String `"true"/"false"`. Default is `"true"` (changed in 4.5.0).

JavaScript

```javascript
{
  module: "addFaceAuthentication",
  showTutorials: "false",
  autoCaptureTimeout: "3",
  captureAttempts: "3",
  eyesClosedCheck: "true",
  headCoverCheck: "true",
  lensesCheck: "true",
  faceMaskCheck: "true"
}
```

### addFaceMatch

**What it does:** Compares the captured selfie against the document or NFC face to confirm identity.

**When to use:** After capturing a selfie (and ID and/or NFC) to verify they belong to the same person.

**Parameters**

- `matchType`: `"idSelfie"`, `"nfcSelfie"`, or `"nfc3Way"`. Default is `"idSelfie"`.
- `showLivenessResult`: Show liveness result screen. String `"true"/"false"`. Default is `"false"`.

JavaScript

```javascript
{ module: "addFaceMatch", matchType: "idSelfie", showLivenessResult: "true" }
```

### addVideoSelfie

**What it does:** Records a video selfie with optional liveness, ID/document scan, and voice consent.

**When to use:** For higher-assurance flows combining video liveness with optional ID capture and voice consent.

**Parameters**

- `showTutorials`: Show tutorials. String `"true"/"false"`. Default is `"true"`.
- `selfieLivenessCheckEnabled`: Enable liveness detection. String `"true"/"false"`. Default is `"true"`.
- `selfieMode`: `"faceMatch"` or `"selfieMatch"`. Default is platform default.
- `idScanEnabled`: Enable ID scan during video. String `"true"/"false"`. Default is `"true"`.
- `idValidationEnabled`: Enable ID validation. String `"true"/"false"`. Default is platform default.
- `documentScanEnabled`: Enable document scan. String `"true"/"false"`. Default is `"false"`.
- `voiceConsentEnabled`: Enable voice consent questions. String `"true"/"false"`. Default is `"false"`.
- `voiceConsentQuestionCount`: Number of voice consent questions. Set to `"0"` to disable. String integer. Default is platform default.
- `minVideoLengthRequired`: Require minimum video length. String `"true"/"false"`. Default is platform default.
- `disableAudio`: Disable audio recording. String `"true"/"false"`. Default is `"false"`.
- `enableFrontShownAsBackCheck`: Detect front shown as back. String `"true"/"false"`. Default is `"false"`.
- `enableBackShownAsFrontCheck`: Detect back shown as front. String `"true"/"false"`. Default is `"false"`.

JavaScript

```javascript
{
  module: "addVideoSelfie",
  showTutorials: "true",
  selfieLivenessCheckEnabled: "true",
  idScanEnabled: "true",
  voiceConsentEnabled: "true",
  voiceConsentQuestionCount: "2",
  disableAudio: "false"
}
```

### addNFC

**What it does:** Reads the contactless chip (MRZ + chip data) of an ePassport or eID document.

**When to use:** When you need to read NFC chip data, e.g. for `nfcSelfie` / `nfc3Way` face match.

**Parameters**

- `idType`: `"id"` or `"passport"`. Default is platform default.
- `showNFCSymbolConfirmationScreen`: Show NFC symbol screen. String `"true"/"false"`. Default is `"true"`.
- `showInitialDataConfirmationScreen`: Show data confirmation screen. String `"true"/"false"`. Default is `"true"`.
- `processNFCData`: Process NFC data server-side. String `"true"/"false"`. Default is `"true"`.

JavaScript

```javascript
{
  module: "addNFC",
  idType: "passport",
  showNFCSymbolConfirmationScreen: "false",
  showInitialDataConfirmationScreen: "false",
  processNFCData: "false"
}
```

### addDocumentScan

**What it does:** Captures a supporting document (e.g. proof of address).

**When to use:** When you need additional documents beyond the primary ID.

**Parameters**

- `documentType`: `"ADDRESS_STATEMENT"`, `"PAYMENT_PROOF"`, `"MEDICAL_DOC"`, `"OTHER_DOCUMENT_1"`, `"OTHER_DOCUMENT_2"`, `"OTHER_DOCUMENT_3"`. Default is `"ADDRESS_STATEMENT"`.

JavaScript

```javascript
{ module: "addDocumentScan", documentType: "PAYMENT_PROOF" }
```

### addSignature

**What it does:** Captures the user's handwritten signature.

**When to use:** When you need a signature as part of the onboarding.

**Parameters**

- None.

JavaScript

```javascript
{ module: "addSignature" }
```

### addGovernmentValidation

**What it does:** Validates the captured identity against a government data source.

**When to use:** When government-source validation is required for the region.

**Parameters**

- None.

JavaScript

```javascript
{ module: "addGovernmentValidation" }
```

### addEKYC

**What it does:** Runs an electronic KYC check against the selected attributes.

**When to use:** When you need to verify specific user attributes against external data.

**Parameters**

- `checkName`: Verify name. String `"true"/"false"`. Default is `"false"`.
- `checkEmail`: Verify email. String `"true"/"false"`. Default is `"false"`.
- `checkAddress`: Verify address. String `"true"/"false"`. Default is `"false"`.
- `checkPhone`: Verify phone. String `"true"/"false"`. Default is `"false"`.
- `checkSsn`: Verify SSN / Tax ID. String `"true"/"false"`. Default is `"false"`.
- `checkDob`: Verify date of birth. String `"true"/"false"`. Default is `"false"`.
- `checkNationality`: Verify nationality. String `"true"/"false"`. Default is `"false"`.

JavaScript

```javascript
{
  module: "addEKYC",
  checkName: "true",
  checkAddress: "true",
  checkDob: "true"
}
```

### addAntifraud

**What it does:** Runs Incode's antifraud checks on the session.

**When to use:** When you want to add fraud-signal analysis to the flow.

**Parameters**

- None.

JavaScript

```javascript
{ module: "addAntifraud" }
```

### CURPValidation

**What it does:** Validates the user's CURP (Mexico's unique population registry code).

**When to use:** Mexico only.

**Parameters**

- `validationEnabled`: Enable CURP validation. String `"true"/"false"`. Default is `"true"`.

JavaScript

```javascript
{ module: "CURPValidation", validationEnabled: "true" }
```

## Non-UI Modules  
Non-UI modules run without presenting any screen. They are typically used inline within a `startOnboardingSection` `flowConfig`.

### userScore / getUserScore

**What it does:** Fetches the identity verification score inline as part of a section.

**Parameters**

- `mode`: `"fast"` or `"accurate"`.

JavaScript

```javascript
{ module: "userScore", mode: "fast" }
```

### approve

**What it does:** Approves the session server-side without UI.

**Parameters**

- None.

JavaScript

```javascript
{ module: "approve" }
```

### faceMatch (non-UI)

**What it does:** Performs a server-side face match without showing any UI.

**Parameters**

- None.

JavaScript

```javascript
{ module: "faceMatch" }
```

> **Note on `finishOnboarding`:** This is **not** a module. To finalize a session, call the [`finishOnboarding`](https://developer.incode.com/docs/cordova-api-reference#finishonboarding) API directly.

## Module Interdependencies

- **`addId` adds `processId` automatically.** Do not add `processId` as a separate module.
- **`addFaceMatch` with `matchType: "nfcSelfie"` or `"nfc3Way"` requires `addNFC` to have run first.** The selfie/NFC data must already be captured.
- **`addNFC` requires the NFC plugin variant** (`-nfc` suffix) and NFC-capable hardware.
- **`addFaceAuthentication` is a standalone authentication step**, not a replacement for `addSelfieScan` in a fresh onboarding flow. Use `addSelfieScan` (+ `addFaceMatch`) for new-user enrollment and `addFaceAuthentication` to re-authenticate an existing user.
