Skip to main content

Upgrading to v7 (web)

This guide provides technical instructions for upgrading a web application from BlinkID In-browser SDK v6 (@microblink/blinkid-in-browser-sdk) to BlinkID Web SDK v7 (@microblink/blinkid). The guide covers architectural changes, project configuration updates, API mappings, and common workflow migrations.

Foundational changes

Migrating from v6 to v7 involves more than updating package names and method calls; it requires understanding a fundamental shift in the SDK's architecture. V7 introduces a session-based model that simplifies integration by abstracting the complexities of the scanning process.

From a recognizer-centric to a session-based architecture

The most significant change in v7 is the move from a recognizer-centric architecture to a session-based one. This change simplifies the developer's role by transferring state management responsibility from the application to the SDK.

In v6, the developer was responsible for orchestrating the entire scanning process. This involved several manual steps: creating specific Recognizer objects (like BlinkIdSingleSideRecognizer or BlinkIdMultiSideRecognizer), managing them with a RecognizerRunner, and controlling the camera feed with a VideoRecognizer. For multi-side scanning, the application's code had to explicitly check the scan state (e.g., using the scanningFirstSideDone property) and implement the logic to guide the user, such as prompting them to flip the document.

V7's session-based model abstracts this complexity away. Instead of manually managing recognizers and runners, the developer interacts with a single, high-level API that controls the entire scanning session. The BlinkIdScanningSession and the bundled UX Manager now handle the complete scanning flow, including the logic for multi-side scanning. The SDK itself determines when to instruct the user to flip the document and automatically proceeds to the next step. This shift means that upgrade is not just about replacing API calls, but also about removing now-redundant state management and user-flow logic from the application code, leading to a simpler and more maintainable integration.

New modular package structure

BlinkID's distribution model has also evolved. V6 was delivered as a single, monolithic NPM package: @microblink/blinkid-in-browser-sdk.

V7 is distributed via a monorepo, BlinkID/blinkid-web, which contains several scoped NPM packages. This modular structure offers greater flexibility for different integration needs. For most use cases, the @microblink/blinkid package is the recommended choice, as it provides an all-in-one wrapper that simplifies the integration process.

For advanced use cases that require more control, developers can work directly with the underlying packages:

This guide focuses on migrating a standard v6 implementation to the all-in-one @microblink/blinkid package, which is the most direct upgrade path.

How to update your project configuration

Before modifying application code, the project's dependencies must be updated to support v7.

Update package dependencies

First, update the BlinkID package in your project's package.json file.

  "dependencies": {  
- "@microblink/blinkid-in-browser-sdk": "^6.13.0",
+ "@microblink/blinkid": "^7.3.0"
}

After updating package.json, run your package manager's install command to download the new dependencies.

npm install  
# or
yarn install
# or
pnpm install

Update resource hosting and server headers

Like v6, v7 requires WebAssembly (.wasm) and related resource files to be publicly served by your web server.

In v6, it was not possible to use multithreaded scanning if you kept your WASM resources on a different domain, for example a CDN.

However, in v7 (v7.3.1 onwards) we introduced the option to remotely host WASM resources and use multithreading.

We describe this in more detail in the Hosting resources article, but the gist of it this: you can now keep the WASM resources on a CDN, thereby reducing the size of the main web app. There are some specific things you need to look out for, such as maintaining cross-origin isolation by setting proper headers, as this is a requirement for the usage of SharedArrayBuffer.

Update SDK initialization

The initialization process in v7 is streamlined into a single async/await factory function, replacing the multi-step, promise-based approach of v6.

v6 initialization

In v6, initialization required creating WasmSDKLoadSettings, optionally setting the engineLocation, and using a .then() callback to handle the loaded SDK instance.


import * as BlinkIDSDK from "@microblink/blinkid-in-browser-sdk";

const loadSettings = new BlinkIDSDK.WasmSDKLoadSettings("YOUR_LICENSE_KEY");

// Path to v6 WASM resources
loadSettings.engineLocation = "/resources";

BlinkIDSDK.loadWasmModule(loadSettings).then(
(sdk) => {
// v6 SDK is ready
console.log("BlinkID v6 SDK loaded.", sdk);
},
(error) => {
console.error("Failed to load BlinkID v6 SDK!", error);
}
);

v7 initialization

In v7, you import the createBlinkId function. Instead of engineLocation, you can provide a resourcesLocation, but this is optional and defaults to /resources.

import { createBlinkId } from "@microblink/blinkid";

const blinkid = await createBlinkId({
// The license key is passed in an options object
licenseKey: import.meta.env.VITE_LICENCE_KEY,
});

How to map v6 settings and results to v7

To migrate your scanning logic, you need to map your existing v6 configurations and result-handling code to the new v7 structures. Some properties have been renamed; others have been changed architecturally. We will first look at the renamed settings.

Renamed settings

Several settings from the v6 recognizer objects have been renamed in the v7 ScanningSettings:

v6v7
additionalAnonymizationcustomDocumentAnonymizationSettings
allowBarcodeScanOnlyenableBarcodeScanOnly
blurStrictnessLevelblurDetectionLevel
combineFrameResultscombineResultsFromMultipleInputImages
enableBlurFilterskipImagesWithBlur
enableGlareFilterskipImagesWithGlare
glareStrictnessLevelglareDetectionLevel
paddingEdgeinputImageMargin
saveCameraFramesreturnInputImages
skipUnsupportedBackscanUnsupportedBack
validateResultCharactersenableCharacterValidation

Changes in default settings

  • paddingEdge was 0.0 in v6. In v7, the default value (for inputImageMargin) is 0.02.
  • In v6, scanPassportDataPageOnly is set to false by default. In v7, it is true by default.
  • skipUnsupportedBack was false in v6. The v7 equivalent (scanUnsupportedBack) is now also false, but since the logic is inverted ("skip" vs. "scan"), the effect is that unsupported back images are no longer scanned by default.

Settings with structural changes

As stated above, some changes are not simply renamed, but the underlying architecture has changed, and so has the structure of the settings (and the response).

