DocAuth
You can check the validity of someone’s documents through our DocAuth API.
Authorization
This endpoint requires an API token as Bearer in the Authorization header. Go to Authorization guide for details.
Request
POST https://api.biometrysolutions.com/api-gateway/v2/documents/checkHeaders
- Authorization* - Your API Token.
request part fields
| Field | Type | Description |
|---|---|---|
session_id | string | Optional. Link this transaction to a session. |
provider | string | Optional. Document authenticity provider: inhouse (our GPT-powered extraction, the default) or idscan (legacy IDScan flow). Defaults to your project configuration. |
mrz_provider | string | Optional. MRZ (Machine Readable Zone) extraction provider: inhouse or idscan. When set, the response includes MRZ parsing, check-digit validation, and cross-validation against OCR-extracted fields. See MRZ Validation below. |
File parts
- document* (formData file) — image of the document (JPEG, PNG, or JPG).
Request
curl --location 'https://api.biometrysolutions.com/api-gateway/v2/documents/check' \--header 'Authorization: Bearer YOUR_API_TOKEN' \--form 'request={"provider":"inhouse"}' \--form 'document=@"/Users/john/Desktop/IMG_0001.jpeg"'Response
The data object contains the information extracted from the document. Check the current_result field for validity:
Passed- The document is validFailed- The document is not valid
In most cases we return the data even if the document is not valid. It is up to you to decide whether you care about validity.
{ "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": "", "document_category": "National Identification Card", "current_result": "Passed", "face_image_base64": "RQWW..." }, "meta": { "request_id": "fc5605c5-...", "message": "Document uploaded successfully, looks like it's authentic" }}MRZ Validation
When you set mrz_provider in the request part, the API performs additional MRZ (Machine Readable Zone) validation. This feature:
- Extracts the MRZ from the document image (if present)
- Validates check digits using the ICAO 9303 standard algorithm
- Cross-validates MRZ data against OCR-extracted fields
- Reports discrepancies that may indicate document tampering
Supported MRZ Formats
| Format | Lines | Characters/Line | Document Type |
|---|---|---|---|
| TD1 | 3 | 30 | ID cards |
| TD2 | 2 | 36 | Some ID cards, older formats |
| TD3 | 2 | 44 | Passports |
Request with MRZ Validation
curl --location 'https://api.biometrysolutions.com/api-gateway/v2/documents/check' \--header 'Authorization: Bearer YOUR_API_TOKEN' \--form 'request={"provider":"inhouse","mrz_provider":"inhouse"}' \--form 'document=@"/Users/john/Desktop/passport.jpeg"'Response with MRZ Validation
When MRZ validation is enabled, the data object 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 } }, "meta": { "request_id": "fc5605c5-...", "message": "Document uploaded successfully, looks like it's authentic" }}MRZ Validation Fields
| Field | Type | Description |
|---|---|---|
has_mrz | boolean | Whether an MRZ was detected in the document |
raw_mrz | string | The raw MRZ text extracted from the document |
check_digits_valid | boolean | Whether all MRZ check digits are valid (ICAO 9303 algorithm) |
fields_match | boolean | Whether MRZ fields match the OCR-extracted fields |
discrepancies | array | List of specific mismatches between MRZ and OCR data |
validation_performed | boolean | Whether 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.