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

# Document Verification

> Classify, extract, and authenticate an identity document in a single GBG GO module that returns the combined classification, extraction, and authentication results.

The **Document Verification** module consolidates Document Classification, Document Extraction, and Document Authentication into a single module. Rather than placing three separate modules in a journey, this module performs all three checks in one step.

The module returns the combined classification result, extracted fields, image quality checks, and authentication and tamper results. It is available in the US, EU, and AU regions.

The module takes the following inputs and returns the following outputs:

* **Required inputs:** Primary document front side image.
* **Optional inputs:** Primary document back side image.
* **Outputs:** Document classification, extracted document data, anchor portrait image, and document validation results.

## Capabilities

The module returns capabilities grouped into four areas: classification, image quality, extraction, and authentication.

### Classification capabilities

Classification identifies the document and returns its type and issuing origin. The module returns the following classification values:

| Capability                     | Type | Values                                                                                                                                                                                                                                          | Description                                                                                                                                                                              |
| ------------------------------ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Document classification result | Enum | `Document Classified`, `Document NOT Classified`                                                                                                                                                                                                | Whether the document was successfully identified and classified.                                                                                                                         |
| Document type                  | Enum | `Driving License`, `Identification Card`, `Passport`, `Military Identification`, `Residence Document`, `Travel Card`, `Tribal Card`, `Visa`, `Voter Identification`, `Worker Identification`, `Merchant Mariner Credential`, `Other`, `Unknown` | The type of document identified. `Residence Document` includes green cards and residence permits. `Other` includes weapons licences, birth certificates, medical cards, and other types. |
| Document country code          | Enum | ISO3 country codes such as `GBR`, `USA`, or `AUS`, or `Unknown`                                                                                                                                                                                 | The issuing country of the document in ISO3 format. Supports over 180 countries.                                                                                                         |
| Country name                   | Enum | Full country names or `Unknown`                                                                                                                                                                                                                 | The issuing country as a full name.                                                                                                                                                      |
| State name                     | Enum | State/territory names or `Unknown`                                                                                                                                                                                                              | The issuing state or territory, if applicable. Supports all US states, Australian states/territories, and select UK/Crown dependencies.                                                  |

### Image quality checks

The module runs image quality checks on both the front and back sides of the document. Each check returns one of five values:

| Value          | Description                                                                                                                         |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `Passed`       | The image meets the requirement for this check.                                                                                     |
| `Failed`       | The image does not meet the requirement for this check.                                                                             |
| `Skipped`      | An underlying requirement was not met, so the check did not run.                                                                    |
| `Undetermined` | The check could not reach a conclusion.                                                                                             |
| `Excluded`     | The check was not applicable. For example, back side checks are excluded when no back image is provided. This is the default value. |

#### Front side checks

The following checks run on the front side image of the document:

| Capability                             | Description                                                       |
| -------------------------------------- | ----------------------------------------------------------------- |
| Front side low resolution check        | Whether the front image meets the minimum resolution requirement. |
| Front side glare check                 | Whether the front image is free of glare.                         |
| Front side blur check                  | Whether the front image is free of blur.                          |
| Front side colour check                | Whether the front image is in colour.                             |
| Front side full document in view check | Whether the full document is visible in the front image.          |

#### Back side checks

The following checks run on the back side image of the document, when a back image is provided:

| Capability                            | Description                                                      |
| ------------------------------------- | ---------------------------------------------------------------- |
| Back side low resolution check        | Whether the back image meets the minimum resolution requirement. |
| Back side glare check                 | Whether the back image is free of glare.                         |
| Back side blur check                  | Whether the back image is free of blur.                          |
| Back side colour check                | Whether the back image is in colour.                             |
| Back side full document in view check | Whether the full document is visible in the back image.          |

### Extraction capabilities

Extraction reads the required fields from the document and derives related values, such as the subject's age and expiry status. The module returns the following extraction values:

| Capability                 | Type    | Values/Range                                       | Description                                                                                                                                                                                                                                                                                                     |
| -------------------------- | ------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Document extraction result | Enum    | `Extraction Successful`, `Extraction Unsuccessful` | Whether the required fields, as defined in the module configuration, were successfully extracted.                                                                                                                                                                                                               |
| Document expiry status     | Enum    | `Expired`, `Not Expired`, `Undeterminable`         | The document's expiry status.                                                                                                                                                                                                                                                                                   |
| Calculated age             | Integer | 0–130                                              | The subject's age in years, calculated from the extracted date of birth.                                                                                                                                                                                                                                        |
| Days since expiry          | Integer | 0–36500                                            | The number of whole days since the document expired. Returns `0` when the document has not expired or when the expiry date could not be determined. Always combine this with document expiry status = `Expired` in evaluation rules. Otherwise, the rule also matches non-expired and undeterminable documents. |
| Anchor image extracted     | Boolean | `isTrue`, `isFalse`                                | Whether the portrait image was successfully extracted from the document. When `isFalse`, downstream facematch can be skipped.                                                                                                                                                                                   |

