# Create a session (check-driven)

### URL

<mark style="color:green;">**POST**</mark> `https://api.complycube.com/v1/flow/sessions`

Creates a session.

{% hint style="info" %}
This enables you to create a session by explicitly specifying the check types. It is considered a **legacy** **approach**.
{% endhint %}

### Headers

<table><thead><tr><th width="277">Name</th><th width="116">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Type</code><mark style="color:red;">*</mark></td><td>string</td><td>The content-type must always be set to <code>application/json</code>.</td></tr><tr><td><code>Authorization</code><mark style="color:red;">*</mark></td><td>string</td><td>The API <code>live</code> or <code>test</code> key</td></tr></tbody></table>

### Body

<table><thead><tr><th width="278">Name</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>clientId</code><mark style="color:red;">*</mark></td><td>string</td><td>The ID of the client.</td></tr><tr><td><code>checkTypes</code><mark style="color:red;">*</mark></td><td>string</td><td><p>An array of check types. Valid values include: <br>1. <code>standard_screening_check</code> <br>2. <code>extensive_screening_check</code><br>3. <code>document_check</code><br>4. <code>identity_check</code><br>5. <code>enhanced_identity_check</code><br>6. <code>proof_of_address_check</code></p><p>7. <code>face_authentication_check</code><br>8. <code>age_estimation_check</code></p></td></tr><tr><td><code>successUrl</code><mark style="color:red;">*</mark></td><td>array</td><td>The URL to which ComplyCube should send clients when KYC and identity verification is complete.</td></tr><tr><td><code>cancelUrl</code><mark style="color:red;">*</mark></td><td>array</td><td>The URL the client will be directed to if they decide to cancel and return to your website.</td></tr><tr><td><code>enableMonitoring</code></td><td>boolean</td><td>Determines whether continuous monitoring is enabled for selected check types. When not provided, it defaults to <strong>false</strong>.</td></tr><tr><td><code>language</code></td><td>string</td><td><p>The UI language. Valid values include:</p><ol><li><code>en</code> (default)</li><li><code>ar</code></li><li><code>de</code></li><li><code>es</code></li><li><code>fr</code></li><li><code>hi</code></li><li><code>hk</code></li><li><code>id</code></li><li><code>it</code></li><li><code>ja</code></li><li><code>ko</code></li><li><code>nl</code></li><li><code>no</code></li><li><code>pl</code></li><li><code>pt</code></li><li><code>sv</code></li><li><code>th</code></li><li><code>vi</code></li><li><code>zh</code></li></ol></td></tr><tr><td><code>theme</code></td><td>string</td><td><p>The UI theme to apply. Valid values include:</p><ol><li><code>light</code> (default)</li><li><code>dark</code></li></ol></td></tr><tr><td><code>allowDocumentUpload</code></td><td>boolean</td><td>Indicates whether to force users to capture their documents using their phones. This removes the document upload option. When not provided, it defaults to <strong>true</strong>.</td></tr><tr><td><code>supportEmail</code></td><td>string</td><td>The support email address that appears on the UI for your clients. When not provided, no email address will be displayed.</td></tr><tr><td><code>messages</code></td><td>object</td><td>The custom messages to display on the UI for your users. Also, see the <a href="#the-messages-object">messages object below</a>.</td></tr><tr><td><code>documentTypes</code></td><td>object</td><td>The list of ID document types the client can select. When not provided, your client can select any of the types we support.</td></tr></tbody></table>

#### The `checkTypes` attribute

