---
title: "Create transaction"
description: "Request options"
canonical: "https://docs.cm.com/verification/id-scan/create-transaction"
---

# Create transaction

> Request options

Source: https://docs.cm.com/verification/id-scan/create-transaction

```text title="Request"
POST https://api.cm.com/id-scan/v1/transactions
```

```text title="Request headers"
Content-Type: application/json
Authorization: Bearer GENERATED_TOKEN_HERE
```

```json title="Request body"
{
    "tasks": [
        "document_scan",
        "face_liveness",
        "face_match"
    ],
    "settings": {
        "documentScan": {
            "redactFields": [
                "personal_number"
            ]
        }
    },
    "locale": "nl-NL",
    "mobileOnly": true,
    "expiresIn": 3600
}
```

```json title="Response body"
{
    "id": "c3b92333-3935-4c15-a95e-8eb0051e644b",
    "state": "pending",
    "tasks": [
        "document_scan",
        "face_liveness",
        "face_match"
    ],
    "settings": {
        "documentScan": {
            "redactFields": [
                "personal_number"
            ]
        }
    },
    "url": "https://id-scan.identity.cm.com/en-us/identifications/zAWtVwkuYVDJKg...",
    "locale": "nl-NL",
    "mobileOnly": true,
    "expires": "2026-01-01T13:00:00+00:00",
    "created": "2026-01-02T13:00:00+00:00"
}
```

## Request options

### Task types

| Type | Description |
| - | - |
| `document_scan` | Upload or take a photo of the front and back side of an ID document. |
| `face_liveness` | Liveness check using the camera. |
| `face_match` | Compares the photo on the ID document with the photo taken during the liveness check. |

**Valid combinations**

- `document_scan`
- `document_scan`, `face_liveness`
- `document_scan`, `face_liveness`, `face_match`

### Settings

Configure the document scan task behavior. For example, change the allowed [document expiration](https://docs.cm.com/verification/id-scan/use-cases/document-expiration) or [redact fields](https://docs.cm.com/verification/id-scan/use-cases/redact-fields) from the downloaded document image. Or specify which [capture sources](https://docs.cm.com/verification/id-scan/use-cases/disable-file-uploads) should be allowed.

:::note
Image quality requirements are configured per account, not per transaction. See [Image quality checks](https://docs.cm.com/verification/id-scan/configuration#image-quality-checks).
:::

```json title="Request body"
{
    // other fields omitted for readability
    "settings": {
        "documentScan": {
            "allowedExpiration": 30,
            "redactFields": [
                "personal_number",
                "signature"
            ],
            "captureSources": [
                "camera",
                "file"
            ],
            "desiredFields": [
                "personal_number",
                "surname"
            ],
            "minimumAge": 16,
            "maximumAge": 80,
            "requireBothSides": true,
            "validateFields": [
                "personal_number"
            ]
        }
    }
}
```

| Property | Type | Description |
| - | - | - |
| `allowedExpiration` | integer | Increase or decrease the allowed expiration of the document based on its expiry date. For more information, see [document expiration](https://docs.cm.com/verification/id-scan/use-cases/document-expiration). |
| `redactFields` | array | The fields to be masked/blurred on the downloaded ID document. For more information, see [redact fields](https://docs.cm.com/verification/id-scan/use-cases/redact-fields). |
| `captureSources` | array | Specify how you would like the user to upload their document, allowed options are`file` and `camera`. If not provided, will default to both `file` and `camera`. For more information, see [disable file upload](https://docs.cm.com/verification/id-scan/use-cases/disable-file-uploads). |
| `desiredFields` | array | Request the availability of specific fields during a document scan. If the desired fields are not present on the initially scanned side, the system will automatically prompt for the other side of the document to be scanned. For more information, see [require personal number](https://docs.cm.com/verification/id-scan/use-cases/require-personal-number). |
| `extractFields` | array | Specifies which fields to extract from the ID document. If omitted, all fields are extracted by default. **Important**: When fields are specified, document and portrait images are excluded unless `document_image` and/or `portrait` are explicitly included in the list. A full list of available fields can be found in the [API Reference](https://docs.cm.com/verification/id-scan/v1/api-reference) |
| `minimumAge` | integer | Set a minimum age of the user. If provided and the user's age derived from the document doesn't meet the criteria, the transaction will fail. |
| `maximumAge` | integer | Set a maximum age of the user. If provided and the user's age derived from the document doesn't meet the criteria, the transaction will fail. Must be higher than `minimumAge` if both properties are provided. |
| `requireBothSides` | boolean | If set to `true`, the user will be required to provide both sides of their ID document, even if the personal number was detected on the front side. Unless the provided document has no other side. |
| `validateFields` | array | Specify which document fields should be validated. A field with a validity status of `not_checked` is also considered valid. If any of the fields have an `invalid` status, the user must attempt to scan again. A full list of available fields can be found in the [API Reference](https://docs.cm.com/verification/id-scan/v1/api-reference) |

### Locale

Sets the language of the transaction. Currently supports English `en-US`, Dutch `nl-NL`, French `fr-FR`, and Italian `it-IT`. This setting is optional. By default, a transaction is in English `en-US`.

```json title="Request body"
{
    // other fields omitted for readability
    "tasks": [
        "document_scan"
    ],
    "locale": "nl-NL"
}
```

### Mobile only

Controls whether a user is forced to use a mobile device to complete all task for the transaction. When set to `true` a user is forced to use a mobile device and when set to `false` a user can also use a non-mobile device like a desktop. This setting is optional. By default, this is `false`.

```json title="Request body"
{
    // other fields omitted for readability
    "tasks": [
        "document_scan"
    ],
    "mobileOnly": true
}
```

### Expires in

Set the time in seconds after which a transaction expires. The number of seconds can be between 3600 (1 hour) to a maximum of 86400 seconds (24 hours). This setting is optional. By default a transaction will expire after one hour.

```json title="Request body"
{
    // other fields omitted for readability
    "tasks": [
        "document_scan"
    ],
    "expiresIn": 7200
}
```

## Integrate on website

### Integration with iframe

Add an iframe to your website with the transaction URL.

```html
<iframe src="TRANSACTION_URL_HERE" width="650" height="600" allow="camera"></iframe>
```

:::note
Make sure the minimum width is set to 650 to ensure there is enough space for the embedded page.
:::

Add an event listener on the page to retrieve a notification when the transaction completes.

```html
<script>
  window.addEventListener('message', function (e) {
    const transactionId = e.data.transactionId;
    const state = e.data.state;
    const resultId = e.data.resultId;
    // now send the resultId to your backend and retrieve the result
  });
</script>
```

### Integration with return URL

Create the transaction with return URL and scan return URL.

```json title="Request body"
{
    "tasks": [
        "document_scan"
    ],
    "returnUrl": "https://example.com",
    "scanReturnUrl": "https://example.com"
}
```

Redirect the user to the `url` returned in the transaction response.

After the transaction is completed the user is redirected to the `returnUrl`. The query parameters `trxid` and `resultid` are appended to the URL. Use transaction ID in combination with the result ID to retrieve the transaction result.

The `scanReturnUrl` is used to redirect the user back to your own status page. This is only used when the QR code is scanned and the user completes the transaction on a mobile device. When no URL is set a default status page is shown.

## Events

To get notified when a transaction is completed or other events occurred, you can subscribe to events.
See: [Events](https://docs.cm.com/verification/id-scan/events)
