# Modules

Modules are the building blocks of an onboarding flow. Add modules to `flowConfig` (for locally configured flows) to define what happens during onboarding, or configure them in a Flow or Workflow on the Incode Dashboard (for online-configured flows). See [Common Implementation Patterns](common-implementation-patterns) for implementation options and instructions.

Every entry in `flowConfig` is an object with a `module` key plus any parameters:

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

**Boolean and integer parameters are passed as strings.** Use `"true"` / `"false"` for booleans and quoted numerals (e.g. `"3"`) for integers. This matches how the native bridge expects them.

For the result object each module produces, see [Results](results).

## Modules

### addAntifraud

Compares the current Session against prior Sessions and known identities to detect signs of fraud.

- No additional parameters.

```js
{ module: "addAntifraud" }
```

### approve

Finalizes an onboarding flow by deciding whether to approve the user, then registers approved users in the Incode database. By default, it runs with no UI and approves silently, but you can toggle the UI, silent face match, and forced approval.

_This module runs without presenting a screen._

- No additional parameters.

```js
{ module: "approve" }
```

### CURPValidation

Validates a person's CURP (Clave Única de Registro de Población), a personal identification number issued in Mexico, against Mexico's RENAPO registry. It accepts a CURP extracted via OCR, entered manually, or generated from personal data when the user doesn't know it.

- `validationEnabled` (optional, defaults to `"true"`): string. Enable server-side CURP validation.

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

### addDocumentScan

Captures a supplementary document, such as a proof of address document, medical document, or bank statement. Users can upload a file or take a photo of the document with their device’s camera.

- `documentType` (optional, defaults to `"ADDRESS_STATEMENT"`): `"ADDRESS_STATEMENT"`, `"PAYMENT_PROOF"`, `"MEDICAL_DOC"`, `"OTHER_DOCUMENT_1"`, `"OTHER_DOCUMENT_2"`, or `"OTHER_DOCUMENT_3"`.

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

### addEKYC

Collects and verifies a user's personal identity data against authoritative data sources. This data can include the user's name, email, address, phone, tax ID, date of birth, and nationality.

- `checkName` (optional, defaults to `"false"`): string. Verify name.
- `checkEmail` (optional, defaults to `"false"`): string. Verify email.
- `checkAddress` (optional, defaults to `"false"`): string. Verify address.
- `checkPhone` (optional, defaults to `"false"`): string. Verify phone.
- `checkSsn` (optional, defaults to `"false"`): string. Verify SSN or tax ID.
- `checkDob` (optional, defaults to `"false"`): string. Verify date of birth.
- `checkNationality` (optional, defaults to `"false"`): string. Verify nationality.

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

### addEmail

Collects a user's email address and can confirm email ownership by sending a one-time password (OTP) to that address.

- `otpVerificationEnabled` (optional, defaults to `"false"`): string. Enable OTP email verification.

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

### addFaceAuthentication

Captures a returning user's face with their device’s camera and matches it against the face already enrolled for that user. It then returns a pass or fail result.

- `showTutorials` (optional, defaults to `"true"`): string. Show tutorials.
- `autoCaptureTimeout` (optional): string integer. Auto-capture timeout in seconds. Default is platform default.
- `captureAttempts` (optional): string integer. Maximum capture attempts. Default is platform default.
- `eyesClosedCheck` (optional, defaults to `"true"`): string. Check for closed eyes.&#x20;
- `headCoverCheck` (optional, defaults to `"true"`): string. Check for head coverings.&#x20;
- `lensesCheck` (optional, defaults to `"true"`): string. Check for glasses or lenses.
- `faceMaskCheck` (optional, defaults to `"true"`): string. Check for face mask.&#x20;

```js
{
  module: "addFaceAuthentication",
  showTutorials: "false",
  autoCaptureTimeout: "3",
  captureAttempts: "3"
}
```

