# /ocr\_passport

#### Endpoint

```http
https://be.progeny.tech/api/v3/services/ocr_passport/
```

#### Purpose

Allows you to connect to the OCR\_Card service, using the provider configured in the **Progeny Console**, to extract an image from a passport.

{% hint style="info" %}
Please refer to the section on [images](/our-api/overview.md#a-quick-word-about-images) for guidance before posting.  For the best results, we recommend a maximum height of 1080px.
{% endhint %}

#### Sample request and response

## Get a task Id

<mark style="color:green;">`POST`</mark> `https://be.progeny.tech/api/v3/services/ocr_passport/`

#### Request Body

| Name                                              | Type   | Description                                                                                        |
| ------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------- |
| passport\_image<mark style="color:red;">\*</mark> | String | The file path to an image of the passport page in PNG, JPEG, or JPG file format                    |
| extend\_data                                      | String | Set to true to retrieve the original response from the 3rd-party provider of the OCR\_Card service |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
    "id": "efe46711-b1d8-43f1-9d02-7a54c43b79a2"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "selfie_image": [
        "No file was submitted."
    ],
    "passport_image": [
        "No file was submitted."
    ],
    "extend_data": [
        "This field is required."
    ]
}
```

{% endtab %}
{% endtabs %}

## Extract an image from a passport

<mark style="color:blue;">`GET`</mark> `https://be.progeny.tech/api/v3/services/task/?id={{task_id}}`&#x20;

#### Path Parameters

| Name                                 | Type   | Description                                     |
| ------------------------------------ | ------ | ----------------------------------------------- |
| id<mark style="color:red;">\*</mark> | String | The task Id you obtained from your POST request |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
    "id": 2188,
    "status": "SUCCESS",
    "result": {
        "status": 200,
        "data": {
            "document": {
                "is_valid": true,
                "is_expired": false,
                "dateOfBirth": "1991-9-24",
                "age": 30,
                "firstName": "VALERIA",
                "lastName": "PERFILOVA",
                "dateOfIssue": "None-None-None",
                "dateOfExpiry": "2023-9-25",
                "documentNumber": "XX008080",
                "sex": "F",
                "nationality": "UKRAINIAN",
                "portrait": "images/services/ocr_passport/9456633680.jpg",
                "portrait_url": "https://dev.progeny.tech/media/images/services/ocr_passport/9456633680.jpg"
            },
            "compare": true,
            "liveness": true
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.progeny.tech/our-api/ocr_passport.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
