---
Source: https://docs.microblink.com/blinkid/v8000/redaction
Title: Use custom redaction
Description: How to extend BlinkID's built-in redaction rules with custom per-document settings
---

# Use custom redaction

Some countries and jurisdictions require that specific fields in identity documents be redacted before any data leaves the device.
BlinkID ships with several built-in redaction rules that automatically cover some of these requirements for certain document classes.

:::note

In v8000, this feature was renamed from anonymization to **redaction**, and the API uses `Redaction` naming throughout.
See [Changes in anonymization](./migration-v8000.md#changes-in-anonymization) for the migration details.

:::

## Default redaction

Default redaction applies automatically.
When a scan completes, the SDK looks up its built-in rules for the scanned document class and applies them to the result before returning it.
For example, German ID cards have their document number redacted by default.

No action is needed to perform default redaction.

## Custom redaction

You can perform your own custom redactions.

You can either **override** the redactions if they do not apply to your legal requirements, or **add** your redactions on top of the default ones.

### Override redactions

To override default redactions, return a `RedactionSettings` object with the fields you want to resolve from your resolver.
The SDK removes the default redactions, and applies yours.

**Return `null` (web, Android) or `nil` (iOS) for all other documents to keep their defaults unchanged.**

<Tabs queryString="platform">

  <TabItem value="web" label="Web (TS)" default>

  ```typescript
  const blinkId = await createBlinkId({
    licenseKey: "...",
    redactionSettingsResolver: (classInfo) => {
      if (classInfo.country === "germany" && classInfo.type === "id") {
        return { fields: ["sex", "dateOfBirth"] };
      }
      return null; // use SDK defaults for all other documents
    },
  });
  ```

  </TabItem>
  <TabItem value="android" label="Android (Kotlin)">

  ```kotlin
  @Parcelize
  class MyRedactionResolver : RedactionSettingsResolver {
      override fun resolveRedactionSettings(classInfo: DocumentClassInfo): RedactionSettings? {
          if (classInfo.country == Country.Germany && classInfo.type == Type.Id) {
              return RedactionSettings(
                  fields = listOf(FieldType.Sex, FieldType.DateOfBirth),
                  documentNumberRedactionSettings = null
              )
          }
          return null // use SDK defaults for all other documents
      }
  }

  BlinkIdCameraScanningScreen(
      blinkIdSdk = blinkIdSdk,
      uxSettings = BlinkIdUxSettings(
          redactionSettingsResolver = MyRedactionResolver()
      ),
      onScanningSuccess = { result -> },
      onScanningCanceled = { }
  )
  ```

  </TabItem>
  <TabItem value="ios" label="iOS (Swift)">

  ```swift
  struct MyRedactionResolver: RedactionSettingsResolver {
      func resolveRedactionSettings(classInfo: DocumentClassInfo) -> RedactionSettings? {
          if classInfo.country == .germany, classInfo.documentType == .id {
              return RedactionSettings(fields: [.sex, .dateOfBirth])
          }
          return nil // use SDK defaults for all other documents
      }
  }

  let analyzer = try await BlinkIDAnalyzer(
      sdk: sdk,
      redactionSettingsResolver: MyRedactionResolver()
  )
  ```

  </TabItem>
  <TabItem value="flutter" label="Flutter (Dart)">

  ```dart
  final redactionSettingsResolver = RedactionSettingsResolver([
    RedactionSettings(
      fields: [FieldType.sex, FieldType.dateOfBirth],
      documentFilter: DocumentFilter(
        country: Country.germany,
        documentType: DocumentType.id,
      ),
    ),
    // documents that don't match keep their SDK defaults
  ]);

  await blinkIdPlugin.performScan(
    blinkIdSdkSettings: sdkSettings,
    blinkIdSessionSettings: sessionSettings,
    redactionSettingsResolver: redactionSettingsResolver,
  );
  ```

  </TabItem>
  <TabItem value="react-native" label="React Native (TS)">

  ```typescript
  const redactionSettingsResolver: RedactionSettingsResolver = {
    documentRedactionList: [
      {
        fields: [FieldType.Sex, FieldType.DateOfBirth],
        documentFilter: {
          country: Country.Germany,
          documentType: DocumentType.Id,
        },
      },
      // documents that don't match keep their SDK defaults
    ],
  };

  await performScan({ sdkSettings, sessionSettings, redactionSettingsResolver });
  ```

  </TabItem>
</Tabs>

### Add custom redactions to default ones

To extend the default redactions with additional fields, retrieve the defaults for the scanned document class inside your resolver and add your fields to the result.

<Tabs queryString="platform">

  <TabItem value="web" label="Web (TS)" default>

  ```typescript
  const blinkId = await createBlinkId({
    licenseKey: "...",
    redactionSettingsResolver: async (classInfo) => {
      const defaults = await blinkId.blinkIdCore.getDefaultRedactionSettings(classInfo);
      return {
        ...defaults,
        fields: [...defaults.fields, "sex", "dateOfBirth"],
      };
    },
  });
  ```

  </TabItem>
  <TabItem value="android" label="Android (Kotlin)">

  ```kotlin
  @Parcelize
  class MyRedactionResolver : RedactionSettingsResolver {
      override fun resolveRedactionSettings(classInfo: DocumentClassInfo): RedactionSettings? {
          val defaults = RedactionSettings.getDefaultRedactionSettings(classInfo)
          return defaults.copy(
              fields = defaults.fields + listOf(FieldType.Sex, FieldType.DateOfBirth)
          )
      }
  }
  ```

  </TabItem>
  <TabItem value="ios" label="iOS (Swift)">

  ```swift
  struct MyRedactionResolver: RedactionSettingsResolver {
      func resolveRedactionSettings(classInfo: DocumentClassInfo) -> RedactionSettings? {
          var settings = RedactionSettings.getDefaultRedactionSettings(for: classInfo)
          settings.fields += [.sex, .dateOfBirth]
          return settings
      }
  }

  let analyzer = try await BlinkIDAnalyzer(
      sdk: sdk,
      redactionSettingsResolver: MyRedactionResolver()
  )
  ```

  </TabItem>
  <TabItem value="flutter" label="Flutter (Dart)">

  ```dart
  // The Flutter wrapper doesn't expose the SDK's built-in default redaction
  // settings, so list every field you want redacted for the matched class.
  // These settings replace the defaults for that document class.
  final redactionSettingsResolver = RedactionSettingsResolver([
    RedactionSettings(
      fields: [
        FieldType.documentNumber, // default for German IDs
        FieldType.sex,
        FieldType.dateOfBirth,
      ],
      documentFilter: DocumentFilter(
        country: Country.germany,
        documentType: DocumentType.id,
      ),
    ),
  ]);

  await blinkIdPlugin.performScan(
    blinkIdSdkSettings: sdkSettings,
    blinkIdSessionSettings: sessionSettings,
    redactionSettingsResolver: redactionSettingsResolver,
  );
  ```

  </TabItem>
  <TabItem value="react-native" label="React Native (TS)">

  ```typescript
  // The React Native wrapper doesn't expose the SDK's built-in default redaction
  // settings, so list every field you want redacted for the matched class.
  // These settings replace the defaults for that document class.
  const redactionSettingsResolver: RedactionSettingsResolver = {
    documentRedactionList: [
      {
        fields: [
          FieldType.DocumentNumber, // default for German IDs
          FieldType.Sex,
          FieldType.DateOfBirth,
        ],
        documentFilter: {
          country: Country.Germany,
          documentType: DocumentType.Id,
        },
      },
    ],
  };

  await performScan({ sdkSettings, sessionSettings, redactionSettingsResolver });
  ```

  </TabItem>
</Tabs>

## Remove redactions

To disable redaction entirely, return a `RedactionSettings` object with `mode` set to `"none"` from your resolver for every document class.

<Tabs queryString="platform">

  <TabItem value="web" label="Web (TS)" default>

  ```typescript
  const blinkId = await createBlinkId({
    licenseKey: "...",
    redactionSettingsResolver: () => ({ mode: "none", fields: [] }),
  });
  ```

  </TabItem>
  <TabItem value="android" label="Android (Kotlin)">

  ```kotlin
  @Parcelize
  class NoRedactionResolver : RedactionSettingsResolver {
      override fun resolveRedactionSettings(classInfo: DocumentClassInfo): RedactionSettings? {
          return RedactionSettings(
              redactionMode = RedactionMode.None,
              fields = emptyList(),
              documentNumberRedactionSettings = null
          )
      }
  }
  ```

  </TabItem>
  <TabItem value="ios" label="iOS (Swift)">

  ```swift
  struct NoRedactionResolver: RedactionSettingsResolver {
      func resolveRedactionSettings(classInfo: DocumentClassInfo) -> RedactionSettings? {
          return RedactionSettings(mode: .none, fields: [])
      }
  }

  let analyzer = try await BlinkIDAnalyzer(
      sdk: sdk,
      redactionSettingsResolver: NoRedactionResolver()
  )
  ```

  </TabItem>
  <TabItem value="flutter" label="Flutter (Dart)">

  ```dart
  final redactionSettingsResolver = RedactionSettingsResolver([
    RedactionSettings(
      mode: RedactionMode.none,
      fields: [],
    ),
  ]);

  await blinkIdPlugin.performScan(
    blinkIdSdkSettings: sdkSettings,
    blinkIdSessionSettings: sessionSettings,
    redactionSettingsResolver: redactionSettingsResolver,
  );
  ```

  </TabItem>
  <TabItem value="react-native" label="React Native (TS)">

  ```typescript
  const redactionSettingsResolver: RedactionSettingsResolver = {
    documentRedactionList: [
      {
        mode: 'none',
        fields: [],
      },
    ],
  };

  await performScan({ sdkSettings, sessionSettings, redactionSettingsResolver });
  ```

  </TabItem>
</Tabs>

## MRZ and barcode redactions

In addition to redactions which use `mode` and `fields`, you can also use two additional flags: `redactMrz` and `redactBarcode` (boolean).

These redact the data extracted from the MRZ or barcode.

Note that this redaction doesn't propagate to the top result.
For example, if a piece of information is present both in the visual zone and the machine-readable zone, and you redact the machine-readable zone, this information will still be present in the result (unless also covered by a field in the `fields` array).

<Tabs queryString="platform">

  <TabItem value="web" label="Web (TS)" default>

  ```typescript
  const blinkId = await createBlinkId({
    licenseKey: "...",
    redactionSettingsResolver: () => ({ fields: [], redactMrz: true, redactBarcode: true }),
  });
  ```

  </TabItem>
  <TabItem value="android" label="Android (Kotlin)">

  ```kotlin
  @Parcelize
  class MyRedactionResolver : RedactionSettingsResolver {
      override fun resolveRedactionSettings(classInfo: DocumentClassInfo): RedactionSettings? {
          return RedactionSettings(
              fields = emptyList(),
              documentNumberRedactionSettings = null,
              redactMrz = true,
              redactBarcode = true
          )
      }
  }
  ```

  </TabItem>
  <TabItem value="ios" label="iOS (Swift)">

  ```swift
  struct MyRedactionResolver: RedactionSettingsResolver {
      func resolveRedactionSettings(classInfo: DocumentClassInfo) -> RedactionSettings? {
          return RedactionSettings(fields: [], redactMrz: true, redactBarcode: true)
      }
  }

  let analyzer = try await BlinkIDAnalyzer(
      sdk: sdk,
      redactionSettingsResolver: MyRedactionResolver()
  )
  ```

  </TabItem>
  <TabItem value="flutter" label="Flutter (Dart)">

  ```dart
  final redactionSettingsResolver = RedactionSettingsResolver([
    RedactionSettings(
      fields: [],
      redactMrzResult: true,
      redactBarcodeResult: true,
    ),
  ]);

  await blinkIdPlugin.performScan(
    blinkIdSdkSettings: sdkSettings,
    blinkIdSessionSettings: sessionSettings,
    redactionSettingsResolver: redactionSettingsResolver,
  );
  ```

  </TabItem>
  <TabItem value="react-native" label="React Native (TS)">

  ```typescript
  const redactionSettingsResolver: RedactionSettingsResolver = {
    documentRedactionList: [
      {
        fields: [],
        redactMrzResult: true,
        redactBarcodeResult: true,
      },
    ],
  };

  await performScan({ sdkSettings, sessionSettings, redactionSettingsResolver });
  ```

  </TabItem>
</Tabs>


Last updated on Jul 24, 2026