<Callout icon="📘" theme="info">
  ### **Not the same as Face Login**

  The `addFaceAuthentication` module runs as a step inside an onboarding Flow or Workflow. To authenticate a user as a standalone capability (outside a Flow or Workflow), use [Face Login](#) and its `startFaceLogin()` method.
</Callout>

### addFaceMatch

Compare the captured selfie against the document or NFC face to confirm identity.

- `matchType` (optional, defaults to `"idSelfie"`): `"idSelfie"`, `"nfcSelfie"`, or `"nfc3Way"`.
- `showLivenessResult` (optional, defaults to `"false"`): string. Show the liveness result screen.

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

`matchType: "nfcSelfie"` or `"nfc3Way"` requires `addNFC` to have run first (NFC plugin variant).

<Callout icon="📘" theme="info">
  ### **Not the same as&#x20;**`faceMatch`

  The `addFaceMatch` module presents UI to the user. The non-UI [`faceMatch`](#facematch) module performs a server-side face match without any UI.
</Callout>

### faceMatch

Compares the user's selfie against their ID photo, their NFC chip photo, or both in a 3-way match. It then returns a confidence score.

_This module runs without presenting a screen._

- No additional parameters.

```js
{ module: "faceMatch" }
```

<Callout icon="📘" theme="info">
  ### **Not the same as&#x20;**`addFaceMatch`

  The non-UI `faceMatch` module performs a server-side face match without any UI. The UI [`addFaceMatch`](#addfacematch) module presents UI to the user during the flow.
</Callout>

A standalone [`faceMatch()`](api-reference#facematch) API is also available.

### addGeolocation

Requests location permission, then captures the precise physical location of the user's device, using its GPS sensor to record coordinates and location fields such as country, state, and city.

- `isSkippable` (optional, defaults to `"false"`): string. Allow the user to skip geolocation. When `"true"`, skipping or denying location permission advances the flow instead of ending the session with a permission error.

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

Requires the `cordova-plugin-geolocation` or `@capacitor/geolocation` companion plugin.

### addGovernmentValidation

Validates identity data extracted from a user's ID against an authoritative government registry. The process runs in the background and isn't visible to the user.

- No additional parameters.

```js
{ module: "addGovernmentValidation" }
```

### addId

Captures the front and back of a government-issued ID, with auto-capture and quality checks, and produces clean images for processing.

- `showTutorials` (optional, defaults to `"true"`): string. Show capture tutorials.
- `waitForTutorials` (optional, defaults to `"true"`): string. Wait for tutorial animation.
- `idCategory` (optional, defaults to `"FIRST"`): `"FIRST"` or `"SECOND"`.
- `idType` (optional): `"id"` or `"passport"`. Default is not set (user chooses).
- `showIdTypeChooser` (optional, defaults to `"true"`): string. Show the document type chooser screen. When `"false"`, hides the chooser and requires that `idType` is set or configured on the dashboard.
- `enableFrontShownAsBackCheck` (optional, defaults to `"false"`): string. Detect front shown as back.
- `enableBackShownAsFrontCheck` (optional, defaults to `"false"`): string. Detect back shown as front.

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

`addId` automatically adds `processId` internally. Do not add `processId` as a separate module. This module produces `frontIdData`, `backIdData`, and `processIdData` results.

Document chooser visibility is controlled only by `showIdTypeChooser` or the Dashboard setting. Setting `idType` alone does not hide the chooser.

### addMachineLearningConsent

Captures the user's consent to process their biometric data for machine-learning purposes. It records their response on the server. You choose the consent text variant (US or GDPR style) that matches your compliance needs.

- `consentType` (optional, defaults to `"US"`): `"US"` or `"GDPR"`.

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

### addNFC

Reads the secure NFC chip embedded in ICAO 9303-compliant travel documents, such as e-passports. It then returns the document holder's data, including the chip's portrait image.

> **Available only in the NFC plugin variant** (`-nfc` suffix) and only on NFC-capable hardware. See [Installation](installation) for how to install the NFC variant.

- `idType` (optional): `"id"` or `"passport"`. Default is platform default.
- `showNFCSymbolConfirmationScreen` (optional, defaults to `"true"`): string. Show NFC symbol screen.
- `showInitialDataConfirmationScreen` (optional, defaults to `"true"`): string. Show data confirmation screen.
- `processNFCData` (optional, defaults to `"true"`): string. Process NFC data server-side.

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

### addPhone

Collects a user's phone number and can confirm phone ownership by sending a one-time password (OTP) via SMS.

- No additional parameters.

```js
{ module: "addPhone" }
```

### addSelfieScan

Captures a user’s face with their device’s camera and runs configurable liveness, face recognition, and image quality checks. It can enroll new users so their face can be matched against an ID photo or used for later authentication. It can also log in returning users using 1:1 or 1:N face authentication.

- `showTutorials` (optional, defaults to `"true"`): string. Show selfie tutorials.
- `waitForTutorials` (optional, defaults to `"true"`): string. Wait for tutorial animation.
- `cameraFacing` (optional, defaults to `"FRONT"`): `"FRONT"` or `"BACK"`.
- `maskCheckEnabled` (optional, defaults to `"true"`): string. Enforce face mask check.&#x20;
- `lensesCheckEnabled` (optional, defaults to `"false"`): string. Check for glasses or lenses.
- `headCoverCheckEnabled` (optional, defaults to `"false"`): string. Check for head coverings.
- `eyesClosedCheckEnabled` (optional, defaults to `"false"`): string. Check for closed eyes.&#x20;

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

### addSignature

Captures a signature the user hand-draws on screen. It is typically placed at the end of a verification journey to capture explicit consent.

- No additional parameters.

```js
{ module: "addSignature" }
```

### addUserConsent

Shows a custom consent agreement for the user to accept or reject.

- `title` (required): string. Consent screen title.
- `content` (required): string. Consent body text.

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

### userScore

Fetch the identity verification score inline as part of a section.

_This module runs without presenting a screen._

- `mode` (optional): `"fast"` or `"accurate"`.

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

The score can also be fetched outside a section via the [`getUserScore()`](api-reference#getuserscore) API.

### addVideoSelfie

Records a short video of the user performing a guided series of actions, including capturing their ID and selfie, to confirm physical presence and run liveness and face match checks. It can also capture voice consent.

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

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

Set the voice consent language via the `voiceConsentLanguage` field of `sessionConfig` (`"en"`, `"es"`, `"pt"`, `"he"`).

## Module interdependencies

The order of modules in `flowConfig` is the execution order.

- `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 and 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` (plus `addFaceMatch`) for new-user enrollment and `addFaceAuthentication` to re-authenticate an existing user.

`finishOnboarding` is not a module. To finalize a session, call the [`finishOnboarding()`](api-reference#finishonboarding) API directly.
