# getTrainingTime

This method returns the duration of a training. It is the approximate time needed by Cortex to decide if a training is a success or a failure. See [BCI](https://emotiv.gitbook.io/cortex-api/bci) for details.

## Parameters

| Name        | Type     | Required | Description                                                                                           |
| ----------- | -------- | -------- | ----------------------------------------------------------------------------------------------------- |
| cortexToken | `string` | yes      | A token returned by [authorize](https://emotiv.gitbook.io/cortex-api/authentication/authorize).       |
| detection   | `string` | yes      | Must be "mentalCommand" or "facialExpression".                                                        |
| session     | `string` | yes      | A session id returned by [createSession](https://emotiv.gitbook.io/cortex-api/session/createsession). |

## Result

The result is an object containing these fields:

| Name      | Type     | Description                                        |
| --------- | -------- | -------------------------------------------------- |
| time      | `number` | The approximate duration of a training, in second. |
| detection | `string` | The **detection** you set in the request.          |

The **time** should be 8 seconds, for both mental command and facial expression.

## Examples

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

```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "getTrainingTime",
    "params": {
        "cortexToken": "xxx",
        "detection": "mentalCommand",
        "session": "xxx"
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "time": 8,
        "detection": "mentalCommand"
    }
}
```

{% endtab %}
{% endtabs %}
