# configOptOut

This method is to configure the opt-out feature for the records. This feature lets you decide if the [records](https://emotiv.gitbook.io/cortex-api/records) created by your application on the local machine are uploaded to the EMOTIV cloud or not.

If the opt-out is on (ie the parameter **newOptOut** is true) then the records created on this machine will not be uploaded to the cloud. If the opt-out is off (ie the parameter **newOptOut** is false) then the records created on this machine will be uploaded to the cloud.

Please note that changing the opt-out configuration has no effect on the records previously created on the local computer. It only affects the records created after the change. Changing the opt-out configuration is **not retroactive**.

The opt-out configuration is linked to your application. Changing the configuration only affects the records created by your application. This has no effect on the records created by other applications.

The opt-out configuration is also linked to the EmotivID of the user. The opt-out can be turned on or off for each EmotivID. It is off by default.

You can check the field **localOnly** of a [Record object](https://emotiv.gitbook.io/cortex-api/records/record-object) to know if this record will stay on the local machine, or if it will be uploaded to the EMOTIV cloud.

Some [licenses](https://emotiv.gitbook.io/cortex-api/authentication/getlicenseinfo) don't let you change the opt-out configuration and force the opt-out to be always on or always off. See the possible configurations below for details.

*This method was added in Cortex 2.2.1*

## Parameters

| Name        | Type      | Required | Description                                                                                                                                                                                                                       |
| ----------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cortexToken | `string`  | yes      | A token returned by [authorize](https://emotiv.gitbook.io/cortex-api/authentication/authorize).                                                                                                                                   |
| status      | `string`  | yes      | <p>Must be "get" or "set".<br>Use "get" to read the current configuration of the opt-out feature.<br>Use "set" to turn the opt-out on or off.</p>                                                                                 |
| newOptOut   | `boolean` | no       | <p>If the <strong>status</strong> is "set" then you must set this parameter to true or false, in order to turn the opt-out feature on or off.<br>If the <strong>status</strong> is "get" then you should omit this parameter.</p> |

## Result

The result is an object describing the current opt-out configuration. It includes these fields:

| Name        | Type      | Description                                                                                                                                                                                                                                                                                           |
| ----------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| optOutAvail | `boolean` | <p>If <strong>false</strong> then the opt-out is always off.<br>The value of this field depends on the current <a href="../authentication/getlicenseinfo">license</a>. Some license force you to upload the records to the cloud.</p>                                                                 |
| forceOptOut | `boolean` | <p>If <strong>true</strong> (and <strong>optOutAvail</strong> is also <strong>true</strong>) then the opt-out is always on.<br>The value of this field depends on the current <a href="../authentication/getlicenseinfo">license</a>. Some license don't let you upload the records to the cloud.</p> |
| currOptOut  | `boolean` | <p>The current configuration of the opt-out.</p><p>If this value is <strong>true</strong>, then the records created by your application won't be uploaded to the cloud. If this value is <strong>false</strong>, then they will.</p>                                                                  |
| message     | `string`  | A text message.                                                                                                                                                                                                                                                                                       |

## Possible Configurations

Here is an overview of the possible configurations:

| **optOutAvail** | forceOptOut | currOptOut                     | Description                                                                                                                                                                                                        |
| --------------- | ----------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **true**        | **false**   | Variable, **false** by default | <p>By default, <strong>currOptOut</strong> is <strong>false</strong> and the records created by your application will be uploaded to the cloud.<br>You can change the opt-out configuration for each EmotivID.</p> |
| **true**        | **true**    | Always **true**                | The records will **never** be uploaded to the cloud. You cannot change the configuration.                                                                                                                          |
| **false**       | **false**   | Always **false**               | The records will **always** be uploaded to the cloud. You cannot change the configuration.                                                                                                                         |
| **false**       | **true**    | Always **false**               | The records will **always** be uploaded to the cloud. You cannot change the configuration.                                                                                                                         |

## Examples

### Get the current configuration

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

```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "configOptOut",
    "params": {
        "cortexToken": "xxx",
        "status": "get"
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "currOptOut": false,
        "forceOptOut": false,
        "message": "Get opt-out configuration successfully",
        "optOutAvail": true
    }
}
```

{% endtab %}
{% endtabs %}

### Change the configuration

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

```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "configOptOut",
    "params": {
        "cortexToken": "xxx",
        "status": "set",
        "newOptOut": true
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "currOptOut": true,
        "forceOptOut": false,
        "message": "Update opt-out configuration successfully",
        "optOutAvail": true
    }
}
```

{% endtab %}
{% endtabs %}
