Free plan

Read passport or ID line (MRZ)

Read the code lines at the bottom of a passport or ID card
POST
/v1/images/mrz

About this tool

Reads the two or three lines of letters and arrows at the bottom of a passport, ID card or visa (the machine-readable zone) and turns them into the holder's name, numbers and dates. It also checks the built-in check digits that show whether a number is valid. You can add a picture, or type the lines instead.
For example, you read the details from a photo of a passport to fill in a form.

How to use it

  1. Choose this tool.
  2. Add a clear picture of the passport page or ID card, or type the code lines instead.
  3. Leave the kind of document on automatic unless you know it.
  4. Press Generate.
  5. Read or copy the details.

What you get back

You get the name, numbers and dates on screen, with a note on whether each check passed. You can copy them.
GOOD TO KNOW
Reads what is printed; a wrong check digit usually means a misread character. Counts as one image per picture (none when only text is given).
TEST IT LIVE

Try Read passport or ID line (MRZ) in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/mrz
Tool ID
images.mrz
Authentication
API key
Accepts
JPEG, PNG, WEBP, GIF, AVIF, TIFF +15 more
Background jobs
Yes
Usage group
Image
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/images/mrz" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'text=P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10' \
  -F 'type=auto' \
  -F 'region=0.4'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.mrz({
    "text": "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<\nL898902C36UTO7408122F1204159ZE184226B<<<<<10",
    "type": "auto",
    "region": 0.4
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->mrz([
    'text' => 'P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10',
    'type' => 'auto',
    'region' => 0.4,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Read the machine-readable zone of a passport, ID card or visa from a picture (or from the text of its lines): the holder, the numbers, the dates, and every ICAO check digit verified.

Read passport or ID line (MRZ) accepts JPEG, PNG, WEBP, GIF, AVIF, TIFF, SVG, SVGZ, BMP, ICO, APNG, PNM and 9 more. You can send several files in one request.

Read passport or ID line (MRZ) is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/images/mrz with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.