# 4️⃣ De-Enrollment

De-enrollment is the biometric equivalent of an account deletion. Keyless performs an [authentication](/consumer/mobile-sdk-guide/authentication.md) to compare the user's facial biometrics with the ones computed during [enrollment](/consumer/mobile-sdk-guide/enrollment.md). If the biometrics match, the user is authenticated and their account will be removed from Keyless. This operation is **irreversible**.

{% tabs %}
{% tab title="Android" %}

```kotlin
val configuration = BiomDeEnrollConfig()

Keyless.deEnroll(
    deEnrollmentConfiguration = configuration,
    onCompletion = { result ->
        when (result) {
            is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "De-enroll success")
            is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "De-enroll failure - error code ${result.error.code}")
        }
    }
)
```

{% endtab %}

{% tab title="iOS" %}

```swift
let configuration = BiomDeEnrollConfig()
    .build()

Keyless.deEnroll(
    deEnrollmentConfiguration: configuration,
    onCompletion: { error in
        if let error = error {
              print("De-Enrollment finished with error: \(error.message)")
        } else {
              print("De-Enrollment finished with success")
        }
    }
}
```

{% endtab %}

{% tab title="Android 4.6" %}

```kotlin
val configuration = DeEnrollmentConfiguration.builder.build()

Keyless.deEnroll(
    deEnrollmentConfiguration = configuration,
    onCompletion = { result ->
        when (result) {
            is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "De-enroll success")
            is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "De-enroll failure - error code ${result.error.code}")
        }
    }
)
```

{% endtab %}

{% tab title="iOS 4.6" %}

```swift
let configuration = Keyless.DeEnrollmentConfiguration.builder
    .build()

Keyless.deEnroll(
    deEnrollmentConfiguration: configuration,
    onCompletion: { error in
        if let error = error {
              print("De-Enrollment finished with error: \(error.message)")
        } else {
              print("De-Enrollment finished with success")
        }
    }
}
```

{% endtab %}

{% tab title="Flutter" %}

```dart
import 'package:keyless_flutter_sdk/keyless.dart';
import 'package:keyless_flutter_sdk/models/configurations/deenrollment_configuration.dart';

// Biometric de-enrollment
final configuration = BiomDeEnrollConfig(
    livenessConfiguration: LivenessConfiguration.passiveStandaloneHigh,
    livenessTimeout: 60,
    cameraDelaySeconds: 0
);

// Or PIN-based de-enrollment
final configuration = PinDeEnrollConfig(
    pin: "1234"
);

try {
    await Keyless.instance.deEnroll(configuration);
    print("De-enrollment successful");
} catch (error) {
    print("De-enrollment failed: $error");
}
```

{% endtab %}

{% tab title="React Native" %}

```javascript
import Keyless, {
  BiomDeEnrollConfig,
  PinDeEnrollConfig,
  LivenessConfiguration
} from '@react-native-keyless/sdk';

// Biometric de-enrollment
const biometricDeEnroll = async () => {
  const config = new BiomDeEnrollConfig();
  const result = await Keyless.deEnroll(config);
  result.fold({
    onSuccess: () => {
      console.log('De-enrollment successful');
    },
    onFailure: (error) => {
      console.error('De-enrollment failed:', error);
    },
  });
};

// PIN-based de-enrollment
const pinDeEnroll = async () => {
  const config = new PinDeEnrollConfig('1234');
  const result = await Keyless.deEnroll(config);
  result.fold({
    onSuccess: () => {
      console.log('De-enrollment successful');
    },
    onFailure: (error) => {
      console.error('De-enrollment failed:', error);
    },
  });
};
```

{% endtab %}
{% endtabs %}

## DeEnrollment configuration

### Camera Delay

Use `cameraDelaySeconds` to specify the delay (in seconds) between when the camera preview appears, and when the liveness processing starts.

### Success Feedback

Use `showSuccessFeedback` to show a `Success` text on top of the screen when the DeEnroll is successful.

### Liveness Settings

Using `livenessConfiguration` you can configure the liveness security level during enrollment. The possible liveness configuration are under `LivenessSettings.LivenessConfiguration` :

```
DEVELOPMENT
LEVEL_1        //recommended configuration
LEVEL_2
```

You can also specify a `livenessEnvironmentAware` that is by default se to `true` to enhance liveness detection. This parameters helps to ensure the user is in a suitable setting for verification.

More details on liveness in the dedicated [liveness settings](/consumer/mobile-sdk-reference/liveness-settings.md) section.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keyless.io/consumer/mobile-sdk-guide/de-enrollment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
