VendID MRZ API — docs
Read the machine-readable zone (MRZ) of passports (TD3), ID cards (TD1) and TD2 documents. Send an image, get JSON with every ICAO 9303 check digit verified. Servers in the EU (Belgium); the image is read in memory and dropped.
- Call
POST /v1/warmupwith your key when your page or app opens — the engine is warm by the time the user holds up the passport. - Set your client timeout to 30 s or more.
mrz.jswaits 25 s per request and shows „Starting the reader…" meanwhile. - Paid and volume plans: always-warm engine, no cold start.
QuickstartKeysPOST /v1/mrzWarm-upResponseErrorsmrz.js drop-inLimitsPassport SDKExamples on GitHubOpenAPI spec
Quickstart (60 seconds)
1. Get a free key — it is shown at once and e-mailed. 2. Run this, with the specimen passport if you have none at hand:
curl -o passport.jpg https://vend-id.com/sdk/specimen.jpg curl https://vend-id.com/v1/mrz \ -H "Authorization: Bearer YOUR_KEY" \ -F "image=@passport.jpg"
Keys
Send the key as Authorization: Bearer vid_…. A key looks like vid_ + 32 letters and digits. We store only its hash: if you lose it, request a new one. A key in a browser page can be read by anyone who opens the page — fine for testing and for pages behind your login; for public pages call the API from your server.
POST https://vend-id.com/v1/mrz
Body: multipart/form-data with the image in the field image, or the raw image with Content-Type: image/jpeg (or png, webp). Max 10 MB. A photo of the data page or a whole camera frame both work: the document is found in the image. CORS is open, so browsers on any site can call it.
# raw body instead of multipart curl https://vend-id.com/v1/mrz -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: image/jpeg" --data-binary @passport.jpg
// JavaScript (browser or Node 18+)
const form = new FormData();
form.append('image', file); // a File, Blob or fs.openAsBlob('passport.jpg')
const res = await fetch('https://vend-id.com/v1/mrz', {
method: 'POST', headers: { Authorization: 'Bearer YOUR_KEY' }, body: form,
});
const mrz = await res.json(); // 200 → fields, 422 → {error, reason}
# Python
import requests
r = requests.post("https://vend-id.com/v1/mrz",
headers={"Authorization": "Bearer YOUR_KEY"},
files={"image": open("passport.jpg", "rb")})
print(r.status_code, r.json())
Response — 200 OK
{
"format": "TD3", // TD3 passport · TD1 ID card · TD2
"document_type": "P",
"issuing_state": "UTO",
"surname": "ERIKSSON",
"given_names": "ANNA MARIA",
"document_number": "L898902C3",
"nationality": "UTO",
"birth_date": "1974-08-12", // ISO date
"sex": "F",
"expiry_date": "2012-04-15",
"optional_data": "ZE184226B",
"check_digits": { "document_number": true, "birth_date": true, "expiry_date": true, "composite": true },
"mrz": ["P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<",
"L898902C36UTO7408122F1204159ZE184226B<<<<<10"],
"ms": 612 // time on our side
}
A 200 always has valid check digits. Warm, a read takes ~0.5 s; the first call after a quiet spell takes ~7–10 s (cold start).
POST https://vend-id.com/v1/warmup
Wakes the reading engine so the next read is fast. Same key as /v1/mrz, no body. Free: never counted, never billed. CORS is open, so call it from the browser the moment your check-in page or scan screen opens.
curl -X POST https://vend-id.com/v1/warmup -H "Authorization: Bearer YOUR_KEY"
# 202 {"state":"warming","eta_ms":7000} engine starting, ready in ~7 s
# 200 {"state":"ready","eta_ms":0} already warm
// when the page opens — don't wait for it
fetch('https://vend-id.com/v1/warmup', { method: 'POST', headers: { Authorization: 'Bearer YOUR_KEY' } });
Errors: 401 as for /v1/mrz; 502 engine_unavailable (retry, or just scan: a read wakes the engine too). Set client timeouts for /v1/mrz to 30 s or more.
Errors
| Status | error | Meaning |
|---|---|---|
| 422 | no_document | No passport or ID card found in the image. |
| 422 | no_mrz | Document found, but not the MRZ lines (the <<< lines). Show the bottom of the data page. |
| 422 | blurry | MRZ too blurry to read. |
| 422 | check_digits | Read, but the check digits don't match: no result is better than a wrong one. |
| 400 | bad_request | No image in the request. |
| 401 | missing_api_key / invalid_api_key | No key, or a key we don't know. |
| 413 | body_too_large | Image over 10 MB. |
| 415 | unsupported_image | Not a JPEG, PNG or WebP image. Check the file; do not retry. |
| 429 | quota_exceeded | Abuse protection only: more than 10,000 calls in a month on one key (20× the free scans). Resets on the 1st (UTC). Running past the 500 free scans never answers 429: the key keeps working. |
| 502 | engine_unavailable | The reader did not answer. Retry. |
Failed reads (422) are free: only reads with valid check digits count.
mrz.js — camera drop-in
One script tag. It opens a full-screen camera view, sends frames to /v1/mrz until one reads, and hands you the same JSON. No build step, no dependencies, works in every current browser over HTTPS (phone or laptop webcam).
<script src="https://vend-id.com/sdk/mrz.js"></script>
<button onclick="scan()">Scan passport</button>
<script>
async function scan() {
const r = await VendIdMrz.open({ key: 'YOUR_KEY' });
console.log(r.surname, r.given_names, r.document_number, r.birth_date);
}
</script>
| Call | What it does |
|---|---|
VendIdMrz.open({ key, onResult?, onError? }) | Camera overlay. Promise resolves with the result; rejects on a key, quota or connection error, or with code: 'closed' when the user closes it. „No passport? Use the specimen" reads the ICAO specimen. No answer within 25 s: the overlay says so and offers „Try again"; closing it then rejects with name: 'VendIdMrzTimeoutError', code: 'timeout'. |
VendIdMrz.scanImage({ key, image }) | One File or Blob (e.g. from <input type="file">) → result. No camera. No answer within 25 s: rejects with VendIdMrzTimeoutError, code: 'timeout'. |
VendIdMrz.close() | Closes an open overlay. |
Plans and limits
- Free: 500 successful scans a month, every month, no card. Past 500 your key keeps working; we contact you about a plan. Test and staging keys never count.
- Pay as you go: €0.01 per successful scan, no monthly fee, first 500 a month free. Budget alerts at 80 % and 100 %; stop at your budget or keep going.
- Starter: €29 a month including 5,000 scans, then €0.01 per scan. Unlimited keys with usage per key; SEPA direct debit or bank transfer.
- Always warm: on paid and volume plans the engine stays warm — no ~7–10 s cold start.
- Volume (from 100,000 scans a month) or the engine on your own servers: ask for an offer.
- All plans: vend-id.com/sdk#mrz-plans.
VendID Passport SDK (on the device)
The same reading on the user's device — browser (JavaScript + WebAssembly), Android, iOS, Flutter and React Native; on phones also the passport chip by NFC with Passive Authentication. The package and a test licence come with your SDK request.