The allowUnparsedMrzResults and allowUnverifiedMrzResults fields are now outdated. The MRZ parser always returns the result if it finds MRZ characters. If it cannot parse the MRZ, the returned result will be null. Similarly for the unverified MRZ results: inspect the verified boolean field in the response to check if the MRZ is valid or not. We define MRZ to be valid if check digits in the MRZ are correct.

Filtering documents

The customClassRules and allowedDocumentClasses fields are now unified in the customDocumentRules field. To filter out documents, specify a filter.

Strictness level vs. detection level

In v6, you would set a "strictness" level for blur detection or glare detection. These settings have been renamed (see table above), but their values (types) have also changed.

V6 had the following strictness levels:

  • "strict": 0
  • "normal": 1
  • "relaxed": 2

...and they were passed as integer values (0-2).

V7 introduces a global "detection level" which applies to blur, glare, and tilt.

It uses string values instead of integers, and they are as follows:

  • off
  • low
  • mid
  • high

Cropped image settings

Settings related to DPI, returning encoded (or full) document image, face image, or signature image, have been replaced with the croppedImageSettings object. The following settings are affected:

  • returnFullDocumentImage
  • returnEncodedFullDocumentImage
  • fullDocumentImageDpi
  • fullDocumentImageExtensionFactors
  • faceImageDpi
  • returnSignatureImage
  • returnEncodedSignatureImage
  • signatureImageDpi

They have been replaced with croppedImageSettings, which contains these fields:

  • dotsPerInch
  • extensionFactor
  • returnDocumentImage
  • returnFaceImage
  • returnSignatureImage

Callback settings

In v6, you declared callbacks in the settings:

  • barcodeScanningStartedCallback
  • classifierCallback

In v7, this is now handled by the @microblink/blinkid-ux-manager package, for example with the addOnResultCallback(), and others.

New settings

Worthy of note is that v7 contains some new settings that were not present in v6. For example, you can now skipImagesOccludedByHand, skipImagesWithInadequateLightingConditions, or set a tiltDetectionLevel.

You can find the full list of v7 settings in the API reference.

Result object structure

The main change in the result object is that now, the root of the object only contains fields that were actually extracted. So, no more "empty" fields. This significantly reduces the size of the object.

There is also a new subResults array. This array will contain one or two objects: one if only one side of a document has been scanned, two if both sides have been scanned. In this case, the first element (subResults[0]) corresponds to the front, and the second element (subResults[1]) corresponds to the back.

Going on, each of these objects will have sub-objects: a viz object for visual inspection zone data, and a mrz object for machine-readable zone data, as well as other optional objects.

It's worth noting that not all fields will be present in the root of the result object. All fields are present in their respective subResults object, but only some fields are propagated (copied) to the root. This way, the root serves as a summary of the full data.

See the full list of possible root values in the BlinkIdScanningResult object.

Finally, maybe the largest change is in the types. In v6, numerous fields used integers for values (for example for specific document types, or to designate a country, and so on). V7 no longer uses integers, but readable string values.

We list out specific changes in the sections below.

Renamed & relocated fields

Fields in v6 which start with front, like frontViz are now moved to their subResults counterparts. Any front result is in subResults[0] (first item in the array). Any back result is in subResults[1] (second item).

This also applies to non-prefixed fields which still refer to a front or back side in their name.

v6v7
backVizsubResults[1].viz
frontVizsubResults[0].viz
frontCameraFramesubResults[0].inputImage
backCameraFramesubResults[1].inputImage
fullDocumentFrontImagesubResults[0].documentImage
fullDocumentBackImagesubResults[1].documentImage

The following fields have also been relocated and/or renamed:

v6v7
barcodesubResults[1].barcode
classInfodocumentClassInfo
faceImageLocationsubResults[0].faceImage.location
faceImageSidesubResults[0].faceImage.side
faceImagesubResults[0].faceImage
mrzsubResults[0].mrz, subResults[1].mrz
recognitionModemode
signatureImagesubResults[0].signatureImage

barcode: structural change

In addition to being relocated to the subResults array, barcode no longer uses integers for values, but instead uses strings.

Take for example the barcodeData.barcodeFormat field:

v6v7
0doesn't apply
1qr-code
2data-matrix
3upc-e
4upc-a
5ean-8
6ean-13
7code-128
8code-39
9itf
10aztec-barcode
11pdf417-barcode

You will also find a structural change in the extendedElements array. In v6 you'd access things by the index. For example, since DocumentType is always at index 0, you'd check the first element in the array to see what the document type is. (Note: this only applied to AAMVA-compliant documents.)

In v7, extendedElements contains key:value pairs, where the key is a descriptive string for the type of field, and the value is its value. So, instead of accessing by index, you filter by key.

