Skip to main content
Version: 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.

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.

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.