# facialExpressionThreshold

This method can get or set the threshold of a facial expression action for a specific profile.

Actions with a low threshold are less likely to be detected. Actions with a high threshold will be detected more often.

## Parameters

| Name        | Type     | Required | Description                                                                                                                       |
| ----------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| cortexToken | `string` | yes      | A token returned by [authorize](/cortex-api/authentication/authorize.md).                                                         |
| status      | `string` | yes      | Must be "get" or "set".                                                                                                           |
| action      | `string` | yes      | You get or set the threshold for this action.                                                                                     |
| profile     | `string` | no       | A profile name.                                                                                                                   |
| session     | `string` | no       | A session id returned by [createSession](/cortex-api/session/createsession.md).                                                   |
| value       | `number` | no       | If the **status** is "set", this parameter must be a number between 0 and 1000. This will be the new threshold of the **action**. |

You must set one of these 2 parameters: **profile** or **session**. [Read this](/cortex-api/advanced-bci.md#profile-name-or-session-id) for details.

## Result

If the **status** is "get", then the result is a `number` that is the current threshold of the **action**.\
If the **status** is "set", then the result is a `string` that is a success message.

## Examples

### Get

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

```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "facialExpressionThreshold",
    "params": {
        "action": "blink",
        "cortexToken": "xxx",
        "session": "1d5d3655-d570-4731-9faf-967bc5440dc5",
        "status": "get"
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "id":1,
    "jsonrpc":"2.0",
    "result":500
}
```

{% endtab %}
{% endtabs %}

### Set

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

```javascript
{
    "id": 2323514,
    "jsonrpc": "2.0",
    "method": "facialExpressionThreshold",
    "params": {
        "action": "surprise",
        "cortexToken": "xxx",
        "session": "1d5d3655-d570-4731-9faf-967bc5440dc5",
        "status": "set",
        "value": 703
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "id": 2323514,
    "jsonrpc": "2.0",
    "result": "success"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emotiv.gitbook.io/cortex-api/advanced-bci/facialexpressionthreshold.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
