Skip to main content

Documents

Upload Document​

POST /verifications/{id}/documents

Uploads an identity document image. Runs OCR, MRZ extraction, and document validation automatically.

Request:

curl -X POST https://api.dev.valydar.com/verifications/{id}/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "document_type=passport" \
-F "file=@passport.jpg"

Form Fields:

FieldTypeRequiredDescription
document_typestring✅One of passport, national_id, drivers_license, or residence_permit
filefile✅Document image (JPEG, PNG, PDF; max 10MB)

document_type is required. When the document has a machine-readable zone, the supplied type is cross-checked against the MRZ and a mismatch fails the document check.

Response:

{
"id": "doc_a1b2c3d4e5f6",
"verification_id": "vry_xxx",
"document_type": "passport",
"filename": "passport.jpg",
"mime_type": "image/jpeg",
"width": 1920,
"height": 1080,
"file_size": 245760,
"check": {
"passed": true,
"details": {
"document_type": "passport",
"mrz": {
"document_number": "L01Y00T47",
"date_of_birth": "1990-01-15",
"date_of_expiry": "2030-01-15",
"issuing_country": "NLD",
"names": "JOHN DOE"
}
}
}
}
FieldTypeDescription
idstringDocument ID (format: doc_<uuid>)
verification_idstringParent verification ID
document_typestringpassport, national_id, drivers_license, or residence_permit
filenamestringOriginal filename
mime_typestringMIME type
widthintegerImage width in pixels
heightintegerImage height in pixels
file_sizeintegerFile size in bytes
checkobjectInline document check result

Document Types:

TypeMRZ cross-check
passportMRZ must start with P
national_idTD1/TD2 MRZ must start with I, A, or C
drivers_licenseTD1/TD2 MRZ must start with I, A, or C (where the licence carries an MRZ)
residence_permitTD1/TD2 MRZ must start with I, A, or C