Extended elements: old
export enum BarcodeElementKey
{
DocumentType = 0,
StandardVersionNumber = 1,
CustomerFamilyName = 2,
CustomerFirstName = 3,
CustomerFullName = 4,
DateOfBirth = 5,
Sex = 6,
EyeColor = 7,
AddressStreet = 8,
AddressCity = 9,
AddressJurisdictionCode = 10,
AddressPostalCode = 11,
FullAddress = 12,
Height = 13,
HeightIn = 14,
HeightCm = 15,
CustomerMiddleName = 16,
HairColor = 17,
NameSuffix = 18,
AKAFullName = 19,
AKAFamilyName = 20,
AKAGivenName = 21,
AKASuffixName = 22,
WeightRange = 23,
WeightPounds = 24,
WeightKilograms = 25,
CustomerIdNumber = 26,
FamilyNameTruncation = 27,
FirstNameTruncation = 28,
MiddleNameTruncation = 29,
PlaceOfBirth = 30,
AddressStreet33 = 0,
RaceEthnicity = 32,
NamePrefix = 33,
CountryIdentification = 34,
ResidenceStreetAddress = 35,
ResidenceStreetAddress38 = 0,
ResidenceCity = 37,
ResidenceJurisdictionCode = 38,
ResidencePostalCode = 39,
ResidenceFullAddress = 40,
Under59 = 0,
Under61 = 0,
Under64 = 0,
SocialSecurityNumber = 44,
AKASocialSecurityNumber = 45,
AKAMiddleName = 46,
AKAPrefixName = 47,
OrganDonor = 48,
Veteran = 49,
AKADateOfBirth = 50,
IssuerIdentificationNumber = 51,
DocumentExpirationDate = 52,
JurisdictionVersionNumber = 53,
JurisdictionVehicleClass = 54,
JurisdictionRestrictionCodes = 55,
JurisdictionEndorsementCodes = 56,
DocumentIssueDate = 57,
FederalCommercialVehicleCodes = 58,
IssuingJurisdiction = 59,
StandardVehicleClassification = 60,
IssuingJurisdictionName = 61,
StandardEndorsementCode = 62,
StandardRestrictionCode = 63,
JurisdictionVehicleClassificationDescription = 64,
JurisdictionEndorsmentCodeDescription = 65,
JurisdictionRestrictionCodeDescription = 66,
InventoryControlNumber = 67,
CardRevisionDate = 68,
DocumentDiscriminator = 69,
LimitedDurationDocument = 70,
AuditInformation = 71,
ComplianceType = 72,
IssueTimestamp = 73,
PermitExpirationDate = 74,
PermitIdentifier = 75,
PermitIssueDate = 76,
NumberOfDuplicates = 77,
HAZMATExpirationDate = 78,
MedicalIndicator = 79,
NonResident = 80,
UniqueCustomerId = 81,
DataDiscriminator = 82,
DocumentExpirationMonth = 83,
DocumentNonexpiring = 84,
SecurityVersion = 85,
Count = 86
}
Extended elements: new
export type BarcodeElementKey =
| "document-type"
| "standard-version-number"
| "customer-family-name"
| "customer-first-name"
| "customer-full-name"
| "date-of-birth"
| "sex"
| "eye-color"
| "address-street"
| "address-city"
| "address-jurisdiction-code"
| "address-postal-code"
| "full-address"
| "height"
| "height-in"
| "height-cm"
| "customer-middle-name"
| "hair-color"
| "name-suffix"
| "aka-full-name"
| "aka-family-name"
| "aka-given-name"
| "aka-suffix-name"
| "weight-range"
| "weight-pounds"
| "weight-kilograms"
| "customer-id-number"
| "family-name-truncation"
| "first-name-truncation"
| "middle-name-truncation"
| "place-of-birth"
| "address-street-2"
| "race-ethnicity"
| "name-prefix"
| "country-identification"
| "residence-street-address"
| "residence-street-address-2"
| "residence-city"
| "residence-jurisdiction-code"
| "residence-postal-code"
| "residence-full-address"
| "under-18"
| "under-19"
| "under-21"
| "social-security-number"
| "aka-social-security-number"
| "aka-middle-name"
| "aka-prefix-name"
| "organ-donor"
| "veteran"
| "aka-date-of-birth"
| "issuer-identification-number"
| "document-expiration-date"
| "jurisdiction-version-number"
| "jurisdiction-vehicle-class"
| "jurisdiction-restriction-codes"
| "jurisdiction-endorsement-codes"
| "document-issue-date"
| "federal-commercial-vehicle-codes"
| "issuing-jurisdiction"
| "standard-vehicle-classification"
| "issuing-jurisdiction-name"
| "standard-endorsement-code"
| "standard-restriction-code"
| "jurisdiction-vehicle-classification-description"
| "jurisdiction-endorsement-code-description"
| "jurisdiction-restriction-code-description"
| "inventory-control-number"
| "card-revision-date"
| "document-discriminator"
| "limited-duration-document"
| "audit-information"
| "compliance-type"
| "issue-timestamp"
| "permit-expiration-date"
| "permit-identifier"
| "permit-issue-date"
| "number-of-duplicates"
| "hazmat-expiration-date"
| "medical-indicator"
| "non-resident"
| "unique-customer-id"
| "data-discriminator"
| "document-expiration-month"
| "document-nonexpiring"
| "security-version";

classInfo: structural change

Besides the renaming (to documentClassInfo), the information related to country, document type, and region is no longer an integer value, but a string. This is similar to the changes above.