The `checkTypes` attribute represents the [check types](https://docs.complycube.com/documentation/api-reference/core-resources/checks) you would like to perform on your client. ComplyCube will generate the relevant UI capture screens based on the check types provided.

#### The `documentTypes` object

<table data-header-hidden><thead><tr><th width="291.70383499070863">Attribute</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Attribute</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>passport</code></td><td><code>boolean</code></td><td>Enable or disable passport selection. (<em>Optional</em>)</td></tr><tr><td><code>driving_license</code></td><td><code>boolean</code></td><td>Enable or disable driving license selection. (<em>Optional</em>)</td></tr><tr><td><code>residence_permit</code></td><td><code>boolean</code></td><td>Enable or disable residence permit selection. (<em>Optional</em>)</td></tr><tr><td><code>national_identity_card</code></td><td><code>boolean</code></td><td>Enable or disable national identity card selection. (<em>Optional</em>)</td></tr></tbody></table>

#### The `messages` object

<table data-header-hidden><thead><tr><th width="290.31955213784875">Attribute</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Attribute</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>intro</code></td><td><code>object</code></td><td>The intro screen message content. See the <a href="#undefined">content object below.</a> (<em>Optional</em>)</td></tr><tr><td><code>completion</code></td><td><code>object</code></td><td>The completion screen message content. See the <a href="#undefined">content object below.</a> (<em>Optional</em>)</td></tr></tbody></table>

#### The `content` object

<table data-header-hidden><thead><tr><th width="291.31955213784875">Attribute</th><th width="129.6088469980244">Type</th><th width="384.7428005655002">Description</th></tr></thead><tbody><tr><td><strong>Attribute</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>heading</code></td><td><code>string</code></td><td>The heading of the page. (<em>Optional</em>)</td></tr><tr><td><code>message</code></td><td><code>string</code></td><td>The message body of the page. (<em>Optional</em>)</td></tr></tbody></table>

### Example request

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/flow/sessions \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          "clientId": "CLIENT_ID",
          "checkTypes": ["extensive_screening_check", "identity_check", "document_check"],
          "successUrl": "https://www.yoursite.com/success",
          "cancelUrl": "https://www.yoursite.com/cancel",
          "documentTypes": {
               "passport": true,
               "driving_license": false,
               "residence_permit": true,
               "national_identity_card": true
          },
          "messages": {
                "intro": {
                    "heading": "Customized header",
                    "message": "Customized message body"
                },
                "completion": {
                    "heading": "Customized header",
                    "message": "Customized message body"
                }
          }
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

const session = await complycube.flow.createSession("CLIENT_ID", {
    checkTypes: [
      "extensive_screening_check",
      "identity_check",
      "document_check"
    ],
    successUrl: "https://www.yoursite.com/success",
    cancelUrl: "https://www.yoursite.com/cancel",
    theme: "light",
    messages: {
      intro: {
        heading: "Customized header",
        message: "Customized message body"
      },
      completion: {
        heading: "Customized header",
        message: "Customized message body"
      }
    }
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient

cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

flow_request = {   
        'clientId': 'CLIENT_ID', 
        'checkTypes':[  'extensive_screening_check',
                        'identity_check',
                        'document_check'],
        'successUrl':'https://wwww.yoursite.com/success',
        'cancelUrl':'https://wwww.yoursite.com/cancel',
        'theme': 'light'
        }
   
session = ccapi.flow.create(**flow_request)
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$fsess = $ccapi->flow()->createSession(
                           ['clientId' => 'CLIENT_ID', 
                           'checkTypes' => ['extensive_screening_check',
                                            'identity_check',
                                            'document_check'], 
                           'successUrl' => 'https://www.yoursite.com/success',
                           'cancelUrl' => 'https://www.yoursite.com/cancel',
                           'theme' => 'light']);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using ComplyCube.Net;
using ComplyCube.Net.Resources.FlowSessions;

var fSession = new FlowSessionApi(new ComplyCubeClient("<YOUR_API_KEY>"));

var flowSession = new FlowSessionRequest {
  clientId = "CLIENT_ID",
  checkTypes = new string[] {
    "extensive_screening_check",
    "identity_check",
    "document_check"
  },
  successUrl = "https://www.yoursite.com/success",
  cancelUrl = "https://www.yoursite.com/cancel"
};

var result = fSession.CreateAsync(flowSession).Result;
```

{% endtab %}
{% endtabs %}

### Example response

{% tabs %}
{% tab title="Success (200)" %}
{% code overflow="wrap" %}

```json
{
    "redirectUrl": "https://flow.complycube.com/test_ODdkNjhiOTU0MzY4YmE5NjRmMDMyY2E5MWYwZjgxNjMzZTcyMWJmNzU2YjZmNDQ4NmFjMTU0ZGZhYTU5MmNhY2NiNjI3ZDE4YWJkYmU2M2M3ZWYzZTlmM2M3MzgxMmM3NzZhMjVlYmQyNDI0ODdkOWQ3M2JiMjkxZTYxNzdhYmExMGEzOGRhYmM2OTIwMjgyYmEzZGY3ZDY0NWZhMjcwN2RlMTFkOTcxZWNhOWI2Zjg0NjllZGNkODVjYzMzMDA5YjdlMWY5OGIwMmZjY2UzNGI2YTMxOGQxNGZmNGFhYjczNzU0YmYwMjFkMzU1M2FjMjQ4ZDQ2ZjJjZTY4YWY0MzIxNjVlMDRjOTIyYTExMTlmMWU3YTYwMDY1NGJmYWM0NTA2MDE5NTg5NTkxYzA4MzYyYTUyM2I0NDM4OGExNWIyMTIzYTBhNDc0NDA4NWM2ZTQwMmNjMGVjMTk2YW?theme=light"
}
```

{% endcode %}
{% endtab %}

{% tab title="Invalid Request (400)" %}

```javascript
{
    "type": "invalid_request",
    "message": "'clientId' is invalid",
    "param": "clientId"
}
```

{% endtab %}
{% endtabs %}
