---
Source: https://docs.microblink.com/blinkid/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.
---

# Restrict scanning to specific document types or countries

You can restrict which documents are accepted at scan time with a [document class](./result-reference.md#document-class-info) filter.

## Add a 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>

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

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

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

  ```kotlin
  import com.microblink.blinkid.core.result.classinfo.CountryId
  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?.id == CountryId.Croatia ||
              documentClass.country?.id == CountryId.Germany
      }
  }

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

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

  ```swift
  class CountryClassFilter: BlinkIDClassFilter {
      func classAllowed(classInfo: BlinkIDSDK.DocumentClassInfo) -> Bool {
          classInfo.country?.countryId == .croatia || classInfo.country?.countryId == .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.
  A `DocumentFilter` takes `CountryID`, `RegionID`, and `DocumentTypeID` values directly, not the `id` and `rawValue` objects found on the result.

  ```dart
  final classFilter = ClassFilter.withIncludedDocumentClasses([
    DocumentFilter(country: CountryID.croatia),
    DocumentFilter(country: CountryID.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.
  Each entry takes `CountryID`, `RegionID`, and `DocumentTypeID` values directly, not the `id` and `rawValue` objects found on the result.

  ```typescript
  import { CountryID, performScan, type ClassFilter } from "@microblink/blinkid-react-native";

  const classFilter: ClassFilter = {
    includeDocuments: [
      { country: CountryID.Croatia },
      { country: CountryID.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 Oct 7, 2026