### Authentication capabilities

Authentication assesses whether the document is genuine and whether it shows signs of tampering. The module returns the following authentication values:

| Capability                     | Type    | Values                                                          | Description                                                                                                                                                        |
| ------------------------------ | ------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Document authentication result | Enumset | `LOW_RISK_PASS`, `MEDIUM_RISK_PASS`, `HIGH_RISK_PASS`, `FAILED` | The overall authentication result. Uses the same risk-level model as [Document Authentication V2](/docs/go-v2/platform/modules/documents/document-authentication). |
| Document tampering result      | Enumset | `LOW_RISK_PASS`, `MEDIUM_RISK_PASS`, `HIGH_RISK_PASS`, `FAILED` | The tamper detection result.                                                                                                                                       |

### Default outcomes

The outcome logic spans all three phases. Classification outcomes are evaluated first, then authentication/tamper risk outcomes, then extraction outcomes.

| Outcome                   | Condition                                                                                       | Description                                                                                                                         |
| ------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `Document NOT Classified` | Classification result is `Document NOT Classified`.                                             | The document could not be identified. This evaluates first, because if classification fails, then no further checks are meaningful. |
| `Low Risk`                | Authentication result includes `LOW_RISK_PASS` and tamper result includes `LOW_RISK_PASS`.      | Both authentication and tamper detection passed under the strictest checks.                                                         |
| `Medium Risk`             | Authentication result includes `MEDIUM_RISK_PASS` or tamper result includes `MEDIUM_RISK_PASS`. | Either authentication or tamper detection passed under moderate checks.                                                             |
| `High Risk`               | Authentication result includes `HIGH_RISK_PASS` and tamper result includes `HIGH_RISK_PASS`.    | Both authentication and tamper detection passed under the most relaxed checks.                                                      |
| `Caution`                 | Authentication result includes `FAILED` and tamper result includes `FAILED`.                    | Both authentication and tamper detection failed.                                                                                    |
| `Extraction Successful`   | Extraction result is `Extraction Successful`.                                                   | The required fields were successfully extracted.                                                                                    |
| `Extraction Unsuccessful` | Extraction result is `Extraction Unsuccessful`.                                                 | The required fields could not be extracted.                                                                                         |
| `Document Classified`     | Classification result is `Document Classified`.                                                 | The document was successfully classified.                                                                                           |
| `ERROR`                   | Default, when no conditions matched.                                                            | An unexpected error occurred.                                                                                                       |

## Input payload

The following is a sample payload used to submit document images to the **Document Verification** module for processing.

```json JSON theme={null}
{
  "resourceId": "<resourceId>",
  "context": {
    "config": {
      "delivery": "api"
    },
    "subject": {
      "documents": [
        {
          "side1Image": "<base64-encoded string>",
          "side2Image": "<base64-encoded string>",
          "type": "Primary"
        }
      ]
    }
  }
}
```

| Field        | Required | Description                                                                            |
| ------------ | -------- | -------------------------------------------------------------------------------------- |
| `side1Image` | Yes      | A base64-encoded string representing the image of the front side of the document.      |
| `side2Image` | No       | A base64-encoded string representing the image of the back side of the document.       |
| `type`       | Yes      | The document role within the journey. Set to `Primary` for the main identity document. |

## Sample response

The following is a sample response from the **Document Verification** module.

```json JSON theme={null}
{
  "response": {
    "advice": {
      "contains": {
        "DocumentClassificationResult": "Document Classified",
        "type": "Drivers License",
        "countryCode": "UTO",
        "stateName": "Not available",
        "countryName": "Utopia",
        "frontSideLowResolutionCheck": "Excluded",
        "backSideLowResolutionCheck": "Excluded",
        "frontSideGlareCheck": "Passed",
        "backSideGlareCheck": "Passed",
        "frontSideBlurCheck": "Passed",
        "backSideBlurCheck": "Passed",
        "frontSideColourCheck": "Excluded",
        "backSideColourCheck": "Excluded",
        "frontSideFullDocumentInViewCheck": "Excluded",
        "backSideFullDocumentInViewCheck": "Excluded",
        "documentExpiryStatus": "Not Expired",
        "firstNameIsPresent": true,
        "lastNamesIsPresent": true,
        "addressStringIsPresent": true,
        "dateOfBirthIsPresent": true,
        "expiryDateIsPresent": true,
        "issueDateIsPresent": true,
        "documentNumberIsPresent": true,
        "extractionResult": "Extraction Successful",
        "authenticationResult": [
          "FAILED"
        ],
        "tamperResult": [
          "FAILED"
        ]
      }
    },
    "outcome": "Caution"
  }
}
```
