International ID OCR

Mindee’s International ID API uses deep learning to automatically, accurately, and instantaneously parse your documents details. In a few seconds, the API extracts a set of data from your PDFs or photos of ID’s from all locations, including:

  • Document Type

  • Document Number

  • Surnames

  • Given Names

  • Sex

  • Birth Date

  • Birth Place

  • Nationality

  • Personal Number

  • Country of Issue

  • State of Issue

  • Issue Date

  • Expiration Date

  • Address

  • MRZ Line 1

  • MRZ Line 2

  • MRZ Line 3

Set up the API

Create an API key

To begin using the Mindee V1 OCR API, your first step is to create your V1 API key.

  1. You'll need an ID Card or a passport or any other identification document. You can use one of the sample documents provided below.

  2. Access your document by clicking on the corresponding product card in the Document Catalog

  3. From the left navigation, go to documentation > API Reference, you'll find sample code in popular languages and command line.

  • Replace my-api-key-here with your new API key, or use the select an API key feature and it will be filled automatically.

  • Copy and paste the sample code of your desired choice in your application, code environment, terminal etc.

  • Replace /path/to/the/file.ext with the path to your input document.

  1. Run your code. You will receive a JSON response with the Id document details.

API Response

Here is the full JSON response you get when you call the API:

{
    "api_request": {
        "error": {},
        "resources": [
            "document",
            "job"
        ],
        "status": "success",
        "status_code": 200,
        "url": "https://api.mindee.net/v1/products/mindee/international_id/v2/documents/65c0af55-2247-45a4-bdea-e0908bca9df9"
    },
    "document": {
        "id": "65c0af55-2247-45a4-bdea-e0908bca9df9",
        "inference": {
            "extras": {},
            "finished_at": "2024-10-25T13:42:20.489000",
            "is_rotation_applied": true,
            "pages": [
                {
                    "extras": {},
                    "id": 0,
                    "orientation": {
                        "value": 0
                    },
                    "prediction": {}
                }
            ],
            "prediction": {...},
            "processing_time": 2.647,
            "product": {
                "features": [
                    "document_type",
                    "document_number",
                    "surnames",
                    "given_names",
                    "sex",
                    "birth_date",
                    "birth_place",
                    "nationality",
                    "personal_number",
                    "country_of_issue",
                    "state_of_issue",
                    "issue_date",
                    "expiry_date",
                    "address",
                    "mrz_line1",
                    "mrz_line2",
                    "mrz_line3"
                ],
                "name": "mindee/international_id",
                "type": "standard",
                "version": "2.1"
            },
            "started_at": "2024-10-25T13:42:17.554000"
        },
        "n_pages": 1,
        "name": "michelle_obama.jpg"
    },
    "job": {
        "available_at": "2024-10-25T13:42:20.499000",
        "error": {},
        "id": "c1e1cf27-f4a3-43cb-8bf0-0651a57756eb",
        "issued_at": "2024-10-25T13:42:17.554000",
        "status": "completed"
    }
}

You can find the prediction within the prediction key found in document > inference > prediction for document-level predictions: it contains the different fields extracted at the document level, meaning that for multi-pages PDFs, we reconstruct a single receipt object using all the pages.


{
    "document": {
				    ...
            "prediction": {
                "address": {
                    "value": null
                },
                "birth_date": {
                    "value": "1964-01-17"
                },
                "birth_place": {
                    "value": "ILLINOIS, U.S.A."
                },
                "country_of_issue": {
                    "value": "USA"
                },
                "document_number": {
                    "value": "910239248"
                },
                "document_type": {
                    "value": "PASSPORT"
                },
                "expiry_date": {
                    "value": "2018-12-05"
                },
                "given_names": [
                    {
                        "value": "MICHELLE"
                    }
                ],
                "issue_date": {
                    "value": "2013-12-06"
                },
                "mrz_line1": {
                    "value": "P<USAOBAMA<<MICHELLE<<<<<<<<<<<<<<<<<<<<<<<<"
                },
                "mrz_line2": {
                    "value": "9102392482USA6401171F1812051900781200<129676"
                },
                "mrz_line3": {
                    "value": null
                },
                "nationality": {
                    "value": "USA"
                },
                "personal_number": {
                    "value": null
                },
                "sex": {
                    "value": "F"
                },
                "state_of_issue": {
                    "value": null
                },
                "surnames": [
                    {
                        "value": "OBAMA"
                    }
                ]
            },
            ...
     }

Detailed Field Information

Using the above Bill of Lading example, the following are the basic fields that can be extracted.

Document Type

  • document_type: The type of personal identification document. Classification among the following values: IDENTIFICATION_CARD, PASSPORT, DRIVER_LICENCE, VISA, RESIDENCY_CARD, VOTER_REGISTRATION

{
  "document_type": {
    "value": "PASSPORT"
  }
}

Document Number

  • document_number: The unique identifier assigned to the document.

{
  "document_number": {
    "value": "910239248"
  }
}

Surnames

  • surnames: The list of document holder’s family names.

{
  "surnames": [
    {
      "value": "OBAMA"
    }
  ]
}

Given Names

  • given-names: The list of the document holder’s given names.

{
  "given_names": [
    {
      "value": "MICHELLE"
    }
  ]
}

Sex

  • sex: The biological sex of the document holder.

{
  "sex": {
    "value": "F"
  }
}

Birth Date

  • birth_date: The date of birth of the document holder.

{
  "birth_date": {
    "value": "1964-01-17"
  }
}

Birth Place

  • birth_place: The place of birth of the document holder.

{
  "birth_place": {
    "value": "ILLINOIS, U.S.A."
  }
}

Nationality

  • nationality: The country of citizenship of the document holder.

{
  "nationality": {
    "value": "USA"
  }
}

Personal Number

  • personal_number: The unique identifier assigned to the document holder.

{
  "personal_number": {
    "value": null
  }
}

Country of Issue

  • country_of_issue: The country where the document was issued.

{
 "country_of_issue": {
   "value": "USA"
  }
}

State of Issue

state_of_issue: The state or territory where the document was issued

{
 "state_of_issue": {
   "value": Null
  }
}

Issue Date

  • issue_date: The date when the document was issued.

{
 "issue_date": {
   "value": "2013-12-06"
  }
}

Expiration Date

  • expiration_date: The date when the document becomes invalid.

{
 "expiration_date": {
   "value": "2018-12-05"
  }
}

Address

  • address: The physical address of the document holder.

{
  "address": {
    "value": null
  }
}

MRZ

  • mrz_line1: the Machine Readable zone, first line.

{
  "mrz_line1": {
    "value": "P<USAOBAMA<<MICHELLE<<<<<<<<<<<<<<<<<<<<<<<<"
  }
}
  • mrz_line2: the Machine Readable zone, second line.

{
  "mrz_line2": {
    "value": "9102392482USA6401171F1812051900781200<129676"
  }
}
  • mrz_line3: the Machine Readable zone, third line.

{
  "mrz_line3": {
    "value": null
  }
}

Last updated

Was this helpful?