---
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

{/* TODO: this is, I think, poorly written, and should be rewritten or better explained. Not yet sure how. */}

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>
</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
