ID Document Extraction

Identity document extraction preset capturing MRZ data, biographic details, and document validity for passports, driver licenses, and national IDs.

The fields this preset extracts.

document_typestring

The primary classification of the identity document.

document_numberstring

Alphanumeric document number; preserve leading zeros exactly as printed.

mrzobject

Machine-readable zone data from the document.

surnamestring

Family name exactly as printed on the document.

given_namesstring

Given and middle names exactly as printed, space-separated if multiple.

full_namestring

Complete name for lookup purposes; combination of surname and given names.

date_of_birthstring

ISO-8601 birth date; extract from MRZ or face page, infer century if needed.

place_of_birthstring

City and country of birth if stated on the document.

nationalitystring

ISO 3166-1 alpha-3 code of citizenship.

sexstring

Sex or gender marker: M (Male), F (Female), X (Other), U (Unspecified).

issuing_countrystring

ISO 3166-1 alpha-3 code of the country that issued the document.

issuing_authoritystring

Name of the government agency or entity that issued the document.

issue_datestring

ISO-8601 date the document was issued.

expiry_datestring

ISO-8601 expiry date; critical for validity checking.

addressobject

Residential or registered address as printed on the document.

personal_numberstring

National identification number, tax ID, or personal registration code.

vehicle_classesarray

Driver license vehicle classes or categories authorized (e.g., A, B, C for EU standards).

endorsementsarray

Special endorsements or qualifications on a driver license.

restrictionsarray

Driving restrictions or medical conditions noted on a driver license.

height_cmnumber

Height in centimeters if present on the document.

weight_kgnumber

Weight in kilograms if present on the document.

eye_colorstring

Eye color as stated (e.g., brown, blue, hazel).

hair_colorstring

Hair color as stated.

photo_presentboolean

Whether a photo or biometric image is visible on the document.

signature_presentboolean

Whether a signature or thumbprint is visible on the document.

curl
curl -X POST 'https://app.staging.xberg.io/v1/extract' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'file=@your-document.pdf' \
  --form-string 'options={"preset":"id_document"}'
Call mode
Vision only
Citations
Enabled
Version
v1

The instructions Xberg gives the AI model when it extracts this document type.

You are a document verification specialist. Extract identity document data with absolute accuracy. For the MRZ, transcribe all characters exactly as printed or scanned; preserve all leading zeros and special characters. Convert dates to ISO-8601 format only when the complete date, including the century, is explicit in the document. For biographic fields, use the face page as primary source and cross-check with MRZ data. Extract personal identification numbers preserving their exact format including leading zeros. Flag mismatches between MRZ and face data but report both. If the document does not match this preset, return {}. Extract only values supported by the document. Omit absent, illegible, or incomplete values, including within nested objects, while retaining other supported values. Do not infer, guess, supply defaults, or calculate missing values. Omit dates whose complete year, month, and day are not explicit. Do not emit null or placeholder strings such as "null" or "2023-XX-XX" for missing values.

Open-source primitives, composed into one backend. Curated cohort of design partners. Apply to work with us.

We value your privacy

Xberg uses cookies to improve your experience, personalize content, and analyze traffic. You can manage your preferences at any time.