Skip to content

DocAuth

You can check the validity of someones documents through our DocAuth API

Authorization

This endpoint requires a API token as Bearer in the Authorization header. Go to Authorization guide for details.

Request

POST https://api.biometrysolutions.com/api-gateway/docauth/check

Headers

  • Authorization* - Your API Token.
  • X-Session-ID - Include the session ID to link transactions within a unified group.
  • X-Inhouse-Docauth - Set to "false" to use the legacy IDScan document verification flow. By default, our in-house GPT-powered extraction is used.
  • X-Inhouse-MRZ - Set to "true" to enable MRZ (Machine Readable Zone) validation. When enabled, the response includes MRZ parsing results, check digit validation, and cross-validation against OCR-extracted fields. See MRZ Validation section below.
Request
curl --location 'https://api.biometrysolutions.com/api-gateway/docauth/check' \
--header 'X-User-Fullname: John Doe' \
--form 'document=@"/Users/john/Desktop/IMG_0001.jpeg"'
Response

The response will contain information extracted from the document and a message indicating the result of the document verification. You can check the validity of the document by looking at the current_result field. In most cases we will return the data even if the document is not valid. Possible values for current_result are:

  • Passed - The document is valid
  • Failed - The document is not valid

It is up to our customers to decide if they care about the validity of the document or not.

{
"data": {
"document_type": "National Identification Card",
"country_code": "UTO",
"nationality_code": "UTO",
"nationality_name": "UTOPIAN",
"sex": "FEMALE",
"first_name": "ANNA",
"father_name": "ERIK",
"last_name": "ERIKSSON",
"expiry_date": "2028-08-03",
"document_number": "D23145890",
"birth_date": "1974-08-12",
"portrait_photo": "",
"signature": "",
"document_category": "National Identification Card",
"issuing_state": "Not available",
"front_document_type_id": "",
"contains_rfid": false,
"current_result": "Passed",
"face_image_base64": "RQWW..."
},
"message": "Document uploaded successfully, looks like it's authentic"
}

MRZ Validation

When the X-Inhouse-MRZ: true header is included, the API performs additional MRZ (Machine Readable Zone) validation. This feature:

  1. Extracts the MRZ from the document image (if present)
  2. Validates check digits using the ICAO 9303 standard algorithm
  3. Cross-validates MRZ data against OCR-extracted fields
  4. Reports discrepancies that may indicate document tampering

Supported MRZ Formats

FormatLinesCharacters/LineDocument Type
TD1330ID cards
TD2236Some ID cards, older formats
TD3244Passports

Request with MRZ Validation

curl --location 'https://api.biometrysolutions.com/api-gateway/docauth/check' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'X-Inhouse-MRZ: true' \
--form 'document=@"/Users/john/Desktop/passport.jpeg"'

Response with MRZ Validation

When MRZ validation is enabled, the response includes an additional mrz_validation object:

{
"data": {
"document_type": "Passport",
"country_code": "UTO",
"nationality_code": "UTO",
"nationality_name": "UTOPIAN",
"sex": "FEMALE",
"first_name": "ANNA MARIA",
"last_name": "ERIKSSON",
"expiry_date": "2030-12-31",
"document_number": "L898902C3",
"birth_date": "1974-08-12",
"current_result": "Passed",
"face_image_base64": "RQWW...",
"mrz_validation": {
"has_mrz": true,
"raw_mrz": "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<\nL898902C36UTO7408122F1204159ZE184226B<<<<<10",
"check_digits_valid": true,
"fields_match": true,
"discrepancies": [],
"validation_performed": true
}
},
"message": "Document uploaded successfully, looks like it's authentic"
}

MRZ Validation Fields

FieldTypeDescription
has_mrzbooleanWhether an MRZ was detected in the document
raw_mrzstringThe raw MRZ text extracted from the document
check_digits_validbooleanWhether all MRZ check digits are valid (ICAO 9303 algorithm)
fields_matchbooleanWhether MRZ fields match the OCR-extracted fields
discrepanciesarrayList of specific mismatches between MRZ and OCR data
validation_performedbooleanWhether MRZ validation was attempted

Interpreting Results

  • check_digits_valid: false - The MRZ may have been tampered with or incorrectly read. Check digits protect against manual modification.
  • fields_match: false - Discrepancies exist between the MRZ data and the visually printed fields. This could indicate document forgery.
  • has_mrz: false - No MRZ was detected. This is normal for the front side of ID cards (MRZ is typically on the back) or for documents without MRZ.