Skip to main content
Tuteliq validates documents at three levels: document number algorithms, MRZ check digits, and barcode data extraction. Each layer independently verifies the document’s integrity, and all layers are cross-referenced against each other.

Document number validation

Tuteliq validates document numbers using the actual government-defined algorithm for each country — not just format checks. This means a forged document with a made-up number that looks correct will still fail validation.

Supported countries (45)

Americas (8)

Brazil (CPF), Argentina (DNI), Mexico (CURP), Chile (RUT), Colombia (CC), Peru (DNI), Ecuador (CI), Uruguay (CI), Canada (SIN), United States (SSN)

Europe (22)

Sweden (personnummer), Spain (DNI/NIE), Netherlands (BSN), Portugal (NIF), Germany (Steuer-ID), France (NIR), Italy (Codice Fiscale), Belgium (NRN), Finland (PIC), Norway (fnr), Poland (PESEL), UK (NI Number), Ireland (PPS), Switzerland (AHV), Austria (SVNr), Czech Republic (RC), Romania (CNP), Croatia (OIB), Bulgaria (EGN), Greece (AFM), Hungary (Tax ID), Estonia, Lithuania, Latvia

Asia-Pacific (9)

Thailand (ID), Turkey (TC Kimlik), South Korea (RRN), India (Aadhaar), China (ID), Taiwan (ID), Japan (My Number), Australia (TFN), New Zealand (IRD)

Middle East & Africa (2)

Israel (ID), South Africa (ID)

Validation algorithms

Each country uses a specific check digit algorithm. Some examples:
CountryDocumentAlgorithm
BrazilCPFWeighted mod 11, two check digits
SwedenPersonnummerLuhn algorithm on 10-digit form + date validation
IndiaAadhaarVerhoeff algorithm (dihedral group D5)
SpainDNI/NIEMod 23 letter check
GermanySteuer-IDISO 7064 Mod 11,10
FranceNIRMod 97 (BigInt arithmetic for 15-digit numbers)
ItalyCodice FiscaleOdd/even position lookup with omocodia handling
BelgiumNRNMod 97 with century detection
CroatiaOIBISO 7064 Mod 11,10
SwitzerlandAHVEAN-13 barcode check digit
USSSNArea/group/serial validation + known invalid rejection
Document number validation is automatic — when a document number and country code are detected, the appropriate algorithm runs without any configuration.

MRZ validation (ICAO 9303)

The Machine Readable Zone (MRZ) is present on passports and many national ID cards worldwide. Tuteliq implements full ICAO 9303 MRZ parsing with check digit validation.

Supported formats

FormatLinesCharactersUsed in
TD32 lines44 chars eachPassports
TD22 lines36 chars eachID cards (some countries)
TD13 lines30 chars eachID cards (most countries)

What gets validated

Each MRZ contains multiple fields, each protected by its own check digit using the ICAO weighted mod-7 algorithm (weights cycle [7, 3, 1]):
FieldCheck digitWhat it catches
Document numberPer-fieldAltered document number
Date of birthPer-fieldAltered birth date
Expiry datePer-fieldAltered expiry date
Personal numberPer-fieldAltered personal data
CompositeAcross all fieldsAny tampering across the entire MRZ
The composite check digit is critical — even if someone correctly recalculates individual field check digits after altering a value, the composite check will fail unless they also recalculate it.

Extracted fields

When a valid MRZ is detected, Tuteliq extracts and returns:
  • Document number (with validation status)
  • Nationality / issuing state
  • Date of birth (with century detection)
  • Expiry date
  • Sex
  • Surname and given names
  • Personal number / optional data
All extracted fields are cross-referenced against OCR text from the visible part of the document.

PDF417 barcode reading

US and Canadian driver’s licenses encode all personal data in a PDF417 barcode on the back of the card following the AAMVA (American Association of Motor Vehicle Administrators) standard.

Why barcodes matter

The barcode data is independent of the printed text on the front. A forger who edits the front of a driver’s license (changing the name, DOB, or photo) must also modify the barcode — which requires specialized knowledge. Most forgeries only edit the visual side. When both sides are provided, Tuteliq:
  1. Decodes the PDF417 barcode from the back image
  2. Parses AAMVA fields (name, DOB, expiry, license number, sex, address, state)
  3. Cross-references barcode data against OCR text from the front
  4. Flags any mismatch as potential tampering
  5. Falls back to barcode DOB/expiry when OCR fails to extract them

Extracted AAMVA fields

FieldAAMVA CodeDescription
First nameDAC/DCTGiven name
Last nameDCS/DABSurname
Date of birthDBBMMDDYYYY format
Expiration dateDBAMMDDYYYY format
Document numberDAQLicense/ID number
SexDBC1=Male, 2=Female
AddressDAG/DAI/DAJ/DAKStreet, city, state, postal code
CountryDCGIssuing country

Supported barcodes

FormatUsed in
PDF417US/Canadian driver’s licenses (primary target)
QR CodeSome international ID cards
DataMatrixSome European ID cards
For best barcode reading results, provide the back of the document as a separate image using the document_back field. This allows dedicated barcode scanning without the front-side OCR processing interfering.

How the layers work together

Document Image
     |
     v
  +---------+     +----------+     +----------+
  |   OCR   |     |   MRZ    |     | Barcode  |
  | (labels)|     | (ICAO)   |     | (PDF417) |
  +---------+     +----------+     +----------+
     |                 |                 |
     v                 v                 v
  Name, DOB,      Name, DOB,       Name, DOB,
  Doc Number,     Doc Number,      Doc Number,
  Expiry,         Nationality,     Expiry,
  Country         Expiry, Sex      State
     |                 |                 |
     +---------+-------+---------+-------+
               |                 |
               v                 v
        Cross-Reference    Algorithmic
         All Sources       Validation
               |                 |
               v                 v
          Flag Any           Verify
         Mismatches        Check Digits
Any inconsistency between sources generates a specific failure reason that is included in the API response.

Next steps

Liveness Detection

How visual liveness prevents spoofing attacks.

Fraud Prevention

Multi-layer cross-referencing and authenticity analysis.