Detect whether a document is supported
There are two distinct questions you might ask:
- Is this document type supported by BlinkID at all?
- Did the SDK classify the document it just processed, and as what?
Is the document type supported by BlinkID
BlinkID supports a large, continuously growing catalog of identity documents. The authoritative answer to "can BlinkID read this document" is the published list of supported documents. See Supported documents for the full catalog.
At runtime, you find out that a document is not supported through the per-frame processing status.
After processing an image, read inputImageAnalysisResult.processingStatus.
A value of unsupported-document means the recognizer does not support the document in the frame.
The same status also appears when a document is supported by BlinkID but excluded by a document class filter you configured. From the SDK's perspective these are indistinguishable: in both cases the document is "unsupported" relative to what the current session will accept. See How to restrict documents for that case.
- Web (TS)
- Android (Kotlin)
- iOS (Swift)
const processResult = await session.process(imageData);
const status = processResult.inputImageAnalysisResult.processingStatus;
if (status === "unsupported-document") {
console.log("This document is not supported.");
}
val processResult = session.process(inputImage).getOrThrow()
val status = processResult.inputImageAnalysisResult.processingStatus
if (status == ProcessingStatus.UnsupportedDocument) {
println("This document is not supported.")
}
let frameResult = try await session.process(inputImage: inputImage)
let status = frameResult.processResult?.inputImageAnalysisResult.processingStatus
if status == .unsupportedDocument {
print("This document is not supported.")
}
Inspect what the SDK classified
When BlinkID does support and recognize a document, the result has a documentClassInfo structure describing what was classified.
In documentClassInfo, check the countryName and documentType for your main source of information.
Check the supported documents to understand which values you can get for country/type.
- Web (TS)
- Android (Kotlin)
- iOS (Swift)
const result = await session.getResult();
const classInfo = result.documentClassInfo;
console.log("Country:", classInfo?.countryName);
console.log("Type:", classInfo?.documentType?.id);
val result = session.getResult().getOrNull()
val classInfo = result?.documentClassInfo
println("Country: ${classInfo?.countryName}")
println("Type: ${classInfo?.documentType?.id}")
let result = session.getResult()
let classInfo = result?.documentClassInfo
print("Country:", classInfo?.countryName ?? "")
print("Type:", String(describing: classInfo?.documentType?.documentTypeId))