Passport OCR .NET

The .NET OCR SDK supports the passport API for extracting data from passports.

Using this sample passport below, we are going to illustrate how to extract the data that we want using the OCR SDK.
sample passport

Quick Start

using Mindee;
using Mindee.Input;
using Mindee.Product.Passport;

string apiKey = "my-api-key";
string filePath = "/path/to/the/file.ext";

// Construct a new client
MindeeClient mindeeClient = new MindeeClient(apiKey);

// Load an input source as a path string
// Other input types can be used, as mentioned in the docs
var inputSource = new LocalInputSource(filePath);

// Call the API and parse the input
var response = await mindeeClient

// Print a summary of all the predictions
// System.Console.WriteLine(response.Document.ToString());

// Print only the document-level predictions


:Country Code: GBR
:ID Number: 707797979
:Given Name(s): HENERT
:Surname: PUDARSAN
:Date of Birth: 1995-05-20
:Place of Birth: CAMTETH
:Gender: M
:Date of Issue: 2012-04-22
:Expiry Date: 2017-04-22
:MRZ Line 1: P<GBRPUDARSAN<<HENERT<<<<<<<<<<<<<<<<<<<<<<<
:MRZ Line 2: 7077979792GBR9505209M1704224<<<<<<<<<<<<<<00

Field Objects

Each Field object contains at a minimum the following attributes:

  • value (string or number depending on the field type):
    Corresponds to the field value. Can be null if no value was extracted.
  • confidence (Float):
    The confidence score of the field prediction.
  • bbox (Array< Array< Float > >):
    Contains exactly 4 relative vertices coordinates (points) of a right rectangle containing the field in the document.

Extracted Fields

Depending on the field type specified, additional attributes can be extracted from the Passport object.

Using the above passport example, the following are the basic fields that can be extracted.

Birth Place

  • BirthPlace (Field): Passport owner birthplace.



Date fields:

  • can contain the raw attribute, which is the textual representation found on the document.
  • have a value attribute which is the ISO 8601 representation of the date, regardless of the raw contents.

The following date fields are available:

  • ExpiryDate: Passport expiry date.

  • IssuanceDate: Passport date of issuance.

  • BirthDate: Passport's owner date of birth.


  • Gender (StringField): Passport owner's gender (M / F).

Given Names

  • GivenNames (List): List of passport owner's given names.


  • IdNumber (StringField): Passport identification number.

Machine Readable Zone

  • Mrz1 (StringField): Passport first line of machine-readable zone.

  • Mrz2 (StringField): Passport second line of machine-readable zone.


  • Surname (StringField): Passport's owner surname.


Join our Slack