# Identity Verification

#### Endpoint

```bash
POST https://cloud.ooto-ai.com/api/v1.0/doc/compare
```

#### Request Format

* Method: POST
* Content-Type: multipart/form-data

#### Authentication Headers

To access the API, you need to include the following headers in your request:

* APP-ID: Your application's unique identifier.
* APP-KEY: Your application's authentication key.

#### Form Data

| Field  | Type | Required | Description                                  |
| ------ | ---- | -------- | -------------------------------------------- |
| doc    | File | Yes      | Photo of the identity document (JPEG or PNG) |
| selfie | File | Yes      | User selfie (JPEG or PNG)                    |

#### Example Request (cURL)

```bash
curl -X POST --location 'https://cloud.ooto-ai.com/api/v1.0/doc/compare' \
--header 'APP-ID: put_app_id_here' \
--header 'APP-KEY: put_app_key_here' \
--form 'doc=@"/path/to/doc_image"' \
--form 'selfie=@"/path/to/selfie_image"'
```

Replace «app\_id», «app\_key» with your actual credentials and the path to your doc image.

#### Successful Response (HTTP 200)

```json
{
  "transactionId": "string",
  "result": {
    "comparison": {
      "similarity": 0,
      "same": true
    },  
    "face": {
      "liveness": {
        "score": 0,
        "fine": true
      },
      "deepfake": {
        "score": 0,
        "fine": true
      },
      "quality": {
        "age": 0,
        "gender": "string",
        "race": "string",
        "pitch": 0,
        "yaw": 0,
        "roll": 0,
        "uniformity": {
          "value": 0,
          "fine": true
        },
        "exposure": {
          "value": 0,
          "fine": true
        },
        "contrast": {
          "value": 0,
          "fine": true
        },
        "flare": {
          "score": 0,
          "fine": true
        },
        "blur": {
          "score": 0,
          "fine": true
        },
        "macroblocks": {
          "score": 0,
          "fine": true
        },
        "distortion": {
          "score": 0,
          "fine": true
        },
        "occlusion": {
          "score": 0,
          "fine": true
        },
        "emotion": {
          "score": 0,
          "fine": true
        },
        "leftEyeClosed": {
          "score": 0,
          "fine": true
        },
        "rightEyeClosed": {
          "score": 0,
          "fine": true
        },
        "crfiqa": {
          "score": 0,
          "fine": true
        }
      },
      "box": {
        "x": 0,
        "y": 0,
        "w": 0,
        "h": 0
      },
      "landmarks": [
        [
          0
        ]
      ]
    },
    "document": {
      "doc": "string",
      "ocr": {
        "countryName": "string",
        "countryName_local": "string",
        "dateOfBirth": "string",
        "dateOfIssue": "string",
        "dateOfExpiration": "string",
        "IDPlaceOfBirthCountry": "string",
        "givenNames": "string",
        "givenNames_local": "string",
        "surname": "string",
        "surname_local": "string",
        "identityCardNumber": "string",
        "issuingStateCode": "string",
        "sex": "string",
        "mrz": "string",
        "bookletNumber": "string",
        "citizenshipStatus": "string",
        "nationality": "string",
        "height_cm": 0,
        "weight_kg": 0,
        "eyes": "string"
      },
      "position": {
        "x": 0,
        "y": 0,
        "w": 0,
        "h": 0,
        "angle": 0
      },
      "portrait": {
        "x": 0,
        "y": 0,
        "w": 0,
        "h": 0,
        "angle": 0
      }
    }
  }
}
```

#### Field Explanation

| Field                 | Description                                                        |
| --------------------- | ------------------------------------------------------------------ |
| similarity            | Cosine similarity score between document portrait and selfie (0–1) |
| same                  | true if above threshold (typically ≥ 0.75)                         |
| document.ocr          | Parsed fields from the document (name, birth date, number, etc.)   |
| document.portrait.box | Bounding box of the extracted portrait photo                       |
| selfie.face.box       | Bounding box of face on the selfie                                 |

#### Error response (HTTP 400)

```json
{
  "transactionId": "efb66e50-4c87-493d-b026-543dacdbe314",
  "result": {
    "status": "error",
    "code": 5,
    "info": "can not detect document"
  }
}
```

**Engine & OCR Errors**

| Code | Info                                                     |
| ---- | -------------------------------------------------------- |
| 1    | photo should not be empty                                |
| 2    | wrong mime-type in input data                            |
| 3    | photo size is 0 bytes                                    |
| 4    | can not decode image, check it is valid jpeg or png file |
| 5    | can not detect face (in selfie)                          |
| 6    | more than one face detected on photo                     |
| 8    | portrait from document not similar to template           |
| 9    | can not extract features from sample                     |
| 201  | can not detect document                                  |
| 202  | more than one document detected                          |
| 203  | can not make OCR for document                            |
| 208  | can not find portrait on document                        |
| 209  | insufficient resolution of the photo                     |

#### Notes

* Both images must be high quality and well-lit
* Document must be fully visible (no cropping or glare)
* Only one face must be visible per image
* Supports passports, ID cards, driver’s licenses (MRZ and visual zone)


---

# 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.ooto-ai.com/ocr/identity-verification.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.
