---
Source: https://docs.microblink.com/blinkid/v8000/restrict-documents
Title: Restrict scanning to specific document types or countries
Description: Use a document class filter to allow only certain countries, regions, or document types during scanning with BlinkID v8000.
---

# Restrict scanning to specific document types or countries

In BlinkID v8000, you restrict which documents are accepted at scan time with a document class filter.
The filter is a predicate that runs for each detected document.
If it allows the document, scanning proceeds; if it rejects the document, the document's data is not returned, and the scan surfaces it as a filtered or unsupported document.

This filter is the v8000 replacement for the old up-front document-rule allowlists.
Instead of declaring allowed documents in configuration, you decide per detected document whether to accept it.

The filter receives a `documentClassInfo` describing the detected document.
Each platform exposes the same fields, with the naming and enum conventions of that platform.

## Add a document class filter

The following filter allows only Croatian and German documents.
Any other document is rejected.

<Tabs queryString="platform">

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

  On web, register a predicate with `addDocumentClassFilter` on the `blinkId` object returned by `createBlinkId`.
  Returning `true` allows the document; returning `false` rejects it, and the document is marked as `unsupported-document`.

  ```typescript
  const blinkId = await createBlinkId({ licenseKey: "your-license-key" });

  const cleanup = blinkId.addDocumentClassFilter((documentClassInfo) => {
    return documentClassInfo.country === "croatia" || documentClassInfo.country === "germany";
  });
  ```

  `addDocumentClassFilter` returns a cleanup function.
  Call it when you no longer want the filter to apply.

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

  On Android, implement the `ClassFilter` interface and pass an instance through `BlinkIdUxSettings`.
  `ClassFilter` is `Parcelable`, so annotate your implementation with `@Parcelize`.
  Return `true` to allow the document, `false` to filter it out.

  ```kotlin
  import com.microblink.blinkid.core.result.classinfo.Country
  import com.microblink.blinkid.core.result.classinfo.DocumentClassInfo
  import com.microblink.blinkid.ux.settings.ClassFilter
  import kotlinx.parcelize.Parcelize

  @Parcelize
  class CountryClassFilter : ClassFilter {
      override fun classAllowed(documentClass: DocumentClassInfo): Boolean {
          return documentClass.country == Country.Croatia ||
              documentClass.country == Country.Germany
      }
  }

  BlinkIdCameraScanningScreen(
      blinkIdSdk = blinkIdSdk,
      uxSettings = BlinkIdUxSettings(classFilter = CountryClassFilter()),
      onScanningSuccess = { result ->
          // use result
      },
      onScanningCanceled = { }
  )
  ```

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

  On iOS, implement the `BlinkIDClassFilter` protocol and pass an instance to `BlinkIDAnalyzer`.
  Return `true` to allow the document, `false` to filter it out.

  ```swift
  class CountryClassFilter: BlinkIDClassFilter {
      func classAllowed(classInfo: BlinkIDSDK.DocumentClassInfo) -> Bool {
          classInfo.country == .croatia || classInfo.country == .germany
      }
  }

  let analyzer = try await BlinkIDAnalyzer(
      sdk: sdk,
      classFilter: CountryClassFilter()
  )
  ```

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

  On Flutter, build a `ClassFilter` with an `includeDocuments` list of `DocumentFilter` entries and pass it to `performScan`.
  Only documents matching an entry are allowed; everything else is rejected.

  ```dart
  final classFilter = ClassFilter()
    ..includeDocuments = [
      DocumentFilter(country: Country.croatia),
      DocumentFilter(country: Country.germany),
    ];

  final result = await blinkIdPlugin.performScan(
    blinkIdSdkSettings: sdkSettings,
    blinkIdSessionSettings: sessionSettings,
    classFilter: classFilter,
  );
  ```

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

  On React Native, build a `classFilter` with an `includeDocuments` array and pass it to `performScan`.
  Only documents matching an entry are allowed; everything else is rejected.

  ```typescript
  const classFilter = {
    includeDocuments: [
      { country: Country.Croatia },
      { country: Country.Germany },
    ],
  };

  const result = await performScan({ sdkSettings, sessionSettings, classFilter });
  ```

  </TabItem>
</Tabs>

## Related articles

- [Result reference](./result-reference.md)
- [Detect whether a document is supported](./detect-supported.md)
- [How the SDK works](./how-the-sdk-works.md)


Last updated on Jul 24, 2026
