# Configuration

Your configuration holds the settings that apply to every transaction you create. Unlike the [document scan settings](https://developers.cm.com/verification/docs/create-transaction#settings), which you send with each transaction, your configuration is stored **for your account** and is not part of the transaction request.

It currently contains the image quality checks for your document scan tasks.

# Image quality checks

Image quality checks let you reject a document scan when the submitted image is not good enough, for example when it is blurry, has glare, or is not fully visible.

## How it works

For every document scan the service evaluates a set of quality checks on the submitted image. Each check returns `ok` or `error`.

A document scan is only rejected when at least 1 individual check that returned `error` is enabled in your configuration.

When a scan is rejected, the document scan task fails with the `image_quality_requirements_not_met` error and the end user is asked to submit the document again. See [document scan errors](https://developers.cm.com/verification/docs/id-scan-getting-started#document-scan-errors).

> 📘
>
> All checks are disabled by default

## Available checks

| Check         | Description                                                                               |
| :------------ | :---------------------------------------------------------------------------------------- |
| `glare`       | Glare is present on the document image.                                                   |
| `focus`       | The document image is out of focus.                                                       |
| `resolution`  | The image resolution is below the required threshold.                                     |
| `color`       | The image is colorless, for example a black-and-white scan or photocopy.                  |
| `perspective` | The document in the image has perspective distortion.                                     |
| `bounds`      | The document is not fully present in the image.                                           |
| `moire`       | Moiré patterns were detected, indicating a screen capture instead of a physical document. |
| `portrait`    | The portrait is not present on the document.                                              |
| `handwritten` | The document contains handwritten text in the scanned fields.                             |
| `brightness`  | The document image is not bright enough.                                                  |
| `occlusion`   | Part of the document is occluded in the image.                                            |

# Retrieve the configuration

`GET https://api.cm.com/id-scan/v1/config`

**Request headers**

```
Authorization: Bearer GENERATED_TOKEN_HERE
```

**Response**

```json
{
  "documentScan": {
    "imageQualityChecks": {
      "glare": false,
      "focus": false,
      "resolution": false,
      "color": false,
      "perspective": false,
      "bounds": false,
      "moire": false,
      "portrait": false,
      "handwritten": false,
      "brightness": false,
      "occlusion": false
    }
  }
}
```

# Update the configuration

`PUT https://api.cm.com/id-scan/v1/config`

**Request headers**

```
Content-Type: application/json
Authorization: Bearer GENERATED_TOKEN_HERE
```

**Request body**

| Property                          | Type   | Description                                                                                                        |
| :-------------------------------- | :----- | :----------------------------------------------------------------------------------------------------------------- |
| `documentScan`                    | object | Configuration that applies to your document scan tasks.                                                            |
| `documentScan.imageQualityChecks` | object | The image quality checks to enforce. Every [available check](#available-checks) can be set as an optional boolean. |

All properties are optional and only the checks you send are changed. Checks you leave out keep their current value.

**Enable the checks for blurry images and screen captures**

```json
{
  "documentScan": {
    "imageQualityChecks": {
      "focus": true,
      "moire": true
    }
  }
}
```

**Response**

The full configuration is always returned, including the checks you did not send.

```json
{
  "documentScan": {
    "imageQualityChecks": {
      "glare": false,
      "focus": true,
      "resolution": false,
      "color": false,
      "perspective": false,
      "bounds": false,
      "moire": true,
      "portrait": false,
      "handwritten": false,
      "brightness": false,
      "occlusion": false
    }
  }
}
```

For a full list of all options see the [API reference](https://developers.cm.com/verification/reference/update_config)