Document Verification
Extracts and validates identity documents (passports, ID cards, driver's licenses).
How It Works
- User uploads a document image
- Valydar performs OCR and MRZ extraction
- Barcodes are detected and decoded (PDF417, QR, DataMatrix)
- Barcode data is cross-validated against MRZ for tampering detection
- Document format, expiry, and data consistency are validated
Upload a Document
curl -X POST https://api.dev.valydar.com/verifications/{id}/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "document_type=passport" \
document_type is required and must be one of passport, national_id,
drivers_license, or residence_permit. It is cross-checked against the MRZ
when the document carries one.
Accepted Formats
- JPEG, PNG, WebP
- Maximum size: 10 MB
Response
{
"document_id": "doc_abc123",
"type": "passport",
"status": "uploaded"
}
Result
{
"type": "identity",
"result": "passed",
"score": 0.95,
"details": {
"document_type": "passport",
"document_number": "AB1234567",
"name": "JOHN DOE",
"date_of_birth": "1990-01-15",
"nationality": "NLD",
"expiry_date": "2030-01-15",
"mrz_valid": true,
"barcodes_detected": 1,
"barcode_formats": ["pdf417"],
"barcode_cross_validation": {
"mrz_matches_barcode": true,
"discrepancies": []
}
}
}
See Barcode Detection for details on barcode formats and cross-validation.
Supported Document Types
| Type | API value | MRZ | NFC | Notes |
|---|---|---|---|---|
| Passport | passport | ✅ | ✅ | All ICAO 9303 passports |
| National ID | national_id | ✅ | ✅ | EU, UK, and many international |
| Driver's License | drivers_license | ❌ | ❌ | Format varies by country |
| Residence Permit | residence_permit | ✅ | ✅ | TD1/TD2 cards |
Tips
- Ensure the document is flat and fully visible
- Avoid glare and shadows
- Both front and back can be uploaded (for ID cards)