Country
Old values
{
NONE = 0,
ALBANIA = 1,
ALGERIA = 2,
ARGENTINA = 3,
AUSTRALIA = 4,
AUSTRIA = 5,
AZERBAIJAN = 6,
BAHRAIN = 7,
BANGLADESH = 8,
BELGIUM = 9,
BOSNIA_AND_HERZEGOVINA = 10,
BRUNEI = 11,
BULGARIA = 12,
CAMBODIA = 13,
CANADA = 14,
CHILE = 15,
COLOMBIA = 16,
COSTA_RICA = 17,
CROATIA = 18,
CYPRUS = 19,
CZECHIA = 20,
DENMARK = 21,
DOMINICAN_REPUBLIC = 22,
EGYPT = 23,
ESTONIA = 24,
FINLAND = 25,
FRANCE = 26,
GEORGIA = 27,
GERMANY = 28,
GHANA = 29,
GREECE = 30,
GUATEMALA = 31,
HONG_KONG = 32,
HUNGARY = 33,
INDIA = 34,
INDONESIA = 35,
IRELAND = 36,
ISRAEL = 37,
ITALY = 38,
JORDAN = 39,
KAZAKHSTAN = 40,
KENYA = 41,
KOSOVO = 42,
KUWAIT = 43,
LATVIA = 44,
LITHUANIA = 45,
MALAYSIA = 46,
MALDIVES = 47,
MALTA = 48,
MAURITIUS = 49,
MEXICO = 50,
MOROCCO = 51,
NETHERLANDS = 52,
NEW_ZEALAND = 53,
NIGERIA = 54,
PAKISTAN = 55,
PANAMA = 56,
PARAGUAY = 57,
PHILIPPINES = 58,
POLAND = 59,
PORTUGAL = 60,
PUERTO_RICO = 61,
QATAR = 62,
ROMANIA = 63,
RUSSIA = 64,
SAUDI_ARABIA = 65,
SERBIA = 66,
SINGAPORE = 67,
SLOVAKIA = 68,
SLOVENIA = 69,
SOUTH_AFRICA = 70,
SPAIN = 71,
SWEDEN = 72,
SWITZERLAND = 73,
TAIWAN = 74,
THAILAND = 75,
TUNISIA = 76,
TURKEY = 77,
UAE = 78,
UGANDA = 79,
UK = 80,
UKRAINE = 81,
USA = 82,
VIETNAM = 83,
BRAZIL = 84,
NORWAY = 85,
OMAN = 86,
ECUADOR = 87,
EL_SALVADOR = 88,
SRI_LANKA = 89,
PERU = 90,
URUGUAY = 91,
BAHAMAS = 92,
BERMUDA = 93,
BOLIVIA = 94,
CHINA = 95,
EUROPEAN_UNION = 96,
HAITI = 97,
HONDURAS = 98,
ICELAND = 99,
JAPAN = 100,
LUXEMBOURG = 101,
MONTENEGRO = 102,
NICARAGUA = 103,
SOUTH_KOREA = 104,
VENEZUELA = 105,
AFGHANISTAN = 106,
ALAND_ISLANDS = 107,
AMERICAN_SAMOA = 108,
ANDORRA = 109,
ANGOLA = 110,
ANGUILLA = 111,
ANTARCTICA = 112,
ANTIGUA_AND_BARBUDA = 113,
ARMENIA = 114,
ARUBA = 115,
BAILIWICK_OF_GUERNSEY = 116,
BAILIWICK_OF_JERSEY = 117,
BARBADOS = 118,
BELARUS = 119,
BELIZE = 120,
BENIN = 121,
BHUTAN = 122,
BONAIRE_SAINT_EUSTATIUS_AND_SABA = 123,
BOTSWANA = 124,
BOUVET_ISLAND = 125,
BRITISH_INDIAN_OCEAN_TERRITORY = 126,
BURKINA_FASO = 127,
BURUNDI = 128,
CAMEROON = 129,
CAPE_VERDE = 130,
CARIBBEAN_NETHERLANDS = 131,
CAYMAN_ISLANDS = 132,
CENTRAL_AFRICAN_REPUBLIC = 133,
CHAD = 134,
CHRISTMAS_ISLAND = 135,
COCOS_ISLANDS = 136,
COMOROS = 137,
CONGO = 138,
COOK_ISLANDS = 139,
CUBA = 140,
CURACAO = 141,
DEMOCRATIC_REPUBLIC_OF_THE_CONGO = 142,
DJIBOUTI = 143,
DOMINICA = 144,
EAST_TIMOR = 145,
EQUATORIAL_GUINEA = 146,
ERITREA = 147,
ETHIOPIA = 148,
FALKLAND_ISLANDS = 149,
FAROE_ISLANDS = 150,
FEDERATED_STATES_OF_MICRONESIA = 151,
FIJI = 152,
FRENCH_GUIANA = 153,
FRENCH_POLYNESIA = 154,
FRENCH_SOUTHERN_TERRITORIES = 155,
GABON = 156,
GAMBIA = 157,
GIBRALTAR = 158,
GREENLAND = 159,
GRENADA = 160,
GUADELOUPE = 161,
GUAM = 162,
GUINEA = 163,
GUINEA_BISSAU = 164,
GUYANA = 165,
HEARD_ISLAND_AND_MCDONALD_ISLANDS = 166,
IRAN = 167,
IRAQ = 168,
ISLE_OF_MAN = 169,
IVORY_COAST = 170,
JAMAICA = 171,
KIRIBATI = 172,
KYRGYZSTAN = 173,
LAOS = 174,
LEBANON = 175,
LESOTHO = 176,
LIBERIA = 177,
LIBYA = 178,
LIECHTENSTEIN = 179,
MACAU = 180,
MADAGASCAR = 181,
MALAWI = 182,
MALI = 183,
MARSHALL_ISLANDS = 184,
MARTINIQUE = 185,
MAURITANIA = 186,
MAYOTTE = 187,
MOLDOVA = 188,
MONACO = 189,
MONGOLIA = 190,
MONTSERRAT = 191,
MOZAMBIQUE = 192,
MYANMAR = 193,
NAMIBIA = 194,
NAURU = 195,
NEPAL = 196,
NEW_CALEDONIA = 197,
NIGER = 198,
NIUE = 199,
NORFOLK_ISLAND = 200,
NORTHERN_CYPRUS = 201,
NORTHERN_MARIANA_ISLANDS = 202,
NORTH_KOREA = 203,
NORTH_MACEDONIA = 204,
PALAU = 205,
PALESTINE = 206,
PAPUA_NEW_GUINEA = 207,
PITCAIRN = 208,
REUNION = 209,
RWANDA = 210,
SAINT_BARTHELEMY = 211,
SAINT_HELENA_ASCENSION_AND_TRISTIAN_DA_CUNHA = 212,
SAINT_KITTS_AND_NEVIS = 213,
SAINT_LUCIA = 214,
SAINT_MARTIN = 215,
SAINT_PIERRE_AND_MIQUELON = 216,
SAINT_VINCENT_AND_THE_GRENADINES = 217,
SAMOA = 218,
SAN_MARINO = 219,
SAO_TOME_AND_PRINCIPE = 220,
SENEGAL = 221,
SEYCHELLES = 222,
SIERRA_LEONE = 223,
SINT_MAARTEN = 224,
SOLOMON_ISLANDS = 225,
SOMALIA = 226,
SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS = 227,
SOUTH_SUDAN = 228,
SUDAN = 229,
SURINAME = 230,
SVALBARD_AND_JAN_MAYEN = 231,
ESWATINI = 232,
SYRIA = 233,
TAJIKISTAN = 234,
TANZANIA = 235,
TOGO = 236,
TOKELAU = 237,
TONGA = 238,
TRINIDAD_AND_TOBAGO = 239,
TURKMENISTAN = 240,
TURKS_AND_CAICOS_ISLANDS = 241,
TUVALU = 242,
UNITED_STATES_MINOR_OUTLYING_ISLANDS = 243,
UZBEKISTAN = 244,
VANUATU = 245,
VATICAN_CITY = 246,
VIRGIN_ISLANDS_BRITISH = 247,
VIRGIN_ISLANDS_US = 248,
WALLIS_AND_FUTUNA = 249,
WESTERN_SAHARA = 250,
YEMEN = 251,
YUGOSLAVIA = 252,
ZAMBIA = 253,
ZIMBABWE = 254,
SCHENGEN_AREA = 255,
COUNT = 256
}
`New values
export type Country =
| "albania"
| "algeria"
| "argentina"
| "australia"
| "austria"
| "azerbaijan"
| "bahrain"
| "bangladesh"
| "belgium"
| "bosnia-and-herzegovina"
| "brunei"
| "bulgaria"
| "cambodia"
| "canada"
| "chile"
| "colombia"
| "costa-rica"
| "croatia"
| "cyprus"
| "czechia"
| "denmark"
| "dominican-republic"
| "egypt"
| "estonia"
| "finland"
| "france"
| "georgia"
| "germany"
| "ghana"
| "greece"
| "guatemala"
| "hong-kong"
| "hungary"
| "india"
| "indonesia"
| "ireland"
| "israel"
| "italy"
| "jordan"
| "kazakhstan"
| "kenya"
| "kosovo"
| "kuwait"
| "latvia"
| "lithuania"
| "malaysia"
| "maldives"
| "malta"
| "mauritius"
| "mexico"
| "morocco"
| "netherlands"
| "new-zealand"
| "nigeria"
| "pakistan"
| "panama"
| "paraguay"
| "philippines"
| "poland"
| "portugal"
| "puerto-rico"
| "qatar"
| "romania"
| "russia"
| "saudi-arabia"
| "serbia"
| "singapore"
| "slovakia"
| "slovenia"
| "south-africa"
| "spain"
| "sweden"
| "switzerland"
| "taiwan"
| "thailand"
| "tunisia"
| "turkey"
| "uae"
| "uganda"
| "uk"
| "ukraine"
| "usa"
| "vietnam"
| "brazil"
| "norway"
| "oman"
| "ecuador"
| "el-salvador"
| "sri-lanka"
| "peru"
| "uruguay"
| "bahamas"
| "bermuda"
| "bolivia"
| "china"
| "european-union"
| "haiti"
| "honduras"
| "iceland"
| "japan"
| "luxembourg"
| "montenegro"
| "nicaragua"
| "south-korea"
| "venezuela"
| "afghanistan"
| "aland-islands"
| "american-samoa"
| "andorra"
| "angola"
| "anguilla"
| "antarctica"
| "antigua-and-barbuda"
| "armenia"
| "aruba"
| "bailiwick-of-guernsey"
| "bailiwick-of-jersey"
| "barbados"
| "belarus"
| "belize"
| "benin"
| "bhutan"
| "bonaire-saint-eustatius-and-saba"
| "botswana"
| "bouvet-island"
| "british-indian-ocean-territory"
| "burkina-faso"
| "burundi"
| "cameroon"
| "cape-verde"
| "caribbean-netherlands"
| "cayman-islands"
| "central-african-republic"
| "chad"
| "christmas-island"
| "cocos-islands"
| "comoros"
| "congo"
| "cook-islands"
| "cuba"
| "curacao"
| "democratic-republic-of-the-congo"
| "djibouti"
| "dominica"
| "east-timor"
| "equatorial-guinea"
| "eritrea"
| "ethiopia"
| "falkland-islands"
| "faroe-islands"
| "federated-states-of-micronesia"
| "fiji"
| "french-guiana"
| "french-polynesia"
| "french-southern-territories"
| "gabon"
| "gambia"
| "gibraltar"
| "greenland"
| "grenada"
| "guadeloupe"
| "guam"
| "guinea"
| "guinea-bissau"
| "guyana"
| "heard-island-and-mcdonald-islands"
| "iran"
| "iraq"
| "isle-of-man"
| "ivory-coast"
| "jamaica"
| "kiribati"
| "kyrgyzstan"
| "laos"
| "lebanon"
| "lesotho"
| "liberia"
| "libya"
| "liechtenstein"
| "macau"
| "madagascar"
| "malawi"
| "mali"
| "marshall-islands"
| "martinique"
| "mauritania"
| "mayotte"
| "moldova"
| "monaco"
| "mongolia"
| "montserrat"
| "mozambique"
| "myanmar"
| "namibia"
| "nauru"
| "nepal"
| "new-caledonia"
| "niger"
| "niue"
| "norfolk-island"
| "northern-cyprus"
| "northern-mariana-islands"
| "north-korea"
| "north-macedonia"
| "palau"
| "palestine"
| "papua-new-guinea"
| "pitcairn"
| "reunion"
| "rwanda"
| "saint-barthelemy"
| "saint-helena-ascension-and-tristian-da-cunha"
| "saint-kitts-and-nevis"
| "saint-lucia"
| "saint-martin"
| "saint-pierre-and-miquelon"
| "saint-vincent-and-the-grenadines"
| "samoa"
| "san-marino"
| "sao-tome-and-principe"
| "senegal"
| "seychelles"
| "sierra-leone"
| "sint-maarten"
| "solomon-islands"
| "somalia"
| "south-georgia-and-the-south-sandwich-islands"
| "south-sudan"
| "sudan"
| "suriname"
| "svalbard-and-jan-mayen"
| "eswatini"
| "syria"
| "tajikistan"
| "tanzania"
| "togo"
| "tokelau"
| "tonga"
| "trinidad-and-tobago"
| "turkmenistan"
| "turks-and-caicos-islands"
| "tuvalu"
| "united-states-minor-outlying-islands"
| "uzbekistan"
| "vanuatu"
| "vatican-city"
| "virgin-islands-british"
| "virgin-islands-us"
| "wallis-and-futuna"
| "western-sahara"
| "yemen"
| "yugoslavia"
| "zambia"
| "zimbabwe"
| "schengen-area";
Region
Old values
export enum Region
{
NONE = 0,
ALABAMA = 1,
ALASKA = 2,
ALBERTA = 3,
ARIZONA = 4,
ARKANSAS = 5,
AUSTRALIAN_CAPITAL_TERRITORY = 6,
BRITISH_COLUMBIA = 7,
CALIFORNIA = 8,
COLORADO = 9,
CONNECTICUT = 10,
DELAWARE = 11,
DISTRICT_OF_COLUMBIA = 12,
FLORIDA = 13,
GEORGIA = 14,
HAWAII = 15,
IDAHO = 16,
ILLINOIS = 17,
INDIANA = 18,
IOWA = 19,
KANSAS = 20,
KENTUCKY = 21,
LOUISIANA = 22,
MAINE = 23,
MANITOBA = 24,
MARYLAND = 25,
MASSACHUSETTS = 26,
MICHIGAN = 27,
MINNESOTA = 28,
MISSISSIPPI = 29,
MISSOURI = 30,
MONTANA = 31,
NEBRASKA = 32,
NEVADA = 33,
NEW_BRUNSWICK = 34,
NEW_HAMPSHIRE = 35,
NEW_JERSEY = 36,
NEW_MEXICO = 37,
NEW_SOUTH_WALES = 38,
NEW_YORK = 39,
NORTHERN_TERRITORY = 40,
NORTH_CAROLINA = 41,
NORTH_DAKOTA = 42,
NOVA_SCOTIA = 43,
OHIO = 44,
OKLAHOMA = 45,
ONTARIO = 46,
OREGON = 47,
PENNSYLVANIA = 48,
QUEBEC = 49,
QUEENSLAND = 50,
RHODE_ISLAND = 51,
SASKATCHEWAN = 52,
SOUTH_AUSTRALIA = 53,
SOUTH_CAROLINA = 54,
SOUTH_DAKOTA = 55,
TASMANIA = 56,
TENNESSEE = 57,
TEXAS = 58,
UTAH = 59,
VERMONT = 60,
VICTORIA = 61,
VIRGINIA = 62,
WASHINGTON = 63,
WESTERN_AUSTRALIA = 64,
WEST_VIRGINIA = 65,
WISCONSIN = 66,
WYOMING = 67,
YUKON = 68,
CIUDAD_DE_MEXICO = 69,
JALISCO = 70,
NEWFOUNDLAND_AND_LABRADOR = 71,
NUEVO_LEON = 72,
BAJA_CALIFORNIA = 73,
CHIHUAHUA = 74,
GUANAJUATO = 75,
GUERRERO = 76,
MEXICO = 77,
MICHOACAN = 78,
NEW_YORK_CITY = 79,
TAMAULIPAS = 80,
VERACRUZ = 81,
CHIAPAS = 82,
COAHUILA = 83,
DURANGO = 84,
GUERRERO_COCULA = 85,
GUERRERO_JUCHITAN = 86,
GUERRERO_TEPECOACUILCO = 87,
GUERRERO_TLACOAPA = 88,
GUJARAT = 89,
HIDALGO = 90,
KARNATAKA = 91,
KERALA = 92,
KHYBER_PAKHTUNKHWA = 93,
MADHYA_PRADESH = 94,
MAHARASHTRA = 95,
MORELOS = 96,
NAYARIT = 97,
OAXACA = 98,
PUEBLA = 99,
PUNJAB = 100,
QUERETARO = 101,
SAN_LUIS_POTOSI = 102,
SINALOA = 103,
SONORA = 104,
TABASCO = 105,
TAMIL_NADU = 106,
YUCATAN = 107,
ZACATECAS = 108,
AGUASCALIENTES = 109,
BAJA_CALIFORNIA_SUR = 110,
CAMPECHE = 111,
COLIMA = 112,
QUINTANA_ROO_BENITO_JUAREZ = 113,
UINTANA_ROO = 114,
QUINTANA_ROO_SOLIDARIDAD = 115,
TLAXCALA = 116,
QUINTANA_ROO_COZUMEL = 117,
SAO_PAOLO = 118,
RIO_DE_JANEIRO = 119,
RIO_GRANDE_DO_SUL = 120,
NORTHWEST_TERRITORIES = 121,
NUNAVUT = 122,
PRINCE_EDWARD_ISLAND = 123,
DISTRITO_FEDERAL = 124,
MARANHAO = 125,
MATO_GROSSO = 126,
MINAS_GERAIS = 127,
PARA = 128,
PARANA = 129,
PERNAMBUCO = 130,
SANTA_CATARINA = 131,
ANDHRA_PRADESH = 132,
CEARA = 133,
GOIAS = 134,
GUERRERO_ACAPULCO_DE_JUAREZ = 135,
HARYANA = 136,
SERGIPE = 137,
ALAGOAS = 138,
BANGSAMORO = 139,
COUNT = 140
}
New values
export type Region =
| "alabama"
| "alaska"
| "alberta"
| "arizona"
| "arkansas"
| "australian-capital-territory"
| "british-columbia"
| "california"
| "colorado"
| "connecticut"
| "delaware"
| "district-of-columbia"
| "florida"
| "georgia"
| "hawaii"
| "idaho"
| "illinois"
| "indiana"
| "iowa"
| "kansas"
| "kentucky"
| "louisiana"
| "maine"
| "manitoba"
| "maryland"
| "massachusetts"
| "michigan"
| "minnesota"
| "mississippi"
| "missouri"
| "montana"
| "nebraska"
| "nevada"
| "new-brunswick"
| "new-hampshire"
| "new-jersey"
| "new-mexico"
| "new-south-wales"
| "new-york"
| "northern-territory"
| "north-carolina"
| "north-dakota"
| "nova-scotia"
| "ohio"
| "oklahoma"
| "ontario"
| "oregon"
| "pennsylvania"
| "quebec"
| "queensland"
| "rhode-island"
| "saskatchewan"
| "south-australia"
| "south-carolina"
| "south-dakota"
| "tasmania"
| "tennessee"
| "texas"
| "utah"
| "vermont"
| "victoria"
| "virginia"
| "washington"
| "western-australia"
| "west-virginia"
| "wisconsin"
| "wyoming"
| "yukon"
| "ciudad-de-mexico"
| "jalisco"
| "newfoundland-and-labrador"
| "nuevo-leon"
| "baja-california"
| "chihuahua"
| "guanajuato"
| "guerrero"
| "mexico"
| "michoacan"
| "new-york-city"
| "tamaulipas"
| "veracruz"
| "chiapas"
| "coahuila"
| "durango"
| "guerrero-cocula"
| "guerrero-juchitan"
| "guerrero-tepecoacuilco"
| "guerrero-tlacoapa"
| "gujarat"
| "hidalgo"
| "karnataka"
| "kerala"
| "khyber-pakhtunkhwa"
| "madhya-pradesh"
| "maharashtra"
| "morelos"
| "nayarit"
| "oaxaca"
| "puebla"
| "punjab"
| "queretaro"
| "san-luis-potosi"
| "sinaloa"
| "sonora"
| "tabasco"
| "tamil-nadu"
| "yucatan"
| "zacatecas"
| "aguascalientes"
| "baja-california-sur"
| "campeche"
| "colima"
| "quintana-roo-benito-juarez"
| "quintana-roo"
| "quintana-roo-solidaridad"
| "tlaxcala"
| "quintana-roo-cozumel"
| "sao-paolo"
| "rio-de-janeiro"
| "rio-grande-do-sul"
| "northwest-territories"
| "nunavut"
| "prince-edward-island"
| "distrito-federal"
| "maranhao"
| "mato-grosso"
| "minas-gerais"
| "para"
| "parana"
| "pernambuco"
| "santa-catarina"
| "andhra-pradesh"
| "ceara"
| "goias"
| "guerrero-acapulco-de-juarez"
| "haryana"
| "sergipe"
| "alagoas"
| "bangsamoro";
Document type
Old values
export enum DocumentType
{
NONE = 0,
CONSULAR_ID = 1,
DL = 2,
DL_PUBLIC_SERVICES_CARD = 3,
EMPLOYMENT_PASS = 4,
FIN_CARD = 5,
ID = 6,
MULTIPURPOSE_ID = 7,
MYKAD = 8,
MYKID = 9,
MYPR = 10,
MYTENTERA = 11,
PAN_CARD = 12,
PROFESSIONAL_ID = 13,
PUBLIC_SERVICES_CARD = 14,
RESIDENCE_PERMIT = 15,
RESIDENT_ID = 16,
TEMPORARY_RESIDENCE_PERMIT = 17,
VOTER_ID = 18,
WORK_PERMIT = 19,
IKAD = 20,
MILITARY_ID = 21,
MYKAS = 22,
SOCIAL_SECURITY_CARD = 23,
HEALTH_INSURANCE_CARD = 24,
PASSPORT = 25,
S_PASS = 26,
ADDRESS_CARD = 27,
ALIEN_ID = 28,
ALIEN_PASSPORT = 29,
GREEN_CARD = 30,
MINORS_ID = 31,
POSTAL_ID = 32,
PROFESSIONAL_DL = 33,
TAX_ID = 34,
WEAPON_PERMIT = 35,
VISA = 36,
BORDER_CROSSING_CARD = 37,
DRIVER_CARD = 38,
GLOBAL_ENTRY_CARD = 39,
MYPOLIS = 40,
NEXUS_CARD = 41,
PASSPORT_CARD = 42,
PROOF_OF_AGE_CARD = 43,
REFUGEE_ID = 44,
TRIBAL_ID = 45,
VETERAN_ID = 46,
CITIZENSHIP_CERTIFICATE = 47,
MY_NUMBER_CARD = 48,
CONSULAR_PASSPORT = 49,
MINORS_PASSPORT = 50,
MINORS_PUBLIC_SERVICES_CARD = 51,
DRIVING_PRIVILEGE_CARD = 52,
ASYLUM_REQUEST = 53,
DRIVER_QUALIFICATION_CARD = 54,
PROVISIONAL_DL = 55,
REFUGEE_PASSPORT = 56,
SPECIAL_ID = 57,
UNIFORMED_SERVICES_ID = 58,
IMMIGRANT_VISA = 59,
CONSULAR_VOTER_ID = 60,
TWIC_CARD = 61,
EXIT_ENTRY_PERMIT = 62,
MAINLAND_TRAVEL_PERMIT_TAIWAN = 63,
NBI_CLEARANCE = 64,
PROOF_OF_REGISTRATION = 65,
TEMPORARY_PROTECTION_PERMIT = 66,
AFGHAN_CITIZEN_CARD = 67,
EID = 68,
PASS = 69,
SIS_ID = 70,
ASIC_CARD = 71,
BIDOON_CARD = 72,
INTERIM_HEALTH_INSURANCE_CARD = 73,
NON_VOTER_ID = 74,
RECIPROCAL_HEALTH_INSURANCE_CARD = 75,
VEHICLE_REGISTRATION = 76,
ESAAD_CARD= 77,
COUNT = 78
}
New values
export type DocumentType =
| "consular-id"
| "dl"
| "dl-public-services-card"
| "employment-pass"
| "fin-card"
| "id"
| "multipurpose-id"
| "mykad"
| "mykid"
| "mypr"
| "mytentera"
| "pan-card"
| "professional-id"
| "public-services-card"
| "residence-permit"
| "resident-id"
| "temporary-residence-permit"
| "voter-id"
| "work-permit"
| "ikad"
| "military-id"
| "mykas"
| "social-security-card"
| "health-insurance-card"
| "passport"
| "s-pass"
| "address-card"
| "alien-id"
| "alien-passport"
| "green-card"
| "minors-id"
| "postal-id"
| "professional-dl"
| "tax-id"
| "weapon-permit"
| "visa"
| "border-crossing-card"
| "driver-card"
| "global-entry-card"
| "mypolis"
| "nexus-card"
| "passport-card"
| "proof-of-age-card"
| "refugee-id"
| "tribal-id"
| "veteran-id"
| "citizenship-certificate"
| "my-number-card"
| "consular-passport"
| "minors-passport"
| "minors-public-services-card"
| "driving-privilege-card"
| "asylum-request"
| "driver-qualification-card"
| "provisional-dl"
| "refugee-passport"
| "special-id"
| "uniformed-services-id"
| "immigrant-visa"
| "consular-voter-id"
| "twic-card"
| "exit-entry-permit"
| "mainland-travel-permit-taiwan"
| "nbi-clearance"
| "proof-of-registration"
| "temporary-protection-permit"
| "afghan-citizen-card"
| "eid"
| "pass"
| "sis-id"
| "asic-card"
| "bidoon-card"
| "interim-health-insurance-card"
| "non-voter-id"
| "reciprocal-health-insurance-card"
| "vehicle-registration"
| "esaad-card"
| "registration-certificate"
| "medical-marijuana-id"
| "non-card-tribal-id"
| "diplomatic-id";

dataMatchResult: structural change

The dataMatchResult's data structure has changed. In v6, it used to use integers for state:

  • 0 if data matching wasn't performed
  • 1 if data doesn't match
  • 2 if the data matches

And then a states array, with each individual field corresponding to an object with a fieldType (integer) and its own state.

In v7, we use an overallState field that returns a descriptive string value, like success, and then an array (statesPerField) with more descriptive fieldType and state values.

So:

v6v7
state (root)overallState
statesstatesPerField

For each state:

v6v7
0not-performed
1failed
2success

For each field type:

v6v7
0date-of-birth
1date-of-expiry
2document-number

V7 also introduces new field types:

  • "document-additional-number"
  • "document-optional-additional-number"
  • "personal-id-number"

recognitionMode: structural change

Besides the renaming (to mode), the structure of the field has changed. In v6, you accessed recognition modes using integers (as indices) 0–7.

We now use descriptive strings instead:

v6v7
0no longer applies
1mrz-id
2mrz-visa
3mrz-passport
4photo-id
5full-recognition
6barcode-id

Moved from result to session object

Some information is no longer available in the result object at all, but is available in the session object that can be accessed through addOnFrameProcessCallback().

For example:

import {
BlinkIdUxManager,
createBlinkIdFeedbackUi,
} from "@microblink/blinkid-ux-manager";
import {
CameraManager,
createCameraManagerUi,
} from "@microblink/camera-manager";

const uxManager = new BlinkIdUxManager(cameraManager, session);

uxManager.addOnFrameProcessCallback((processResult) => {
console.log("BlinkIdProcessResult:", processResult);
});

The following fields have been moved out of the result object:

  • additionalProcessingInfo:
    • frontAdditionalProcessingInfo
    • backAdditionalProcessingInfo
  • imageAnalysisResult
    • frontImageAnalysisResult
    • backImageAnalysisResult
  • scanningFirstSideDone

The relevant structure is explained here.


How to migrate common workflows

This section provides code examples for migrating the most common scanning workflows.

Migrate a multi-side document scan

This workflow sees the most significant simplification due to the new session-based architecture.

v6 multi-side scan

In v6, you had to create and manage a BlinkIdMultiSideRecognizer, a RecognizerRunner, and a VideoRecognizer. The multi-side scanning logic was handled manually inside the startRecognition callback by checking the scanningFirstSideDone flag.


// 1. Create Recognizer and RecognizerRunner
const multiSideGenericIDRecognizer = await BlinkIDSDK.createBlinkIdMultiSideRecognizer(sdk);
// Create a callbacks object that will receive recognition events, such as detected object location etc.
const callbacks = {
onQuadDetection: (quad) => drawQuad(quad),
onDetectionFailed: () => updateScanFeedback("Detection failed", true),

// This callback is required for multi-side experience.
onFirstSideResult: () => alert("Flip the document")
};

// 2. Create a RecognizerRunner object which orchestrates the recognition with one or more
// recognizer objects.
const recognizerRunner = await BlinkIDSDK.createRecognizerRunner(

// SDK instance to use
sdk,
// List of recognizer objects that will be associated with created RecognizerRunner object
[multiSideGenericIDRecognizer],
// [OPTIONAL] Should recognition pipeline stop as soon as first recognizer in chain finished recognition
false,
// Callbacks object that will receive recognition events
callbacks
);

// 3. Create a VideoRecognizer object and attach it to HTMLVideoElement that will be used for displaying the camera feed
const videoRecognizer = await BlinkIDSDK.VideoRecognizer.createVideoRecognizerFromCameraStream(

cameraFeed,
recognizerRunner
);

// 4. Start the recognition and get results from callback
try
{
videoRecognizer.startRecognition(

// 5. Obtain the results
async (recognitionState) =>
{
if (!videoRecognizer)
{
return;
}

// Pause recognition before performing any async operation
videoRecognizer.pauseRecognition();

if (recognitionState === BlinkIDSDK.RecognizerResultState.Empty)
{
return;
}

const result = await multiSideGenericIDRecognizer.getResult();

if (result.state === BlinkIDSDK.RecognizerResultState.Empty)
{
return;
}

// Inform the user about results
console.log("BlinkID Multi-side recognizer results", result);

v7 multi-side scan

In v7, the UXManager handles the entire UI flow, including camera management and prompts to flip the document. You don't need to handle callbacks (but can, if you wish).

const blinkid = await createBlinkId({
licenseKey: <license key>,
});

blinkid.addOnResultCallback((result) => {
console.log("Result:", result);
void blinkid.destroy();
});

Migrate still image processing

The process for scanning static images is also simplified.

v6 image processing

In v6, you used the same RecognizerRunner as for video scanning and called its processImage method.

const processResult = await recognizerRunner.processImage(imageFrame);

if (processResult !== BlinkIDSDK.RecognizerResultState.Empty) {
const result = await blinkIdRecognizer.getResult();
console.log("v6 Image processing result:", result);
}

v7 image processing

const session = await blinkIdCore.createBlinkIdScanningSession({
inputImageSource: "photo",
});

const img = new Image();
img.src = idImage;
await new Promise((resolve) => (img.onload = resolve));

const canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);

const processResult = await session.process(imageData);
console.log("Processing result:", processResult);

Migrate event and feedback handling

For developers building a custom UI, v7 replaces the v6 MetadataCallbacks with a more modern event listener model.

v6 metadata callbacks

In v6, you defined an object with callback functions (onDetectionFailed, onQuadDetection, etc.) and passed it to the RecognizerRunner using setMetadataCallbacks.

// v6 example  
// Assumes recognizerRunner is created

const metadataCallbacks = {
onDetectionFailed: () => {
// Update custom UI to show "Document not found"
},
onQuadDetection: (quad) => {
// Update custom UI to draw the detection box
}
};


recognizerRunner.setMetadataCallbacks(metadataCallbacks);

v7 event listeners

In v7, if you are using the @microblink/blinkid-ux-manager, you can use various "addOn" methods:

  • addOnUiStateChangedCallback(): for UI state changes
  • addOnResultCallback: when a final scanning result is ready
  • addOnErrorCallback: when a processing error, like a timeout, occurs
  • addOnFrameProcessCallback: for every frame that is processed
blinkid.addOnResultCallback((result) => {
console.log("Result:", result);
});