> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/verify/document-ai/ocr-and-document-verification/ocr-and-document-verification-v2/full-details-endpoint/ocr/passports.md).

# Passports

Extract identity data from passport images using the `ocr` operation.

{% hint style="info" %}
**Optional fields:** `personalIdNumber` and `religion` may or may not appear in the response, depending on the issuing country's passport format.

* **Included:** Malaysia, South Korea
* **Not included:** many other countries
  {% endhint %}

### Where each field comes from

Passport OCR reads core identity fields from the **MRZ** (Machine Readable Zone), which is more consistent and reliable. Other fields are still read from the **VIZ** (Visual Inspection Zone, the printed text on the page).

| Response field                | Source | Raises OCR warnings? |
| ----------------------------- | ------ | -------------------- |
| `idNumber`                    | MRZ    | Yes                  |
| `name`                        | MRZ    | Yes                  |
| `dob`                         | MRZ    | Yes                  |
| `gender`                      | MRZ    | Yes                  |
| `dateOfExpiry`                | MRZ    | Yes                  |
| `issuerCountry`               | MRZ    | Yes                  |
| `personalIdNumber` (optional) | VIZ    | No                   |
| `citizenship`                 | VIZ    | No                   |
| `placeOfBirth`                | VIZ    | No                   |
| `religion` (optional)         | VIZ    | No                   |
| `dateOfIssue`                 | VIZ    | No                   |
| `issuingAuthority`            | VIZ    | No                   |
| `issuerName`                  | VIZ    | No                   |
| `portraitImage`               | VIZ    | No                   |

{% hint style="success" %}
**No breaking changes.** No new error or warning codes were added, and the response structure is unchanged. Only the internal extraction source changed from VIZ to MRZ.
{% endhint %}

### Request

<details>

<summary>JSON Sample Request</summary>

{% code expandable="true" %}

```json
{
  "operations": ["ocr"],
  "payload": {
    "partnerTrxId": "{{$guid}}",
    "groupId": "{{$guid}}",
    "country": "KOR",
    "idType": "PASSPORT",
    "idSubtype": "N/A",
    "idFrontSideImage": "Base64 encoded image of passport front side"
  },
  "userConsent": {
    "userIp": "226.80.211.232",
    "country": "IND",
    "obtained": true,
    "obtainedAt": "1680700959"
  }
}
```

{% endcode %}

</details>

### Response

<details>

<summary>JSON - Success Response </summary>

```json
{
  "transactionId": "unique transaction id generated to identify this transaction",
  "partnerTrxId": "partner transaction id submitted by customer in request",
  "groupId": "partner group id submitted by customer in request",
  "card": {
    "country": "South Korea",
    "type": "PASSPORT",
    "isoAlpha3CountryCode": "KOR",
    "isoAlpha2CountryCode": "KR"
  },
  "ocrResult": {
    "front": {
      "data": {
        "idNumber": { "value": "Id-Number" },
        "personalIdNumber": { "value": "Personal Id Number" },
        "name": { "value": "Name from passport" },
        "dob": { "value": "Date of birth in YYYYMMDD format" },
        "gender": { "value": "Gender from passport (M/F/O)" },
        "placeOfBirth": { "value": "Place of birth from passport" },
        "dateOfExpiry": { "value": "Date of expiry" },
        "dateOfIssue": { "value": "Date of Issuance" },
        "citizenship": { "value": "citizenship from passport" },
        "religion": { "value": "religion from passport" },
        "issuerName": { "value": "issuer name from passport" },
        "issuerCountry": { "value": "issuer country from passport" },
        "issuingAuthority": { "value": "issuing authority from passport" },
        "portraitImage": "Base64 encoded cropped face image from passport"
      }
    }
  }
}
```

</details>

<details>

<summary>JSON - Failure Response If the OCR is Unable to extract a critical</summary>

```json
{
  "transactionId": "unique transaction id generated to identify this transaction",
  "partnerTrxId": "partner transaction id submitted by customer in request",
  "groupId": "partner group id submitted by customer in request",
  "errors": [
    {
      "code": 5005,
      "operations": ["idVerification", "ocr"],
      "message": "extraction_failed"
    }
  ]
}
```

Returned when the OCR model cannot extract a critical field.

</details>
