> ## Documentation Index
> Fetch the complete documentation index at: https://docs.smartcomply.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Passport

> Extract identity details from a UK passport using OCR.

Verify a customer's UK passport by uploading a photo of the data page — no manual passport number entry required. OCR extraction plus a required face match against a selfie — no liveness check (no video, no blink/motion challenge).

<Note>
  Passport is single-sided — only `document_front` is needed.
</Note>

<Note>
  `selfie_image` is required — the face extracted from the document is compared against it. This is a still-image comparison (not liveness).
</Note>

<Note>
  UK document verification currently supports passports only — national ID, driver's license, and other UK document types are not yet available.
</Note>

## Endpoint

```
POST /api/onboarding/document_verification/uk/passport
```

## Request

### Headers

| Header           | Value                 | Required |
| ---------------- | --------------------- | -------- |
| `x-access-token` | Your API secret key   | Yes      |
| `Content-Type`   | `multipart/form-data` | Yes      |

### Body Parameters

| Parameter        | Type | Required | Description                                                                |
| ---------------- | ---- | -------- | -------------------------------------------------------------------------- |
| `document_front` | file | Yes      | Photo of the passport data page. JPG or PNG, max 5MB                       |
| `selfie_image`   | file | Yes      | A selfie to compare against the document's face photo. JPG or PNG, max 5MB |

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://adhere-api.smartcomply.com/api/onboarding/document_verification/uk/passport" \
    -H "x-access-token: YOUR_SECRET_KEY" \
    -F "document_front=@/path/to/passport.jpg" \
    -F "selfie_image=@/path/to/selfie.jpg"
  ```

  ```javascript Node.js theme={null}
  const formData = new FormData();
  formData.append("document_front", fs.createReadStream("/path/to/passport.jpg"));
  formData.append("selfie_image", fs.createReadStream("/path/to/selfie.jpg"));

  const response = await fetch(
    "https://adhere-api.smartcomply.com/api/onboarding/document_verification/uk/passport",
    {
      method: "POST",
      headers: { "x-access-token": "YOUR_SECRET_KEY" },
      body: formData,
    }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://adhere-api.smartcomply.com/api/onboarding/document_verification/uk/passport",
      headers={"x-access-token": "YOUR_SECRET_KEY"},
      files={
          "document_front": open("/path/to/passport.jpg", "rb"),
          "selfie_image": open("/path/to/selfie.jpg", "rb"),
      },
  )
  data = response.json()
  ```
</CodeGroup>

## Response

### 200 OK

| Field                                   | Type            | Description                                                                                                                                                                |
| --------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `status`                                | string          | `"success"` on a successful extraction                                                                                                                                     |
| `data.full_name`                        | string          | Extracted full name                                                                                                                                                        |
| `data.first_name`                       | string          | Extracted first name                                                                                                                                                       |
| `data.last_name`                        | string          | Extracted last name                                                                                                                                                        |
| `data.date_of_birth`                    | string          | Date of birth in `YYYY-MM-DD` format                                                                                                                                       |
| `data.gender`                           | string          | Extracted gender                                                                                                                                                           |
| `data.nationality`                      | string          | Extracted nationality                                                                                                                                                      |
| `data.id_number`                        | string          | The passport number                                                                                                                                                        |
| `data.document_type`                    | string          | `"passport"`                                                                                                                                                               |
| `data.expiry_date`                      | string          | Passport expiry date                                                                                                                                                       |
| `data.is_expired`                       | boolean         | Whether `expiry_date` has already passed                                                                                                                                   |
| `data.photo`                            | string          | Base64-encoded face photo extracted from the document                                                                                                                      |
| `data.extra_fields`                     | object          | Other fields OCR read from the data page — `place_of_birth`, `issuing_authority`, and `mrz_line1`/`mrz_line2` if the machine-readable zone was legible, exactly as printed |
| `data.face_match`                       | object          | Result of comparing the document's face against `selfie_image` — see below                                                                                                 |
| `data.face_match.attempted`             | boolean         | Whether a comparison was actually run                                                                                                                                      |
| `data.face_match.verified`              | boolean \| null | `true`/`false` if the comparison ran; `null` if it couldn't (see Face Match Notes)                                                                                         |
| `data.face_match.confidence_percentage` | number          | Match confidence, 0–100                                                                                                                                                    |
| `data.face_match.selfie_image`          | string          | URL of the uploaded selfie                                                                                                                                                 |
| `message`                               | string          | Human-readable result summary                                                                                                                                              |

```json theme={null}
{
  "status": "success",
  "data": {
    "valid": true,
    "first_name": "JAMES",
    "last_name": "SMITH",
    "full_name": "SMITH JAMES",
    "date_of_birth": "1988-07-22",
    "gender": "M",
    "nationality": "BRITISH",
    "id_number": "533018723",
    "document_type": "passport",
    "expiry_date": "2029-04-15",
    "is_expired": false,
    "photo": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
    "extra_fields": {
      "place_of_birth": "LONDON"
    },
    "face_match": {
      "attempted": true,
      "verified": true,
      "confidence_percentage": 92.4,
      "selfie_image": "https://.../selfie.jpg"
    }
  },
  "message": "Document details retrieved successfully"
}
```

<Note>
  **Face Match Notes** — if the comparison service itself fails, `attempted` reflects whether a comparison was actually run and `verified` comes back `null` with a `reason` field explaining why — this is different from `verified: false`, which means the comparison ran and the faces didn't match. A face-match problem never blocks the underlying document data — the rest of `data` is still returned.
</Note>

### 400 Bad Request

```json theme={null}
{
  "status": "failed",
  "data": [],
  "message": "ID photo is too blurry — please retake in good lighting with a steady hand"
}
```

### 401 Unauthorized

```json theme={null}
{
  "status": "failed",
  "message": "Authentication credentials were not provided."
}
```

<Note>
  For a full list of error codes, see the [Error Codes](/error_codes) reference.
</Note>


## OpenAPI

````yaml POST /api/onboarding/document_verification/uk/passport
openapi: 3.0.3
info:
  title: Adhere API
  description: >-
    Identity verification, credit checks, transaction monitoring, and loan fraud
    detection across Africa.
  version: 3.0.0
servers:
  - url: https://adhere-api.smartcomply.com
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Nigeria KYC
  - name: Kenya KYC
  - name: Ghana KYC
  - name: Rwanda KYC
  - name: Uganda KYC
  - name: Document Verification
  - name: Biometrics
  - name: Individual Credit
  - name: Business Credit
  - name: Transaction Monitoring
  - name: Transaction Screening
  - name: Transaction KYC
  - name: Loan Fraud
  - name: User Journey
paths:
  /api/onboarding/document_verification/uk/passport:
    post:
      tags:
        - Document Verification
      summary: Document Verification — UK Passport
      description: >
        Extract identity details from a UK passport using OCR, plus a required
        face match against a selfie. document_type and country are fixed by this
        URL — no need to send them in the request body. UK document verification
        currently supports passports only.
      operationId: documentVerificationUkPassport
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - document_front
              properties:
                document_front:
                  type: string
                  format: binary
                  description: Photo of the passport data page. JPG or PNG, max 5MB.
                selfie_image:
                  type: string
                  format: binary
                  description: >
                    A selfie to compare against the face extracted from the
                    document. JPG or PNG, max 5MB. Required.
      responses:
        '200':
          $ref: '#/components/responses/DocumentVerificationSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    DocumentVerificationSuccess:
      description: Document details extracted successfully
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: success
              data:
                type: object
                properties:
                  valid:
                    type: boolean
                  first_name:
                    type: string
                  last_name:
                    type: string
                  full_name:
                    type: string
                  date_of_birth:
                    type: string
                  gender:
                    type: string
                  nationality:
                    type: string
                  address:
                    type: string
                  id_number:
                    type: string
                  serial_number:
                    type: string
                  id_type:
                    type: string
                  document_type:
                    type: string
                  expiry_date:
                    type: string
                  issue_date:
                    type: string
                  is_expired:
                    type: boolean
                  photo:
                    type: string
                    description: >-
                      Base64-encoded face photo extracted from the document.
                      Absent for document types with no face photo
                      (cac_certificate, utility_bill).
                  extra_fields:
                    type: object
                    description: >-
                      Every other field OCR read from the document that doesn't
                      have its own dedicated field above. Varies by
                      document_type and country.
                  face_match:
                    type: object
                    description: Present only when selfie_image was supplied.
                    properties:
                      attempted:
                        type: boolean
                      verified:
                        type: boolean
                        nullable: true
                        description: >-
                          true/false if the comparison ran; null if it couldn't
                          (see reason).
                      confidence_percentage:
                        type: number
                      selfie_image:
                        type: string
                        description: URL of the uploaded selfie.
                      reason:
                        type: string
                        description: >-
                          Present when verified is null — explains why the
                          comparison couldn't run or complete.
              message:
                type: string
                example: Document details retrieved successfully
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: failed
              data:
                type: array
                items: {}
              message:
                type: string
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: failed
              message:
                type: string
                example: Authentication credentials were not provided.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-access-token
      description: Your Adhere API secret key

````