arrow-left

Only this pageAll pages
gitbookPowered by GitBook
1 of 75

Cortex API V4

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

createSubject

This method is to create a new subject. Then you can associate the subject to a record when you call createRecord.

This method was added in Cortex 2.1

hashtag
Parameters

Name

hashtag
Result

The result is a representing the new subject.

hashtag
Examples

Create a subject with only his name.

Create a subject with more information.

Type

Required

Description

cortexToken

string

yes

A token returned by .

subjectName

string

yes

The name of the subject. Must be 30 characters or less.

dateOfBirth

string

no

The date of birth of the subject. The format must be "YYYY-MM-DD", e.g. "1980-12-25".

sex

string

no

Must be "M", "F" or "U". These letters stands for male, female and unknown respectively.

countryCode

string

no

The of the country the subject lives in.

state

string

no

The state the subject lives in.

city

string

no

The city the subject lives in.

attributes

array of objects

no

A list of demographic attribute objects. See .

subject object
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "createSubject",
    "params": {
        "cortexToken": "xxx",
        "subjectName": "Bob Smith"
    }
}
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "attributes": [],
        "city": "",
        "countryCode": "",
        "countryName": "",
        "dateOfBirth": "",
        "experimentsCount": 0,
        "modifiedDatetime": "2019-07-01T11:41:25.270+07:00",
        "sex": "U",
        "state": "",
        "subjectName": "Bob Smith"
    }
}
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "createSubject",
    "params": {
        "cortexToken": "xxx",
        "subjectName": "Alice Smith",
        "city": "London",
        "countryCode": "GB",
        "dateOfBirth": "1980-12-25",
        "sex": "F",
        "attributes": [
            {
                "name": "Handedness",
                "value": "Left"
            },
            {
                "name": "Education",
                "value": "Master's degree"
            }
        ]
    }
}
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "attributes": [
            {
                "name": "Handedness",
                "value": "Left"
            },
            {
                "name": "Education",
                "value": "Master's degree"
            }
        ],
        "city": "London",
        "countryCode": "GB",
        "countryName": "",
        "dateOfBirth": "1980-12-25",
        "experimentsCount": 0,
        "modifiedDatetime": "2019-07-01T11:23:11.644+07:00",
        "sex": "F",
        "state": "",
        "subjectName": "Alice Smith"
    }
}
authorize
Alpha-2 ISO codearrow-up-right
Subject object

Connecting to the Cortex API

On Windows and MacOS, the Cortex service is a background process that communicates with the EMOTIV headsets and the EMOTIV cloud. It is also a WebSocketarrow-up-right server that uses the JSON-RPCarrow-up-right protocol.

hashtag
WebSocket

Communicate with the Cortex API using the WebSocket Securearrow-up-right protocol.

Create a WebSocket client and connect to localhost on the port 6868, using the wss protocol.

Any WebSocket client should work in any programming language. You can even use a web browser plugin or an .

Please note that Cortex only supports the WebSocket Secure (wss) protocol. It doesn't support the plain WebSocket (ws) protocol without encryption.

circle-info

To try the Cortex API, open a secure WebSocket connection to wss://localhost:6868 and send the message {"id":1,"jsonrpc":"2.0","method":"getCortexInfo"}

hashtag
Cortex security certificate

The Cortex web socket server uses a self-signed certificate. When you install Emotiv softwares, the installer has already installed the Emotiv Root CA file and ask the system to trust it, so most of the time, your application don't need to configure anything else. However, for some programming languagues or for remote connections to Pi, you must configure a custom Certificate Authorities (CA) to trust Cortex websocket connection.

For example, on Android, you must configure the application like or if you use python, you can configure the application like .

Here is .

hashtag
Remote connections

Since 2.7.1 release, we support remote connections to Cortex running on Raspberry Pi device. It requires some steps:

  • Grant the permissions to a desktop machine before an app on that machine can connect to the Cortex web socket server on Raspberry Pi device, using tool.

  • Connect using the IP address:

    • Only applied if the IP address of your Raspberry Pi device is in the below range:

circle-info

Please note that websocket server on Raspberry Pi accepts only 1 remote connection at a time (not counting the remote connection from EMOTIVApp).

hashtag
JSON-RPC

After you have successfully opened the WebSocket connection, communicate with Cortex using the protocol.

Call methods, with or without parameters, and Cortex sends back a result or an error.

Call an API method by sending a JSON object with these fields:

The response from Cortex is a JSON object with these fields:

Here is a simple fictional example:

Please read the for details.

hashtag
Test API request and response

You can try with the most simple API of Cortex: .

hashtag
Next step

The rest of this documentation will show you what methods are available, what parameters they take, and how to use these methods.

But first, you should start with the .

  • 10.[0-1].[0-2].[0-255]

  • 172.[16-17].[0-2].[0-255]

  • 192.168.[0-5].[0-255]

  • Create a WebSocket client and connect to<IP address of Raspberry Pi device>

    on the port 6868, using the wss protocol.

  • Connect using the DNS name:

    • Can be applied for any value of IP address of your Raspberry Pi device.

    • Add this line into the host file of the desktop machine:<IP address of Raspberry Pi device> emotiv-cortex.remote

    • Create a WebSocket client and connect to emotiv-cortex.remote on the port 6868, using the wss protocol.

  • no

    The parameters of the method, if it has any

    id

    number or string

    no

    The id of this request. Cortex will include this id into the response message, so you can can match the response with the request

    The id you included in the request

    Name

    Type

    Required

    Description

    jsonrpc

    string

    yes

    Must be "2.0"

    method

    string

    yes

    The name of the API method you want to call

    params

    Name

    Type

    Description

    jsonrpc

    string

    Is always "2.0"

    result

    any

    If the method is successful, contains the result of the method. The type depends on the method

    error

    object

    If the method failed, contains an error code and an error message

    id

    online clientarrow-up-right
    thisarrow-up-right
    thisarrow-up-right
    the link to the Emotiv Root CA filearrow-up-right
    cortexaccess
    JSON-RPC 2.0arrow-up-right
    JSON-RPC 2.0 specificationarrow-up-right
    getCortexInfo
    overview of the API flow

    object

    number or string

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "area",
        "params": {
            "width": 6,
            "length": 7
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": 42
    }

    Offline support

    Once the app authenticates with the Cortex successfully, it can use the Cortex token to stay offline while working with Cortex for a period of time (see soft limit, hard limit below).

    Here is the recommended flow to work offline with Cortex:

    Step 1: Follow this API flow to get Cortex token the first time. This flow requires the Internet connection. A Cortex token will be available for 48 hours.

    Step 2: When the Cortex token is expired, call generateNewToken API to generate another token. This API doesn't require the Internet connection.

    Step 3: Check soft limit, hard limit of the current license via getLicenseInfo API and warn the users to be online.

    In the license information, there are 2 fields "softLimitTime" and "hardLimitTime".

    hashtag
    softLimitTime

    This is the reasonable time to warn users that the app will not be able to use offline soon. The app can still work offline until hardLimitTime.

    hashtag
    hardLimitTime

    This is the time that the app will be no longer to use offline. The app must call API with the Internet connection to be able to continue working with Cortex.

    circle-info

    The softLimitTime will be at least 1 month later from the time the app calls API. The hardLimitTime is 7 days after softLimitTime.

    Getting Started

    This documentation contains guidance for developing applications with EMOTIV Cortex - the core piece of technology at EMOTIV which brings the brain computer interface to consumer.

    The intended audience is anyone with some programming skills who wants to develop a third party application that interacts with an EMOTIV headset.

    The Cortex API is built on JSON and WebSockets, making it easy to access from a variety of programming languages and platforms.

    hashtag
    System requirements and supported platforms

    Learn more about .

    hashtag
    Supported headsets

    Currently, Cortex supports the following headsets:

    USB dongle refers to the USB receiver that comes with EPOC+. If you need an additional receiver, you can purchase it from the EMOTIV.

    circle-info

    Currently, it is not possible to use a Flex or a MN8 headset with Cortex on Raspberry Pi.

    hashtag
    Virtual Brainwear

    In addition to physical EMOTIV headsets, users can create virtual headsets (a “Virtual Brainwear®”) using the EMOTIV Launcher, which emulates device states and data streams for development purposes.

    Important caveat: Records captured using a virtual headset are local to that machine and will not be synced to another device or transferred between machines.

    For more details on creating and using virtual devices, see “”

    hashtag
    Prerequisites

    hashtag
    Create an EmotivID

    As with other EMOTIV services, you are required to have an EmotivID account. You can create an ID on .

    hashtag
    License

    If you’re ready to start developing with EMOTIV’s Cortex SDK, one of your first steps is registering your Cortex App ID. Whether you’re working with consumer devices like the Insight or MN8, or exploring options with professional-grade hardware such as the EPOC X or EPOC Flex, this guide will walk you through how to get started with consumer devices.

    hashtag
    Understanding Cortex API Access Levels

    EMOTIV’s Cortex SDK supports multiple EEG and behavioral data streams. These are grouped into Basic (BCI API) and Premium categories:

    Basic (BCI API) Includes:

    • Mental Commands API

    • Facial Expression API

    • Frequency Band API

    • Motion Data API

    Premium API Includes:

    • Raw EEG API

    • High-resolution Performance Metrics (2 Hz)

    Consumer devices (Insight, MN8) will allow access to all data streams through our Developer SDK and API. You can register here to get started: . Professional devices (EPOC X and EPOC Flex) include free access to the Basic BCI API. To access the Premium API, however, a premium Developer API license is required. If you don't have a valid Developer API license, please submit your SDK application and specify the level of data stream you wish to access with your professional device. Our support team will then guide you on the appropriate licensing option to get started.

    hashtag
    Create a Cortex App

    To learn how to register your Cortex App ID and begin development, please refer to .

    hashtag
    Client ID and Client Secret

    Once you register your Cortex App ID, you will receive a Client ID and Client Secret, which serve as unique identifiers for your software application. These will be used as input parameters for some authentication Cortex API calls.

    The "Client ID" and "Client Secret" similar to a username and password, are automatically generated by EMOTIV for each version of your software application.

    hashtag
    The Cortex Examples

    To help you getting started with your application, EMOTIV provides basic examples in various programming languages. There are open source and hosted by Github at

    If you have difficulty with the Cortex API, you can also on this Github repository.

    hashtag
    Next Step

    If you are upgrading your application from Cortex 1.x to Cortex 2.x, then please be aware that the Cortex API has significantly changed. Please read the for details.

    If you are new to the Cortex API, then please start with .

    Overview of API flow

    There are a few steps to prepare before you can get the data streaming out from Cortex web socket server:

    1. First you have to login to the EMOTIV Launcher with your EmotivID.

    2. Make sure that you are using the correct application ID, client ID and client secret that you generated from the Account dashboard on Emotiv website in your application (see here).

    3. Call the API from your app to Cortex, and accept via the EMOTIV Launcher.

    4. After access is granted, connect your EMOTIV brainwear headset via the USB dongle or Bluetooth.

    5. Call the API with "refresh" command to start the headset scanning.

    6. Call the API to list the available headsets.

    7. Call the API with "connect" command to connect to the desire headset.

    8. Call the API to get a Cortex token for subsequence requests.

    9. Call the API to open up a new session and be ready for BCI data streaming.

    getCortexInfo

    This method returns information about the Cortex service, like its version and build number.

    hashtag
    Parameters

    This method has no parameter.

    hashtag
    Result

    The result is an object with these fields:

    hashtag
    Example

    hasAccessRight

    Check if your application has been granted access rights or not in .

    circle-check

    Any application that connects to Cortex must request approval from the user through . See for details.

    hashtag

    authorize
    authorize

    Name

    Type

    Description

    buildDate

    string (date time)

    The date and time the Cortex binary was built

    buildNumber

    string

    The internal build number

    version

    string

    The version of Cortex. It should have the format "2.y.z"

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "getCortexInfo"
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "buildDate":"2019-05-29T14:09:19",
            "buildNumber":"25cf08bd",
            "version":"2.0.0"
        }
    }

    Authentication

    After your application is successfully connected to the Cortex service, you must go through the authentication procedure.

    First, you should call getUserLogin to check if the user has already logged in though EMOTIV Launcherarrow-up-right. Then, you must call requestAccess to ask the user to approve your application.

    Finally, call authorize to generate a Cortex token or you can reuse a token that you previously got from this method, if it is not expired.

    USB dongle, BLE 4.0

    Insight

    All

    USB dongle, BLE 4.0

    All

    BLE 4.0

    All

    BLE 4.0

    All

    nRF dongle with BLE 5, BLE 5.x

    Low-resolution Performance Metrics (0.1 Hz)

    Model

    Firmware

    Connection

    EPOC

    All

    USB dongle

    EPOC+arrow-up-right

    All

    USB dongle, BLE 4.0

    EPOC Xarrow-up-right

    All

    USB dongle, BLE 4.0

    Bluetooth® 5.0 will be available with upcoming software and firmware updates

    EPOC Flexarrow-up-right

    the system requirements and support platforms for Cortexarrow-up-right
    storearrow-up-right
    Devices - Setting up virtual Brainwear®arrow-up-right
    www.emotiv.comarrow-up-right
    https://www.emotiv.com/pages/developerarrow-up-right
    herearrow-up-right
    this guidearrow-up-right
    https://github.com/Emotiv/cortex-v2-examplearrow-up-right
    open an issuearrow-up-right
    release notes
    Connecting to the Cortex API

    All

    Parameters

    Name

    Type

    Required

    Description

    clientId

    string

    yes

    The client id of your Cortex application

    clientSecret

    string

    yes

    The client secret of your Cortex application

    hashtag
    Result

    The result is an object containing a boolean value "accessGranted" and a message.

    Name

    Type

    Description

    accessGranted

    boolean

    True, if the user has already approved your application False, if the user declined your application, or didn't approve it yet

    message

    string

    If accessGranted is false, then your application should call requestAccess If accessGranted is true, then no action is required

    hashtag
    Examples

    {
        "id": 1,
        "
    
    {
        "id": 1,
        "
    
    EMOTIV Launcherarrow-up-right
    EMOTIV Launcherarrow-up-right
    requestAccess
    requestAccess
    controlDevice
    queryHeadsets
    controlDevice
    authorize
    createSession

    getUserLogin

    Get the current logged in user.

    circle-check

    There is no login or logout API in Cortex. Instead, users are required to login through the EMOTIV Launcherarrow-up-right.

    hashtag
    Parameters

    This method has no parameter.

    hashtag
    Result

    The result is an array of objects, each object describes a logged in user. If no user is logged in, then the result is an empty array.

    Please note that currently, Cortex is a single user system. Only one user can login at a time, so the result contains at most one object.

    The user object includes these fields:

    If currentOSUId is equal to loggedInOSUId, then the user is already logged in and can work with Cortex. If currentOSUId is different from loggedInOSUId, then a user is logged into Cortex, but from a different OS account. So the user of the current OS account cannot work with Cortex, and must check EMOTIV Launcher.

    hashtag
    Examples

    hashtag
    No user is logged in

    hashtag
    A user is logged in from the current OS account

    hashtag
    A user is logged in from another OS account

    The application is connected to Cortex that belongs to the OS account 501/jsnow. But someone has already logged in to Cortex from OS account 502/astark with the EmotivID aria.stark. So, the application cannot work with Cortex.

    generateNewToken

    This method uses a Cortex token to generate a new Cortex token. You can use this method to extend the expiration date of a token.

    See authorize for details.

    hashtag
    Parameters

    Name

    hashtag
    Result

    The result is an object containing a field cortexToken.

    hashtag
    Example

    jsonrpc
    "
    :
    "
    2.0
    "
    ,
    "method": "hasAccessRight",
    "params": {
    "clientId": "xxx",
    "clientSecret": "xxx"
    }
    }
    jsonrpc
    "
    :
    "
    2.0
    "
    ,
    "result": {
    "accessGranted":true,
    "message":"The User has granted access right to this application."
    }
    }

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize

    clientId

    string

    yes

    The client id of your Cortex application

    clientSecret

    string

    yes

    The client secret of your Cortex application

    Name

    Type

    Description

    cortexToken

    string

    The new Cortex token of the user

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "generateNewToken",
        "params": {
            "cortexToken": "xxx",
            "clientId": "...",
            "clientSecret": "..."
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "cortexToken": "yyy"
        }
    }

    Headsets

    After you finish the authentication process, your application should start headset scanning to search for EMOTIV headsets, using the method controlDevice with "refresh" command, then use the method queryHeadsets to get the discovered headsets.

    If the headset is not connected to Cortex yet, then you must call controlDevice with "connect" command.

    See also Headset object for details.

    The id of the OS account used to login in EMOTIV Launcher

    loggedInOSUsername

    string

    The user name for loggedInOSUId

    lastLoginTime

    string (ISO datetime)

    When this user logged in for the last time.

    This field was added in Cortex 2.3.0

    Name

    Type

    Description

    username

    string

    The EmotivID of the user

    currentOSUId

    string

    The id of the current OS account

    currentOSUsername

    string

    The user name for currentOSUId

    loggedInOSUId

    string

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "getUserLogin"
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": []
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "getUserLogin"
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": [{
            "currentOSUId":"501",
            "currentOSUsername":"jsnow",
            "lastLoginTime": "2019-11-28T12:09:17.300+07:00",
            "loggedInOSUId":"501",
            "loggedInOSUsername":"jsnow",
            "username":"jon.snow"
        }]
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "getUserLogin"
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": [{
            "currentOSUId":"501",
            "currentOSUsername":"jsnow",
            "lastLoginTime": "2019-11-28T12:09:17.300+07:00",
            "loggedInOSUId":"502",
            "loggedInOSUsername":"astark",
            "username":"aria.stark"
        }]
    }
    Insight 2.0arrow-up-right
    MN8arrow-up-right

    getUserInformation

    This method returns basic information about the current user.

    hashtag
    Parameters

    Name

    Type

    Required

    Description

    hashtag
    Result

    The result is an object containing basic information about the user.

    hashtag
    Examples

    requestAccess

    Request user approval for the current application through EMOTIV Launcherarrow-up-right.

    When your application calls this method for the first time, EMOTIV Launcher displays a message to approve your application. You can call this API many times, but EMOTIV Launcher will prompt the user only once. If the user has already approved your application, then this API does nothing.

    Almost all the methods of the API require that your application was approved in EMOTIV Launcher. These methods will return an error if your application wasn't approved.

    circle-check

    Any application that connects to Cortex must call this API to request approval from the user through .

    triangle-exclamation

    Most of the methods of the API will fail if the user didn't approve your application.

    hashtag
    Parameters

    hashtag
    Result

    The result is an object containing a boolean value "accessGranted" and a message.

    If accessGranted is false, then your application should ask the user to check EMOTIV Launcher and approve your application. Then you should wait for a while and call this API again. If accessGranted is true, then no action is required.

    hashtag
    Examples

    hashtag
    Application was already approved

    hashtag
    Application is not approved yet, or declined

    getLicenseInfo

    This method returns information about the license currently used by your application.

    hashtag
    Parameters

    updateHeadset

    This method lets you change the settings of an EPOC+ or EPOC X headset.

    You can configure the EEG sample rate, EEG resolution, motion data sample rate, and motion data resolution. You can check the current settings of a headset using the method .

    This method is for EPOC+ and EPOC X headsets only. There are no configuration settings for other EMOTIV headsets.

    Please note that updating the configuration of a headset can take a few seconds.

    circle-info

    Headset object

    Some methods of the API return one or more headset objects, for example . A also includes a headset object.

    hashtag
    Description

    A headset object include these fields:

    An object that contain information about the EULA agreement

    cortexToken

    string

    yes

    A token returned by authorize

    Name

    Type

    Description

    username

    string

    The EmotivID of the user

    firstName

    string

    The first name of the user

    lastName

    string

    The last name of the user

    licenseAgreement

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "getUserInformation",
        "params": {
            "cortexToken": "xxx"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "username": "jon.snow",
            "firstName": "Jon",
            "lastName": "Snow",
            "licenseAgreement": {
                "accepted": true,
                "licenseUrl": "https://..."
            }
        }
    }

    object

    Name

    Type

    Required

    Description

    clientId

    string

    yes

    The client id of your Cortex application

    clientSecret

    string

    yes

    The client secret of your Cortex application

    Name

    Type

    Description

    accessGranted

    boolean

    True, if the user has already approved your application False, if the user declined your application, or didn't approve it yet

    message

    string

    EMOTIV Launcherarrow-up-right
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "requestAccess",
        "params": {
            "clientId": "xxx",
            "clientSecret": "xxx"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "accessGranted":true,
            "message":"The User has granted access right to this application."
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "requestAccess",
        "params": {
            "clientId": "xxx",
            "clientSecret": "xxx"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "accessGranted":false,
            "message":"The User has not granted access right to this application. Please use Emotiv App to proceed."
        }
    }

    cortexToken

    string

    yes

    A token returned by

    hashtag
    Result

    The result is an object containing a license object and the isOnline flag.

    Name

    Type

    Description

    license

    object

    An object containing all the information about the current license

    isOnline

    boolean

    True, if Cortex was able to get the license information from the EMOTIV cloud

    False, if Cortex got the license information for its local cache

    hashtag
    Example

    {
        "id": 1,
        "
    
    {
        "id": 1,
        "
    

    Name

    Type

    Required

    Description

    The user must connect the headset to the computer by using a USB cable before calling this method. You can't configure the headset through a wireless connection. You can use queryHeadsets to check how the headset is connected.

    hashtag
    Parameters

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by .

    headset

    string

    yes

    A headset id returned by .

    setting

    The setting parameter must be an object with these fields:

    Name

    Type

    Required

    Description

    mode

    string

    yes

    Must be "EPOC" or "EPOCPLUS".

    In "EPOC" mode, the EEG resolution is 14 bits.

    In "EPOCPLUS" mode, the EEG and motion resolutions are 16 bits.

    eegRate

    number

    yes

    The EEG sample rate, in hertz. If the mode is "EPOC", then the EEG rate must be 128.

    If the mode is "EPOCPLUS", then the EEG rate can be 128 or 256.

    memsRate

    circle-info

    A motion rate of zero means that the motion sensors are disabled.

    hashtag
    Result

    The result is an object containing these fields:

    Name

    Type

    Description

    headsetId

    string

    The headset id you set in the parameters.

    message

    string

    A success message.

    In Cortex 2.3.0 and earlier, you just need to check the result of the method. If the method doesn't return any error, then it means that the update is successful.

    However, since Cortex 2.4.0, the result of the method just tells you that the update is in progress. You must wait for a warning object with code 110 or 111 to know if the update is successful or not.

    If your configuration is not compatible with a Bluetooth connection then you will receive a warning with code 112. Your configuration will work fine with a USB dongle. To use the headset with a Bluetooth connection, you must set the EEG rate to 128Hz and disable the motion sensors.

    hashtag
    Examples

    Set the EEG rate to 256 hertz (16 bits) and the motion rate to 64 hertz (16bits)

    Set the EPOC+ headset in EPOC mode, EEG rate at 128 hertz (14 bits) and disable the motion sensors.

    queryHeadsets

    Description

    id

    string

    The id of this headset.

    status

    string

    Can be "discovered", "connecting", or "connected".

    connectedBy

    string

    Can be "bluetooth", "dongle", "usb cable", or "extender".

    dongle

    string

    The version of the dongle firmware.

    firmware

    string

    The version of the headset firmware.

    motionSensors

    array of strings

    The names of the motion sensors of this headset.

    sensors

    array of strings

    The names of the EEG sensors of this headset. Use the international 10-20 system.

    settings

    object

    An object containing the configuration of the EEG and motion data of this headset.

    flexMappings

    object

    If the headset is an EPOC Flex, then this field is an object containing information about the mapping of the EEG channels.

    headbandPosition

    string

    If the headset is an EPOC X, then this field tells you the position of the headband of this headset. Can be "back" or "top". If the headset is not an EPOC X, then this field is null. See for details.

    This field was added in Cortex 2.4

    customName

    string

    The custom name of the headset. The user can set it in EMOTIV Launcher.

    This field was added in Cortex 2.4

    isVirtual

    boolean

    True if the headset is a virtual Brainwear. False otherwise.

    hashtag
    Status

    When you want to work with a headset, it is important to check its status.

    Status

    Description

    discovered

    Cortex has detected the headset, but it is not connected. You cannot create a session for a discovered headset. You can call to connect the headset.

    connecting

    Cortex is trying to connect to this headset. This can take a few seconds.

    connected

    Cortex is connected to and receives data from this headset. You can call and start working with this headset.

    You can call to disconnect the headset.

    hashtag
    Settings

    The settings object include these fields:

    Name

    Type

    Description

    mode

    string

    Can be "EPOC", "EPOCPLUS", or "EPOCFLEX"

    eegRate

    number

    The EEG sample rate, in hertz.

    eegRes

    number

    The EEG resolution, in bits.

    memsRate

    For an Epoc+ headset, the mode can be "EPOC" or "EPOCPLUS", depending on its configuration. See updateHeadset for details. For an Insight or Epoc headset, the mode is always "EPOC". For an Epoc Flex headset, the mode is always "EPOCFLEX".

    circle-info

    A motion rate of zero means that the motion sensors are disabled.

    hashtag
    Flex Mapping

    Currently, the flexMappings object contains a single field. It may include more fields in the future.

    Name

    Type

    Description

    mappings

    object

    Describe which EEG channel is mapped to which physical connector of EPOC Flex device. The keys are the names of the connectors, the values are the names of the EEG channels.

    Example: { "CMS": "TP8", "DRL": "P6", "RM": "TP10", "RN": "P4", "RO": "P8" }

    hashtag
    Examples

    hashtag
    Insight

    hashtag
    Epoc+

    hashtag
    Virtual MN8

    Name

    queryHeadsets
    session object

    Type

    queryHeadsets

    Discover details about headsets connected to your device via USB dongle, USB cable, or Bluetooth or virtual headsets enabled through the EMOTIV Launcher. Additionally, search for a specific headset using its ID or apply a wildcard for partial matches.

    hashtag
    Parameters

    Name

    Type

    Required

    For the parameter id, you can use these wildcards:

    hashtag
    Result

    The result is an array of , or an empty array if no headset matches the request.

    hashtag
    Examples

    hashtag
    Query all the headsets

    If no headset matches your request, then the result is an empty array.

    hashtag
    Query a headset by its id

    hashtag
    Query all the Insight headsets

    authorize

    This method is to generate a Cortex access token. Most of the methods of the Cortex API require this token as a parameter.

    Application can specify the license key and the amount of sessions to be debited from the license and use them locally.

    hashtag
    Cortex token

    The token is linked to your application. It cannot be used with another application. The token is also linked to the EmotivID of the current user. It cannot be used with another EmotivID. So if the user logs out in EMOTIV Launcherarrow-up-right, and then logs in with another EmotivID, your application must call this API again to get a new token.

    Your application can save the Cortex token and reuse it later, within 2 days. Note that it is the responsibility of the application to secure the token.

    triangle-exclamation

    The Cortex token must remain secret. Do NOT share it. It is your responsibility to keep it secure.

    Once having Cortex token, the app can .

    hashtag
    EULA not accepted warning

    If the user has not accepted the EULA, then a warning message will be included in the response as well. The user must accept the EULA through EMOTIV Launcher.

    circle-info

    Before you call this method, the user must approve your application in . See for details.

    hashtag
    Parameters

    hashtag
    Result

    The result is an object containing a field cortexToken. It may also include a field warning, if the user didn't accept the EULA.

    hashtag
    Examples

    Sessions

    A session is an object that makes the link between your application and an EMOTIV headset. When the user wants to work with a headset, your application should create a session first. Then you can:

    • subscribe to the data stream of the headset

    • create a record and add markers

    • use

    Your application can open only one session at a time with a given headset. But it can open multiple sessions with multiple headsets.

    hashtag
    Session lifetime

    A session is created by and closed by .

    A session is linked to an application. All the sessions of an application are automatically closed when the application is disconnected from the Cortex service. A session is also closed if the headset is disconnected.

    A session is a temporary in-memory object, it is not persistent. After a session is closed, it is destroyed by Cortex. If you want to create a persistent object, please inside your session. See for details.

    hashtag
    Session activation

    When you create a session, you can activate it or leave as is.

    If the session is not activated, then it doesn't use the license of the user. You cannot subscribe to the EEG stream and you are limited to the low resolution performance metrics. You can neither create a nor .

    If the session is activated, then it uses the license of the user. Depending on the license scope of the license, you can subscribe to the EEG stream or high resolution performance metrics. If the license has a session quota, then this session will be debited from this quota.

    Use and check the field status to know if a session was activated or not.

    updateHeadsetCustomInfo

    This method lets you set the headband position of an EPOC X headset.

    The headband position is important to interpret the motion data coming from the headset. The motion sensor is located in the headband. So Cortex uses the headband position to know the orientation of the motion sensor.

    When you Cortex saves the current headband position into the record. So you should set the position before starting the record.

    This method was added in Cortex 2.4

    hashtag

    configMapping

    The configMapping API manages EEG channel mapping configurations for a EPOC Flex headset. This API allows you to create, get, read, update and delete mapping configurations.

    To connect to an EPOC Flex headset, you must input a specific EEG channel mapping or the name of an existing mapping for the current Emotiv user.

    hashtag
    Parameters

    syncWithHeadsetClock

    This method lets you synchronize the monotonic clock of your application with the monotonic clock of Cortex. It is an important step if you want to with a high precision.

    Cortex uses a different clock for each headset and it initializes this clock when the headset is connected by Bluetooth or USB dongle. This means that:

    • You must call “syncWithHeadsetClock” after the headset is connected, not before.

    controlDevice

    This method is to connect or disconnect a headset. It can also refresh the list of available Bluetooth headsets returned by .

    Please note that connecting and disconnecting a headset can take a few seconds.

    Before you call on a headset, make sure that Cortex is connected to this headset. You can use to check the connection status of the headset.

    circle-info

    This method is not available on iOS. On iOS the user must connect and disconnect the headset in EMOTIV App.

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "updateHeadset",
        "params": {
            "cortexToken": "xxx",
            "headsetId": "EPOCPLUS-3B9AXXXX",
            "setting": {
                "mode": "EPOCPLUS",
                "eegRate": 256,
                "memsRate": 64
            }
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "headsetId": "EPOCPLUS-3B9AXXXX",
            "message": "..."
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "updateHeadset",
        "params": {
            "cortexToken": "xxx",
            "headsetId": "EPOCPLUS-3B9AXXXX",
            "setting": {
                "mode": "EPOC",
                "eegRate": 128,
                "memsRate": 0
            }
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "headsetId": "EPOCPLUS-3B9AXXXX",
            "message": "..."
        }
    }
    {
      "id": "INSIGHT-AAAA0000",
      "status": "connected",
      "connectedBy": "dongle",
      "customName": "",
      "dongle": "6ff",
      "firmware": "930",
      "motionSensors": [
        "Q0",
        "Q1",
        "Q2",
        "Q3",
        "ACCX",
        "ACCY",
        "ACCZ",
        "MAGX",
        "MAGY",
        "MAGZ"
      ],
      "sensors": [
        "AF3",
        "T7",
        "Pz",
        "T8",
        "AF4"
      ],
      "settings": {
        "eegRate": 128,
        "eegRes": 14,
        "memsRate": 64,
        "memsRes": 14,
        "mode": "INSIGHT"
      },
      "isVirtual": false
    }
    {
        "id": "EPOCPLUS-3B9AXXXX",
        "status": "connected",
        "connectedBy": "dongle",
        "customName": "",
        "dongle": "6ff",
        "firmware": "625",
        "motionSensors": [
            "GYROX",
            "GYROY",
            "GYROZ",
            "ACCX",
            "ACCY",
            "ACCZ",
            "MAGX",
            "MAGY",
            "MAGZ"
        ],
        "sensors": [
            "AF3",
            "F7",
            "F3",
            "FC5",
            "T7",
            "P7",
            "O1",
            "O2",
            "P8",
            "T8",
            "FC6",
            "F4",
            "F8",
            "AF4"
        ],
        "settings": {
            "eegRate": 256,
            "eegRes": 16,
            "memsRate": 64,
            "memsRes": 16,
            "mode": "EPOCPLUS"
        },
        "isVirtual": false
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": [
        {
          "connectedBy": "bluetooth",
          "customName": "virtual mn8",
          "dfuTypes": ["dfuNone"],
          "dongle": "0",
          "firmware": "23",
          "firmwareDisplay": "0x23",
          "headbandPosition": null,
          "id": "MN8-2DC3C2D9",
          "isDfuMode": false,
          "isVirtual": true,
          "motionSensors": ["Q0", "Q1", "Q2", "Q3"],
          "sensors": ["T7", "T8"],
          "settings": {
            "eegRate": 128,
            "eegRes": 14,
            "memsRate": 6,
            "memsRes": 10,
            "mode": "MN8"
          },
          "status": "connected",
          "virtualHeadsetId": "2dc3c2d9-cfe1-461b-983b-f187437b91e0"
        }
      ]
    }
    BCI
    createSession
    updateSession
    create a record
    Records
    record
    markers
    querySessions
    jsonrpc
    "
    :
    "
    2.0
    "
    ,
    "method": "getLicenseInfo",
    "params": {
    "cortexToken": "xxx"
    }
    }
    jsonrpc
    "
    :
    "
    2.0
    "
    ,
    "result": {
    "isOnline":true,
    "license":{
    "applications":["com.emotiv.emotivpro"],
    "billingFrom":"2018-08-23T07:00:00.000+07:00",
    "billingTo":"2019-09-23T07:00:00.000+07:00",
    "deviceInfo":{
    "deviceLimit":15,
    "devicesPerSeat":3,
    "sessionLimit":{"day":null,"month":null,"year":null}
    },
    "expired":false,
    "extenderLimit":30,
    "hardLimitTime":"2019-07-01T06:59:59.999+07:00",
    "isCommercial":false,
    "licenseId":"xxx",
    "licenseName":"PRO license",
    "localQuota":0,
    "maxDebit":null,
    "scopes":["eeg","pm"],
    "seatCount":5,
    "sessionCount":0,
    "softLimitTime":"2019-06-24T06:59:59.999+07:00",
    "totalDebit":0,
    "totalRegisteredDevices":1,
    "validFrom":"2018-08-23T07:00:00.000+07:00",
    "validTo":"2019-09-24T06:59:59.999+07:00"
    }
    }
    }
    authorize

    object

    yes

    An object containing the setting to apply. See below.

    number

    yes

    The motion sample rate, in hertz.

    If the mode is "EPOC", then the motion rate must be 0.

    If the mode is "EPOCPLUS", then the motion rate can be 0, 32, 64 or 128.

    authorize
    queryHeadsets

    number

    The motion data sample rate, in hertz.

    memsRes

    number

    The motion data resolution, in bits.

    updateHeadsetCustomInfo
    controlDevice
    createSession
    controlDevice

    Description

    id

    string

    No

    A headset id or a wildcard

    includeFlexMappings

    boolean

    No

    Set this parameter to true to include the mapping of each EPOC FLEX headset in the result headset object.

    Wildcard

    Filter

    INSIGHT-*

    All Insight headsets

    EPOC-*

    All Epoc headsets

    EPOCPLUS-*

    All Epoc Plus headsets

    headset objects
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "queryHeadsets"
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": [
            {
                "connectedBy": "dongle",
                "customName": "",
                "dongle": "6ff",
                "firmware": "625",
                "id": "EPOCPLUS-3B9AXXXX",
                "motionSensors": [
                    "GYROX",
                    "GYROY",
                    "GYROZ",
                    "ACCX",
                    "ACCY",
                    "ACCZ",
                    "MAGX",
                    "MAGY",
                    "MAGZ"
                ],
                "sensors": [
                    "AF3",
                    "F7",
                    "F3",
                    "FC5",
                    "T7",
                    "P7",
                    "O1",
                    "O2",
                    "P8",
                    "T8",
                    "FC6",
                    "F4",
                    "F8",
                    "AF4"
                ],
                "settings": {
                    "eegRate": 256,
                    "eegRes": 16,
                    "memsRate": 64,
                    "memsRes": 16,
                    "mode": "EPOCPLUS"
                },
                "status": "connected"
            }
        ]
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "queryHeadsets"
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": []
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "queryHeadsets",
        "params": {
            "id": "EPOCPLUS-3B9AXXXX"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": [
            {
                "connectedBy": "dongle",
                "customName": "",
                "dongle": "6ff",
                "firmware": "625",
                "id": "EPOCPLUS-3B9AXXXX",
                "motionSensors": [
                    "GYROX",
                    "GYROY",
                    "GYROZ",
                    "ACCX",
                    "ACCY",
                    "ACCZ",
                    "MAGX",
                    "MAGY",
                    "MAGZ"
                ],
                "sensors": [
                    "AF3",
                    "F7",
                    "F3",
                    "FC5",
                    "T7",
                    "P7",
                    "O1",
                    "O2",
                    "P8",
                    "T8",
                    "FC6",
                    "F4",
                    "F8",
                    "AF4"
                ],
                "settings": {
                    "eegRate": 256,
                    "eegRes": 16,
                    "memsRate": 64,
                    "memsRes": 16,
                    "mode": "EPOCPLUS"
                },
                "status": "connected"
            }
        ]
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "queryHeadsets",
        "params": {
            "id": "INSIGHT-*"
        }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": [
        {
          "id": "INSIGHT-AAAA0000",
          "status": "connected",
          "connectedBy": "dongle",
          "customName": "",
          "dongle": "6ff",
          "firmware": "930",
          "headbandPosition": null,
          "motionSensors": [
            "Q0",
            "Q1",
            "Q2",
            "Q3",
            "ACCX",
            "ACCY",
            "ACCZ",
            "MAGX",
            "MAGY",
            "MAGZ"
          ],
          "sensors": [
            "AF3",
            "T7",
            "Pz",
            "T8",
            "AF4"
          ],
          "settings": {
            "eegRate": 128,
            "eegRes": 14,
            "memsRate": 64,
            "memsRes": 14,
            "mode": "INSIGHT"
          }
        }
      ]
    }

    no

    A license id. In most cases, you don't need to specify the license id. Cortex will find the appropriate license based on the client id.

    debit

    number

    no

    Number of sessions to debit from the license, so that it can be spent locally without having to authorize again. You need to debit the license only if you want to . The default value is zero.

    Name

    Type

    Required

    Description

    clientId

    string

    yes

    The client id of your Cortex application.

    clientSecret

    string

    yes

    The client secret of your Cortex application.

    license

    Name

    Type

    Description

    cortexToken

    string

    The Cortex token of the user

    warning

    object

    Contains a message and the URL to accept the EULA

    work offline with Cortex
    EMOTIV Launcherarrow-up-right
    requestAccess

    string

    Parameters

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by .

    headsetId

    string

    yes

    A headset id returned by .

    headbandPosition

    hashtag
    Result

    The result is an object containing these fields:

    Name

    Type

    Description

    headsetId

    string

    The headset id used in the request.

    customName

    string

    The custom name of the headset.

    headbandPosition

    string

    The position of the headband. Can be "back" or "top".

    hashtag
    Examples

    start a record

    Name

    Type

    Required

    Description

    cortexToken

    string

    Yes

    A valid Cortex token from a successful authentication.

    status

    string

    Yes

    Action to perform: create, get, read, update, or delete.

    uuid

    string

    No

    Unique ID of a mapping configuration (required for read, delete).

    hashtag
    Status create

    Create a new sensor mapping for EPOC Flex. The configuration will be added to list EEG sensor mapping configuration of current emotiv user, can be synced to other machine. Requires: cortexToken, status="create", name, and mappings.

    Example

    {
        "id": 1,
        "
    
    {
      "id": 1,
      "
    

    hashtag
    Status get

    Retrieve all mapping configurations for the current Emotiv user. Requires: cortexToken, status="get".

    Example

    hashtag
    Status read

    Read the details of a specific configuration. Requires: cortexToken, status="read", uuid.

    Example

    hashtag
    Status update

    To update an existing mapping configuration. Requires: cortexToken, status, and uuid.

    The name and mappings are optional parameters:

    • If name is included, the configuration name will be updated.

    • If mappings is included, the mappings will be updated.

    • If both are included, both fields will be updated.

    Example

    hashtag
    Status delete

    Delete a mapping configuration. Requires: cortexToken, status="delete", uuid.

    Example

    You must provide a headset id.
  • If the headset is disconnected and connected again, then you must call this method again.

  • The simplest solution is to call this method just before creating a record.

    hashtag
    Use Case

    Cortex sets the timestamps of each EEG sample using the monotonic clockarrow-up-right of the computer. It is more reliable than using the system clock, because the system clock is subject to unpredictable variations, notably because of the NTParrow-up-right synchronization.

    When you add a marker to a record, Cortex uses the parameter "time" of your request to associate the marker with the EEG sample that has the closest timestamp. So if you want to have accurate markers, you should set the time of your markers using the monotonic clock, not the system clock.

    Most programing languages provide a function to get a monotonic time. But in general, the point of origin of this time is undefined. So you need to synchronize the monotonic clock of your application with the monotonic clock used by Cortex. This is the purpose of this Cortex API method.

    hashtag
    Parameters

    This method takes 3 parameters:

    Name
    Type
    Required
    Description

    headset

    string

    yes

    The headset id.

    Use to list available headsets.

    monotonicTime

    number

    yes

    The monotonic time of your application. The unit is in seconds. The origin can be anything.

    You should get this time right before you call this API.

    systemTime

    hashtag
    Result

    The result is a JSON object with these fields:

    Name
    Type
    Description

    headset

    string

    The headset id.

    adjustment

    number

    The difference between the monotonic clock of your application and the monotonic clock of the headset.

    The unit is in seconds.

    To synchronize your clock, you must add the “adjustment” to your monotonic times. If the “adjustment” is positive, then it means your clock is late compared to the Cortex clock. If the “adjustment” is negative, then your clock is ahead of the Cortex clock.

    hashtag
    Example

    inject markers

    hashtag
    Parameters

    Name

    Type

    Required

    Description

    command

    string

    yes

    The command must be "connect", "disconnect" or "refresh".

    headset

    string

    no

    The id of the headset that you want to connect or disconnect. The headset id is returned by .

    If the command is "refresh", then you should omit this parameter.

    mappings

    hashtag
    Headset Scanning Flow

    The app must call controlDevice with "refresh" command to start headset scanning. The timeout of scanning is around 20s. When the scanning finishes, Cortex will send a warning with code 142 to the app. When received this warning, if the app still want to scan for headsets, simply call controlDevice with "refresh" command again.

    Please note that headset scanning can affect to data stream quality if headset scanning is running at the same time with data stream subscription, so we recommend app developers to design the app so that we only run headset scanning when necessary.

    hashtag
    EPOC Flex mapping

    The mappings parameter is only to connect an EPOC Flex headset. Use this parameter to tell Cortex how you setup the EEG sensors of your EPOC Flex headset.

    The keys for this object must be chosen from this list: "CMS", "DRL", "LA", "LB", "LC", "LD", "LE", "LF", "LG", "LH", "LJ", "LK", "LL", "LM", "LN", "LO", "LP", "LQ", "RA", "RB", "RC", "RD", "RE", "RF", "RG", "RH", "RJ", "RK", "RL", "RM", "RN", "RO", "RP", "RQ".

    The keys "CMS" and "DRL" are required.

    The values are sensor locations from the international 10-20 system: "Cz", "FCz", "Fz", "Afz", "Fpz", "Fp1", "AF3", "AF7", "F9", "F7", "F5", "F3", "F1", "FC1", "C1", "C3", "FC3", "FC5", "FT7", "FT9", "T7", "C5", "TP9", "TP7", "CP5", "CP3", "CP1", "P1", "P3", "P5", "P7", "P9", "PO9", "PO7", "PO3", "O1", "O9", "CPz", "Pz", "POz", "Oz", "Iz", "O10", "O2", "PO4", "PO8", "PO10", "P10", "P8", "P6", "P4", "P2", "CP2", "CP4", "CP6", "TP8", "TP10", "C6", "T8", "FT10", "FT8", "FC6", "FC4", "C4", "C2", "FC2", "F2", "F4", "F6", "F8", "F10", "AF8", "AF4", "Fp2".

    hashtag
    Special EEG sensor mapping for EPOC Flex

    By default, the streams "met", "com" and "fac" are not available for EPOC Flex. It is because Cortex doesn't implement the detections (performance metrics, mental command, facial expression) for EPOC Flex.

    However, you can configure your EPOC Flex to simulate an EPOC X headset. In that case, Cortex runs the detections that are designed for EPOC X.

    All you have to do is to use a sensor mapping that includes all the 14 EEG sensors of an EPOC X headset: AF3, F7, F3, FC5, T7, P7, O1, O2, P8, T8, FC6, F4, F8, AF4. In addition, you should use P3 and P4 as references CMS and DRL. Please see the EPOC X user manualarrow-up-right for the complete EPOC X configuration.

    Your mapping can also include sensors that are not present on an EPOC X. Cortex will not use these additional sensors to run the detections, but you can use them to collect more EEG data.

    There are two methods for creating the mapping for EPOC Flex:

    1. Using the EMOTIV Launcher, which can be accessed .

    2. Using the configMapping API, available here.

    Example of special EEG sensor mapping:

    This feature was added in Cortex 2.7.1

    hashtag
    Connection Type

    You can use this parameter together with the command "connect", to force Cortex to use the specified connection type. For example, an EPOC+ headset can be connected by dongle or by Bluetooth. If both connections are available on your computer then you may want to set connectionType to "dongle" so you don't accidentally connect the headset with Bluetooth.

    hashtag
    Result

    The result is an object containing these fields:

    Name

    Type

    Description

    command

    string

    The command that you set in the request

    message

    string

    A success message

    When the command is "connect", then the result of this method just tells you that the connection is in progress. You must wait for a warning object with code 104 to know that the connection is successful. If the connection fails then you will receive a warning with code 100, 101, 102 or 113.

    Another way to check if the headset is connected or not is to call queryHeadsets and then check the status of the headset.

    hashtag
    Examples

    hashtag
    Refresh the list of headsets

    Use the refresh command to start searching for new Bluetooth headsets.

    Then you will receive a warning with code 142 when scanning is finished.

    hashtag
    Connect an Insight headset

    Then you will receive a warning with code 104 if the connection is successful:

    hashtag
    Connect an Epoc Flex headset

    hashtag
    Disconnect a headset

    queryHeadsets
    createSession
    queryHeadsets

    querySessions

    This method returns the list of the sessions created by the current application. You can create a session with createSession.

    circle-check

    New in 2.0: Sessions are now temporary in-memory objects. So this methods only returns the current sessions, not your past sessions. See Sessions for details.

    hashtag
    Parameters

    hashtag
    Result

    The result is an array of .

    hashtag
    Example

    updateSession

    This method is to activate or close a session. See Sessions for details.

    hashtag
    Parameters

    Name

    Type

    Required

    Description

    hashtag
    Result

    The result is a representing the updated session.

    hashtag
    Examples

    hashtag
    Activate a session

    hashtag
    Close a session

    createSession

    This method is to open a session with an EMOTIV headset.

    To open a session with a headset, the status of the headset must be "connected". If the status is "discovered", then you must call controlDevice to connect the headset. You cannot open a session with a headset connected by a USB cable. You can use queryHeadsets to check the status and connection type of the headset.

    You can use updateSession to activate or close a session.

    See Sessions for details.

    circle-info

    Make sure the headset has the status "connected" before you call this method. Use to check the status of the headset.

    hashtag
    Parameters

    If the status is "open", then the session won't be activated. You can activate the session later by calling .

    hashtag
    Result

    The result is a representing the created session.

    hashtag
    Examples

    Open a session.

    Open a session and activate it.

    Data Subscription

    After you opened a session with a headset, you can subscribe to one or more data streams.

    Each data stream gives you real time access to data from the headset (EEG, motion...) or data calculated by Cortex (band powers, mental command...)

    After you successfully subscribe to a data stream, Cortex will keep sending you data sample objects.

    A subscription is linked to a session. All the subscriptions of a session are automatically cancelled when the session is closed. You can call unsubscribe to cancel a subscription.

    The available data streams depend on the license of the user, and the model and settings of the headset. For an EPOC Flex, it also depends on the EEG sensor mapping.

    hashtag
    Data streams

    Each data stream is identified by its name: "eeg", "mot", "dev", "eq", "pow", "met", "com", "fac", "sys".

    hashtag
    Data streams availability

    Depending on the license and the model of the headset, some streams may be available or not, and may send at a different rate.

    subscribe

    This method is to subscribe to one or more data streams. You can call to cancel a subscription. After you successfully subscribe to a stream, Cortex will keep sending you .

    See for details.

    hashtag
    Parameters

    Session object

    A session is the link between your application and a headset.

    You must create a session before you call to receive data from a headset. See .

    hashtag
    Description

    A session object includes these fields:

    Data sample object

    After you successfully to a data stream, Cortex will keep sending you data sample objects. See for details.

    A data sample object contains these fields:

    unsubscribe

    This method is to cancel a subscription that was previously created by the method.

    hashtag
    Parameters

    deleteRecord

    This method is to delete one or more records.

    The records will be deleted from the local computer, but also from the EMOTIV account of the user in the cloud, and from any computer where the user is logged in.

    Your application cannot delete a record that was created by another application.

    triangle-exclamation

    Deleting a record is irreversible. There is no way to recover a deleted record.

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "authorize",
        "params": {
            "clientId": "xxx",
            "clientSecret": "xxx"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "cortexToken":"xxx",
            "warning": {
                "code": 6,
                "message": "...",
                "licenseUrl": "https://..."
            }
        }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "updateHeadsetCustomInfo",
      "params": {
        "cortexToken": "xxx",
        "headbandPosition": "top",
        "headsetId": "EPOCX-12345678"
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "customName": "Epoc 1",
        "headbandPosition": "top",
        "headsetId": "EPOCX-12345678",
        "message": "Update headset customized information successfully."
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "configMapping",
      "params": {
        "cortexToken": "xxx",
        "status": "get"
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "message": "Get flex mapping config successful",
        "value": {
          "config": [
            {
              "label": {},
              "mappings": {
                "CMS": "TP10",
                "DRL": "TP9",
                "LA" : "C3",
                "LB" : "T7",
              },
              "name": "Default Configuration",
              "uuid": "f4296b2d-d6e7-45cf-9569-7bc2a1bd56e4"
            },
            {
              "label": {},
              "mappings": {
                "CMS": "TP9",
                "DRL": "TP10",
                "RF" : "F8",
                "RG" : "AF4"
              },
              "name": "config2",
              "uuid": "764adb97-a710-4d95-977a-dea5b682aa04"
            }
          ],
          "updated": "2025-10-08T06:16:30.521+07:00",
          "version": "2018-05-08"
        }
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "configMapping",
      "params": {
        "cortexToken": "xxx",
        "status": "read",
        "uuid": "764adb97-a710-4d95-977a-dea5b682aa04"
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "message": "Read flex mapping config successful",
        "value": {
          "label": {},
          "mappings": {
            "CMS": "TP9",
            "DRL": "TP10",
            "RF" : "F8",
            "RG" : "AF4"
          },
          "name": "config2",
          "uuid": "764adb97-a710-4d95-977a-dea5b682aa04"
        }
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "configMapping",
      "params": {
        "cortexToken": "xxx",
        "status": "update",
        "uuid": "764adb97-a710-4d95-977a-dea5b682aa04",
        "name": "new config"
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "message": "Update flex mapping config successful",
        "value": {
          "label": {},
          "mappings": {
            "CMS": "TP9",
            "DRL": "TP10",
            "RF" : "F8",
            "RG" : "AF4"
          },
          "name": "new config",
          "uuid": "764adb97-a710-4d95-977a-dea5b682aa04"
        }
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "configMapping",
      "params": {
        "cortexToken": "xxx",
        "status": "delete",
        "uuid": "effa621f-49d6-4c46-95f3-28f43813a6e9"
      }
    }
    {
      "id": 3373617,
      "jsonrpc": "2.0",
      "result": {
        "message": "Delete flex mapping config successful",
        "uuid": "effa621f-49d6-4c46-95f3-28f43813a6e9"
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "syncWithHeadsetClock",
      "params": {
        "headset": "INSIGHT-587XX4BB",
        "monotonicTime": 321.445,
        "systemTime": 1629978090.302
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "adjustment": 1629977768.86108,
        "headset": "INSIGHT-587XX4BB"
      }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "controlDevice",
        "params": {
            "command": "refresh"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "command": "refresh",
            "message": "..."
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "controlDevice",
        "params": {
            "command": "connect",
            "headset": "INSIGHT-12341234"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "command": "connect",
            "message": "Start connecting to headset INSIGHT-12341234"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "controlDevice",
        "params": {
            "command": "connect",
            "headset": "EPOCFLEX-12341234",
            "mappings": {
                "CMS": "F3",
                "DRL": "F5",
                "LA": "AF3",
                "LB": "AF7",
                "RA": "P8"
            }
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "command": "connect",
            "message": "..."
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "controlDevice",
        "params": {
            "command": "disconnect",
            "headset": "EPOCFLEX-12341234"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "command": "disconnect",
            "message": "..."
        }
    }
    {
        "CMS": "P3",
        "DRL": "P4",
        "LA": "FC5",
        "LB": "O1",
        "LC": "P7",
        "LD": "T7",
        "LE": "F3",
        "LF": "F7",
        "LG": "AF3",
        "RA": "FC6",
        "RB": "O2",
        "RC": "P8",
        "RD": "T8",
        "RE": "F4",
        "RF": "F8",
        "RG": "AF4"
     }
    {
        "jsonrpc": "2.0",
        "warning": {
            "code": 142,
            "message": {
                "behavior": "Headset discovering complete."
            }
        }
    }
    {
        "jsonrpc": "2.0",
        "warning": {
            "code": 104,
            "message": {
                "headsetId": "INSIGHT-12341234",
                "behavior": "The headset is connected"
            }
        }
    }
    jsonrpc
    "
    :
    "
    2.0
    "
    ,
    "method": "configMapping",
    "params": {
    "cortexToken": "xxx",
    "mappings": {
    "CMS": "TP9",
    "DRL": "TP10",
    "RD": "T8",
    "RE": "F4",
    "RF": "F8",
    "RG": "AF4"
    },
    "name": "config1",
    "status": "create"
    }
    }
    jsonrpc
    "
    :
    "
    2.0
    "
    ,
    "result": {
    "message": "Create flex mapping config successful",
    "value": {
    "label": {},
    "mappings": {
    "CMS": "TP9",
    "DRL": "TP10",
    "RD": "T8",
    "RE": "F4",
    "RF": "F8",
    "RG": "AF4"
    },
    "name": "config1",
    "uuid": "4416dc1b-3a7c-4d20-9ec6-aacdb9930071"
    }
    }
    }

    name

    string

    No

    Name of the configuration (required for create ).

    mappings

    object

    No

    Key-value pairs define EEG sensor mapping (required for create; optional for update). More details are available here.

    activate a session

    string

    yes

    Must be "back" or "top".

    authorize
    queryHeadsets

    number

    yes

    The system time of your application. It must be the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970 UTC.

    You should get this time right before you call this API.

    queryHeadset

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    session objects
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "querySessions",
        "params": {
            "cortexToken": "xxx"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": [{
            "id": "8bfc26de-754b-4c1f-9771-acfd1a7da02c",
            "owner": "jon.snow",
            "license": "",
            "appId": "com.jon.snow.winterfell-app",
            "started": "2019-01-29T14:18:45.108+07:00",
            "stopped": "",
            "status": "opened",
            "headset": {
                "connectedBy": "dongle",
                "customName": "",
                "dongle": "6ff",
                "firmware": "625",
                "id": "EPOCPLUS-3B9AXXXX",
                "motionSensors": [
                    "GYROX",
                    "GYROY",
                    "GYROZ",
                    "ACCX",
                    "ACCY",
                    "ACCZ",
                    "MAGX",
                    "MAGY",
                    "MAGZ"
                ],
                "sensors": [
                    "AF3",
                    "F7",
                    "F3",
                    "FC5",
                    "T7",
                    "P7",
                    "O1",
                    "O2",
                    "P8",
                    "T8",
                    "FC6",
                    "F4",
                    "F8",
                    "AF4"
                ],
                "settings": {
                    "eegRate": 256,
                    "eegRes": 16,
                    "memsRate": 64,
                    "memsRes": 16,
                    "mode": "EPOCPLUS"
                },
                "status": "connected"
            },
            "recordIds": [],
            "recording": false,
            "streams": ["met"]
        }]
    }

    cortexToken

    string

    yes

    The token returned by authorize.

    session

    string

    yes

    A session id returned by createSession.

    status

    string

    yes

    Must be "active" or "close".

    session object
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "updateSession",
        "params": {
            "cortexToken": "xxx",
            "session": "38fef6d7-979b-420b-aa25-dd60ef5edc02",
            "status": "active"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "id": "38fef6d7-979b-420b-aa25-dd60ef5edc02",
            "status":"activated",
            ...
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "updateSession",
        "params": {
            "cortexToken": "xxx",
            "session": "38fef6d7-979b-420b-aa25-dd60ef5edc02",
            "status": "close"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "appId": "com.jon.snow.winterfell-app",
            "headset": {
                "connectedBy": "dongle",
                "customName": "",
                "dongle": "6ff",
                "firmware": "925",
                "id": "INSIGHT-5A68XXXX",
                "motionSensors": [
                    "GYROX",
                    "GYROY",
                    "GYROZ",
                    "ACCX",
                    "ACCY",
                    "ACCZ",
                    "MAGX",
                    "MAGY",
                    "MAGZ"
                ],
                "sensors": [
                    "AF3",
                    "T7",
                    "Pz",
                    "T8",
                    "AF4"
                ],
                "settings": {
                    "eegRate": 128,
                    "eegRes": 14,
                    "memsRate": 128,
                    "memsRes": 14,
                    "mode": "UNKNOWN"
                },
                "status": "connected"
            },
            "id": "38fef6d7-979b-420b-aa25-dd60ef5edc02",
            "license": "xxx",
            "owner": "jon.snow",
            "recordIds": [
                "d8fe7658-71f1-4cd6-bb5d-f6775b03438f"
            ],
            "recording": false,
            "started": "2019-06-06T11:41:53.168+07:00",
            "status": "closed",
            "stopped": "2019-06-06T11:42:23.531+07:00",
            "streams": []
        }
    }

    no

    A headset id returned by . If you omit this parameter, then Cortex will use the first connected headset.

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    status

    string

    yes

    Must be "open" or "active".

    headset

    queryHeadsets
    updateSession
    session object

    string

    The results of the performance metrics detection.

    com

    The results of the mental commands detection. You must to get meaningful results.

    fac

    The results of the facial expressions detection.

    sys

    The system events. These events are related to the training of the mental commands and facial expressions. See for details.

    2

    pow

    All

    8

    met

    All (EPOC Flex requires a ).

    2 if the license contains the scope "pm" and you activate the before you subscribe. 0.1 otherwise (1 sample every 10 seconds)

    com

    All (EPOC Flex requires a ).

    8

    fac

    All (EPOC Flex requires a ) except MN8.

    32

    sys

    All

    No fixed rate, see for details.

    Stream

    Description

    eeg

    The raw EEG data from the headset.

    mot

    The motion data from the headset.

    dev

    The device data from the headset. It includes the battery level, the wireless signal strength, and the contact quality of each EEG sensor.

    eq

    The EEG quality of each EEG sensor.

    Please read this pagearrow-up-right to understand the difference between the contact quality and the EEG quality.

    pow

    The band power of each EEG sensor. It includes the alpha, low beta, high beta, gamma, and theta bands.

    Stream

    Supported headsets

    Sample rate in hertz

    eeg

    All, but requires a license

    128 or 256, depends on the headset and its settings.

    The license must contain the scope "eeg". You must activate the session before you subscribe.

    Please check the documentationarrow-up-right of your headset.

    mot

    All

    Disabled, 32, 64, 128, depends on the headset and its settings.

    6.4 hertz for MN8.

    Please check the documentationarrow-up-right of your headset.

    dev

    All

    2

    eq

    data samples objects

    met

    All

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by .

    session

    string

    yes

    A session id returned by .

    streams

    array of strings

    yes

    The data streams you want to subscribe to.

    The parameter streams must contain one or more values, chosen from this list: "eeg", "mot", "dev", "eq", "pow", "met", "com", "fac", "sys". See Data Subscription for details.

    circle-info

    To subscribe to the "eeg" stream, you must have a paid license and activate the session.

    hashtag
    Result

    The result is an object that includes these fields:

    Name

    Type

    Description

    success

    array of objects

    For each stream you successfully subscribed to, this array contains an object that describe the data structure of this stream.

    failure

    array of objects

    For each stream you failed to subscribed to, this array contains an object that describes the error.

    In case of success, you get an object with these fields:

    Name

    Type

    Description

    streamName

    string

    The name of the stream.

    cols

    array of strings

    The labels of the columns that are part of this stream.

    sid

    string

    The session id.

    Please note that the field cols is especially important. This field tells you which values you will get in the data stream, and in which order. See Data sample object for details.

    In case of failure, you get an object with these fields:

    Name

    Type

    Description

    streamName

    string

    The name of the stream.

    code

    number

    The error code.

    message

    string

    The error message.

    hashtag
    Examples

    Subscribe successfully to motion and performance metrics.

    Subscribe successfully to performance metrics, but fail to subscribe to raw EEG.

    unsubscribe
    data sample objects
    Data Subscription

    Name

    Name

    Type

    Description

    id

    string

    The id of this session.

    status

    string

    Can be "opened", "activated", or "closed".

    owner

    string

    The EmotivID of the user.

    license

    string

    The id of the license used by this session. Or an empty string if the session wasn't activated.

    appId

    string

    The application id of your Cortex app.

    started

    string (ISO datetime)

    When this session was created.

    stopped

    string (ISO datetime)

    When this session was closed.

    streams

    array of strings

    The data streams you subscribed to. See .

    recordIds

    array of strings

    The ids of all the records created by this session. See .

    recording

    boolean

    True if a record is currently in progress for this session. False otherwise.

    headset

    object

    A . It contains information about the headset linked to this session.

    hashtag
    Status

    The status is linked to the license. If the session is activated, it will be debited from the quota of the user's license.

    Status

    Description

    opened

    The session was created with , but it doesn't use a license. You can activate or close this session with .

    activated

    The session was activated with a license. You can close this session with .

    closed

    This session is closed, you cannot use it anymore.

    hashtag
    Examples

    A session with an Epoc+ headset. It is not activated. We subscribed to the performance metrics and motion data.

    subscribe
    createSession

    The session id used to subscribe to this data stream.

    time

    number

    The timestamp of this sample. It is the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970 UTC.

    To interpret the values in the <stream> array, you must check the field cols from the result of the subscribe method.

    hashtag
    How to interpret the values

    Suppose you want to get the mental command stream. You successfully subscribe to the stream "com", and you receive this response:

    The important part is the field cols:

    So, the labels for the mental command samples are "act" (action) and "pow" (power), in this order. Then you will receive some mental command samples. They look like this:

    The values in the array com match the labels in the array cols. So "push" is the value for "act" , and 0.376 is the value for "pow".

    Below is the description of the labels used in each data stream.

    hashtag
    EEG

    The stream "eeg" uses these labels:

    Label

    Type

    Description

    COUNTER

    number

    Increment by 1 for each sample, reset to zero every second.

    INTERPOLATED

    number

    0 if this sample was received from the headset. 1 if this sample was interpolated by Cortex.

    <EEG sensors>

    number

    For each EEG sensor, you get 1 value in microvolt.

    RAW_CQ

    The maker objects include these fields:

    Name

    Type

    Description

    applicationId

    string

    The id of the application that created this marker.

    recordId

    string

    The id of the record this marker belongs to.

    markerId

    string

    The id of this marker.

    value

    Example for an INSIGHT:

    Example for an EPOC+ or EPOC X:

    hashtag
    Motion

    The stream "mot" uses these labels:

    Label

    Type

    Description

    COUNTER_MEMS

    number

    Increment by 1 for each sample, reset to zero every second.

    INTERPOLATED_MEMS

    number

    0 if this sample was received from the headset. 1 if this sample was interpolated by Cortex.

    ACCX, ACCY, ACCZ

    number

    X, Y, Z axis of the accelerometer.

    MAGX, MAGY, MAGZ

    Depending on the headset, the labels for the gyroscope will be GYROX, GYROY, GYROZ or the quaternions. You will never get both these labels.

    Example for a newer INSIGHT:

    Example for an older INSIGHT:

    To understand the meaning of motion data, you can refer .

    hashtag
    Device information

    The stream "dev" uses these labels:

    Label

    Type

    Description

    Battery

    number

    The battery level of the headset, from 0 to 4.

    Signal

    number

    The strength of the wireless signal received from the headset, from 0 to 1.

    <EEG sensors>

    number

    The contact quality of each EEG sensor, from 0 to 4.

    There is an additional label "OVERALL" at the end of the array. The overall contact quality is a value from 0 to 100 that is calculated from the contact quality of all the EEG sensors. The label OVERALL was added in Cortex 2.4

    BatteryPercent

    Example with INSIGHT:

    Example with EPOC+ or EPOC X:

    hashtag
    EEG Quality

    Please read this pagearrow-up-right to understand the difference between the contact quality and the EEG quality.

    The stream "eq" uses these labels:

    Label

    Type

    Description

    batteryPercent

    number

    The battery level of the headset, from 0 to 100.

    overall

    number

    A value from 0 to 100 that is calculated from the EEG quality of all the EEG sensors.

    sampleRateQuality

    number

    A float value from 0 to 1 that evaluates the actual sample rate of the EEG data coming from the headset.

    If the wireless connection between the headset and the computer is perfect (no data loss) then the sample rate quality is 1. If X percent of the EEG samples were lost over the last 2 seconds, then the SRQ is (100 - X) / 100.

    If we lost more than 300 ms of data over the last 2 seconds, then the SRQ takes the special value -1.

    <EEG sensors>

    This stream was added in Cortex 2.7.0

    Example with INSIGHT:

    hashtag
    Band power

    This stream gives you the power of the EEG data. The values are absolute, the unit is uV^2 / Hz. Each sample is calculated based on the last 2 seconds of EEG data.

    The labels of the stream "pow" use the format "SENSOR/BAND", when SENSOR is the name of the EEG sensor and BAND is the name of the band power. Cortex provides these bands:

    • theta (4-8Hz)

    • alpha (8-12Hz)

    • betaL (low beta, 12-16Hz)

    • betaH (high beta, 16-25Hz)

    • gamma (25-45Hz)

    So the low beta for AF3 has the label "AF3/betaL". The gamma for Pz has the label "Pz/gamma".

    Example with INSIGHT:

    Example with EPOC+ or EPOC X:

    hashtag
    Performance metric

    Each performance metric is a decimal number between 0 and 1. Zero means "low power", 1 means "high power". So for example, a value of 0.1 for "eng" means that the user is not engaged, a value of 1.0 means the user is very engaged. If the detection cannot run because of a poor EEG signal quality then the value is null.

    For each performance metrics, the flag isActive is true if the detection of this metrics is running properly. It is false if the detection cannot run. This can happen if the EEG signal from the headset is of poor quality. This flag was added in Cortex 2.2.1

    The "met" stream labels vary depending on the headset type, as shown in the tables below:

    hashtag
    The "met" Stream Labels of MN8

    Label

    Type

    Description

    cognitiveStress

    number

    Cognitive Stress measures the mental strain caused by challenging tasks or environments.

    attention

    number

    Attention measures sustained focus on a single task.

    cognitiveStress.isActive

    boolean

    Active flag for cognitiveStress

    attention.isActive

    hashtag
    Example

    hashtag
    The "met" Stream Labels of EPOC / INSIGHT / FLEX - (with EPOC config only)

    Label

    Type

    Description

    eng

    number

    Engagement measures immersion in an activity.

    exc

    number

    Excitement measures the intensity of reactions to stimuli or environments.

    lex

    number

    Long term excitement. It is calculated from the excitement values of the last minute.

    str

    hashtag
    Example

    To understand the meaning of each performance metrics, you can refer .

    hashtag
    Mental command

    The stream "com" uses these labels:

    Label

    Type

    Description

    act

    string

    A mental command action. Use the method to get the possible actions.

    pow

    number

    The power of the action. It is a decimal number between 0 and 1, zero means "low power", 1 means "high power".

    hashtag
    Facial expression

    The stream "fac" uses these labels:

    Label

    Type

    Description

    eyeAct

    string

    The action of the eyes.

    uAct

    string

    The upper face action.

    uPow

    number

    Power of the upper face action. Zero means "low power", 1 means "high power".

    lAct

    Use the method getDetectionInfo to get the possible actions.

    hashtag
    System events

    The stream "sys" is used for the training of the mental command and facial expression. It uses these labels:

    Label

    Type

    Description

    event

    string

    The name of the detection. Can be "mentalCommand" or "facialExpression"

    msg

    string

    Depends on the detection. Use the method to get the possible values, check the field events in the result.

    For example, just after you start a training for the mental command detection, you receive a system event like this:

    Name

    Type

    Description

    <stream>

    array

    The name of this field is the name of the data stream, for example "eeg", "met", "com"...

    This array contains the values of a data sample. The type and meaning of each value depend on the stream.

    sid

    subscribe
    Data Subscription

    string

    cortexToken

    string

    yes

    A token returned by .

    session

    string

    yes

    A session id returned by .

    streams

    array of strings

    yes

    The data streams you want to unsubscribe to.

    The parameter streams must contain one or more values, chosen from this list: "eeg", "mot", "dev", "pow", "met", "com", "fac", "sys". See Data Subscription for details.

    hashtag
    Result

    The result is an object that includes these fields:

    Name

    Type

    Description

    success

    array of objects

    For each stream you successfully unsubscribed to, this array contains an object with the name of the stream.

    failure

    array of objects

    For each stream you failed to unsubscribed to, this array contains an object that describes the error.

    In case of success, you get an object with these fields:

    Name

    Type

    Description

    streamName

    string

    The name of the stream.

    In case of failure, you get an object with these fields:

    Name

    Type

    Description

    streamName

    string

    The name of the stream.

    code

    number

    The error code.

    message

    string

    The error message.

    hashtag
    Examples

    Unsubscribe successfully from the performance metrics and motion streams.

    Name

    Type

    Required

    Description

    subscribe
    hashtag
    Parameters

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by .

    records

    array of strings

    yes

    An array of record ids.

    hashtag
    Result

    The result is an object that includes these fields:

    Name

    Type

    Description

    success

    array of objects

    For each record you successfully deleted, this array contains an object that includes the record id.

    failure

    array of objects

    For each record that couldn't be deleted, this array contains an object that describes the error.

    In case of success, you get an object with these fields:

    Name

    Type

    Description

    recordId

    string

    The id of the record that was successfully deleted.

    In case of failure, you get an object with these fields:

    Name

    Type

    Description

    recordId

    string

    The id of the record that couldn't be deleted.

    code

    number

    The error code.

    message

    string

    The error message.

    hashtag
    Examples

    Deleting two records, including one that has an invalid id.

    object

    no

    The EEG sensor mapping of the EPOC Flex headset that you want to connect.

    If the command is not "connect", or if the headset is not an EPOC Flex, then you should omit this parameter.

    connectionType

    string

    no

    If the command is "connect" or "disconnect" then this parameter can be "dongle", "bluetooth" or "usb cable", or you can omit it. If the command is "refresh" then you should omit this parameter.

    This parameter was added in Cortex 2.2.1

    flexConfigName

    string

    no

    Specify the EEG sensor mapping name for the EPOC Flex headset you wish to connect. This can be retrieved using configMapping. If you provide this parameter, the mappings parameter will be ignored.

    queryHeadsets

    exportRecord

    This method is to export one or more records to EDF or CSV files.

    You can export the raw EEG data, the motion data, the performance metrics and the band powers. The available data streams depend on the license of the record. You can check the field licenceScope in the Record object to know which data streams are available.

    By default, you can only export the records that were created by your application. If you want to export a record that was created by another application (e.g. Emotiv PROarrow-up-right or EMOTIV LABSarrow-up-right) then you must provide the license id of this application in the parameter licenseIds.

    In order to export a record created by EMOTIV LABSarrow-up-right, the current Cortex user must be the owner of the LABS experiment.

    You must before you can export it. If you want to export a record immediately after you stop it then you must wait for the before you try to export.

    The format of the exported files is described in .

    This method was added in Cortex 2.1.1 to all desktop versions of Cortex. It was added to iOS and Android in Cortex 2.7.0

    hashtag
    Parameters

    hashtag
    Data streams

    The parameter streamTypes must contain one or more values, chosen from this list: "EEG", "MOTION", "PM", "BP". If the format is "EDF" then only "EEG" and "MOTION" are available.

    hashtag
    Format and version

    Depending on the parameters format and version Cortex will create different files.

    hashtag
    Format EDF, no version

    This format is identical to the one used in Cortex 1.x

    • 1 EDF file for the EEG and CQ data

    • 1 EDF file for the motion data

    • 1 JSON file for the markers

    Format EDFPLUS/BDFPLUS, no version (available since Cortex version 3.7.5)

    • 1 EDF+/BDF+ file for the EEG, CQ and Motion data

    • 1 JSON file for the markers

    • 1 CSV file for the markers if the parameter includeMarkerExtraInfos is true

    hashtag
    Format CSV, version V1

    This format is identical to the one used in Cortex 1.x

    • 1 CSV file for the EEG and CQ data

    • 1 CSV file for the band powers

    • 1 CSV file for the motion data

    hashtag
    Format CSV, version V2

    This format is the new format of Cortex 2.x

    • 1 CSV file for all the data streams (EEG, CQ, band powers, motion, PM)

    • 1 JSON file for the markers

    • 1 CSV file for the markers if the parameter includeMarkerExtraInfos is true

    hashtag
    Result

    The result is an object that includes these fields:

    In case of success, you get an object with these fields:

    In case of failure, you get an object with these fields:

    hashtag
    Examples

    hashtag
    EDF

    hashtag
    CSV V1

    hashtag
    CSV V2

    createRecord

    This method is to create a new record.

    circle-info

    You must create and activate a session before you call this method. See createSession for details.

    hashtag
    Parameters

    hashtag
    Result

    The result is an object containing two fields:

    hashtag
    Examples

    updateRecord

    This method is to update a record. You can update its title, description and its tags.

    Your application cannot update a record that was created by another application.

    hashtag
    Parameters

    Name

    hashtag
    Result

    The result is a .

    hashtag
    Examples

    Update the tags and the description.

    queryRecords

    This method returns a list of records owned by the current user. By default, you only get the records created by your application. To query the records from another application, you must filter by the license id of this application.

    hashtag
    Parameters

    Name

    Type

    Required

    triangle-exclamation

    Depending on the query, this method may return a lot of records. To avoid performance issues, you should always set an offset and a limit.

    hashtag
    query

    The query object can contain one or more of these fields:

    hashtag
    orderBy

    The orderBy parameters is an array of objects, similar to the orderBy clause of a SQL request.

    Each object must have a single attribute. The key of the attribute is the name of record's field you want to order by. The value of the attribute must be "ASC" or "DESC", to order is ascending or descending order.

    For example, to order the records by their start date, in descending order, you must use the object {"startDatetime":"DESC"}. To sort the records by title, in alphabetical order, you must use {"title":"ASC"}.

    You can order the records by these fields: title, description, startDatetime, modifiedDatetime, duration, subjectName, applicationId. The option to order by applicationId was added in Cortex 2.5.0

    hashtag
    limit and offset

    These parameters are to implement pagination. It useful if you want to display the records in a UI. You must order the results to use these parameters.

    First you should call this method with an offset of zero, and a limit of X. In the response, check the value of count. If count is greater than the limit, then you should call this method again with an offset of X. And then with an offset of 2*X, 3*X... until you get all the records for your query.

    hashtag
    Result

    The result is an object that includes these fields:

    hashtag
    Examples

    Get the 10 most recent records created by EmotivPRO.

    Get some records using a keyword.

    Records

    After you opened a session with a headset, you can create a record. A record is a permanent object to store data from an EMOTIV headset. You can associate a subject to a record. You can add one or more markers to a record.

    Unlike a session, a record is a permanent object. It is stored on the hard drive and then can be synchronized to the EMOTIV cloud. The opt-out configuration can let you decide if the records of a user are uploaded to the cloud or not.

    hashtag
    Record lifetime

    First, you must with a headset. Then you call to start a new record. When the record is in progress, you can add to this record. You stop a record with .

    The record is linked to the session, so if you close the session, or if your application is disconnected from the Cortex service, then Cortex will automatically close the record.

    After you stop the record you can export its data to a CSV or EDF file using .

    configOptOut

    This method is to configure the opt-out feature for the records. This feature lets you decide if the 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 to know if this record will stay on the local machine, or if it will be uploaded to the EMOTIV cloud.

    Some 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

    hashtag
    Parameters

    hashtag
    Result

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

    hashtag
    Possible Configurations

    Here is an overview of the possible configurations:

    hashtag
    Examples

    hashtag
    Get the current configuration

    hashtag
    Change the configuration

    Marker object

    A marker object includes these fields:

    getRecordInfos

    This method returns a list of records, selected by their id.

    hashtag
    Parameters

    requestToDownloadRecordData

    This method is to ask Cortex to download the EEG/motion/CQ/detections data of a record from the EMOTIV cloud.

    hashtag
    Use case

    Suppose that the user has installed Cortex on 2 computers, named computer A and computer B. On computer A, the user creates a record, and Cortex uploads this record to the EMOTIV cloud.

    Then, on computer B, Cortex automatically downloads the metadata of this record, ie its name, description, start time, end time, etc... So this record is visible when you call methods like or

    Record object

    Some methods of the API return one or more record objects, for example .

    hashtag
    Description

    A record object includes these fields:

    Markers

    A marker is to mark a point in time, or a period of time, inside a .

    Markers are always linked to a record, so you must start a record before you add a marker. You can't add nor update a marker after the record is stopped. You can associate some data to each marker, like a value and a label.

    There are two types of markers:

    • An instance marker is to mark a point in time. You call to create the marker at a specific timestamp.

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "createSession",
        "params": {
            "cortexToken": "xxx",
            "headset": "EPOCPLUS-3B9AXXX",
            "status": "open"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "appId": "com.jon.snow.winterfell-app",
            "headset": {
                "connectedBy": "dongle",
                "customName": "",
                "dongle": "6ff",
                "firmware": "625",
                "id": "EPOCPLUS-3B9AXXXX",
                "motionSensors": [
                    "GYROX",
                    "GYROY",
                    "GYROZ",
                    "ACCX",
                    "ACCY",
                    "ACCZ",
                    "MAGX",
                    "MAGY",
                    "MAGZ"
                ],
                "sensors": [
                    "AF3",
                    "F7",
                    "F3",
                    "FC5",
                    "T7",
                    "P7",
                    "O1",
                    "O2",
                    "P8",
                    "T8",
                    "FC6",
                    "F4",
                    "F8",
                    "AF4"
                ],
                "settings": {
                    "eegRate": 256,
                    "eegRes": 16,
                    "memsRate": 64,
                    "memsRes": 16,
                    "mode": "EPOCPLUS"
                },
                "status": "connected"
            },
            "id": "8bfc26de-754b-4c1f-9771-acfd1a7da02c",
            "license": "",
            "owner": "jon.snow",
            "recordIds": [],
            "recording": false,
            "started": "2019-05-29T14:18:45.108+07:00",
            "status": "opened",
            "stopped": "",
            "streams": []
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "createSession",
        "params": {
            "cortexToken": "xxx",
            "headset": "EPOCPLUS-3B9AXXX",
            "status": "active"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "subscribe",
        "params": {
            "cortexToken": "xxx",
            "session": "f8cb7289-9a92-438b-8281-e5fdffe8166e",
            "streams": ["met","mot"]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "failure": [],
            "success": [
                {
                    "cols": ["eng","exc","lex","str","rel","int","foc"],
                    "sid": "f8cb7289-9a92-438b-8281-e5fdffe8166e",
                    "streamName": "met"
                },
                {
                    "cols": [
                        "COUNTER_MEMS",
                        "INTERPOLATED_MEMS",
                        "GYROX",
                        "GYROY",
                        "GYROZ",
                        "ACCX",
                        "ACCY",
                        "ACCZ",
                        "MAGX",
                        "MAGY",
                        "MAGZ"
                    ],
                    "sid": "f8cb7289-9a92-438b-8281-e5fdffe8166e",
                    "streamName": "mot"
                }
            ]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "subscribe",
        "params": {
            "cortexToken": "xxx",
            "session": "49eb6cb0-9df6-414a-b3e8-cfa17198daa0",
            "streams": ["met","eeg"]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "failure": [
                {
                    "code": -32016,
                    "message": "The stream is unavailable or unsupported.",
                    "streamName": "eeg"
                }
            ],
            "success": [
                {
                    "cols": ["eng","exc","lex","str","rel","int","foc"],
                    "sid": "49eb6cb0-9df6-414a-b3e8-cfa17198daa0",
                    "streamName": "met"
                }
            ]
        }
    }
    {
        "id": "8bfc26de-754b-4c1f-9771-acfd1a7da02c",
        "status": "opened",
        "owner": "jon.snow",
        "license": "",
        "appId": "com.jon.snow.winterfell-app",
        "started": "2019-05-29T14:18:45.108+07:00",
        "stopped": "",
        "headset": {
            "status": "connected"
            "connectedBy": "dongle",
            "customName": "",
            "dongle": "6ff",
            "firmware": "625",
            "id": "EPOCPLUS-3B9AXXXX",
            "motionSensors": [
                "GYROX",
                "GYROY",
                "GYROZ",
                "ACCX",
                "ACCY",
                "ACCZ",
                "MAGX",
                "MAGY",
                "MAGZ"
            ],
            "sensors": [
                "AF3",
                "F7",
                "F3",
                "FC5",
                "T7",
                "P7",
                "O1",
                "O2",
                "P8",
                "T8",
                "FC6",
                "F4",
                "F8",
                "AF4"
            ],
            "settings": {
                "eegRate": 256,
                "eegRes": 16,
                "memsRate": 64,
                "memsRes": 16,
                "mode": "EPOCPLUS"
            }
        },
        "recordIds": [],
        "recording": false,
        "streams": ["met","mot"]
    }
    {
        "id":8,
        "jsonrpc":"2.0",
        "result":{
            "failure":[],
            "success":[{
                "cols":["act","pow"],
                "sid":"7f899d66-442b-4bf4-9752-ed06d57b72c3",
                "streamName":"com"
            }]
        }
    }
    ["act","pow"]
    {
        "com": ["push", 0.376],
        "sid": "7f899d66-442b-4bf4-9752-ed06d57b72c3",
        "time": 1559900743.3318
    }
    [
      "COUNTER",
      "INTERPOLATED",
      "AF3","T7","Pz","T8","AF4",
      "RAW_CQ",
      "MARKER_HARDWARE",
      "MARKERS"
    ]
    {
      "eeg": [
        8,
        0,
        4202.051, 4235.385, 4146.667, 4210.769, 4108.718,
        0,
        0,
        []
      ],
      "sid": "8bbc58bd-0ab1-404e-b472-dac1322dbe5b",
      "time": 1590402103.9016
    }
    [
        "COUNTER",
        "INTERPOLATED",
        "AF3","F7","F3","FC5","T7","P7","O1","O2","P8","T8","FC6","F4","F8","AF4",
        "RAW_CQ",
        "MARKER_HARDWARE",
        "MARKERS"
    ]
    {
        "eeg":[
            14,
            0,
            4161.41,4212.051,4135,4161.538,4195,4184.103,4182,
            0,
            0, 
            [{
                "applicationId": "com.emotiv.emotivpro",
                "isStop": false,
                "label": "Blink eye while relaxing",
                "markerId": "cc577d88-f404-482a-9629-3e08a0dbcc02",
                "port": "KeyStroke",
                "recordId": "f3c76112-9b7f-43ab-a906-5c15dc4dd55e",
                "value": 22
            }]
        ],
        "sid":"01e1e0f1-4416-436f-8f9d-5bf21e2e4784",
        "time":1559902873.8976
    }
    [
      "COUNTER_MEMS","INTERPOLATED_MEMS",
      "Q0","Q1","Q2","Q3",
      "ACCX","ACCY","ACCZ",
      "MAGX","MAGY","MAGZ"
    ]
    {
      "mot": [
        48,
        0,
        0.735341, 0.255615, 0.627441, -0.015869,
        0.948257, -0.354986, -0.083497,
        -44.656766, -86.970985, 23.221568
      ],
      "sid": "da18712c-a292-46b7-a5a0-1bd64a3dc6f3",
      "time": 1590402244.8242
    }
    [
        "COUNTER_MEMS","INTERPOLATED_MEMS",
        "GYROX","GYROY","GYROZ",
        "ACCX","ACCY","ACCZ",
        "MAGX","MAGY","MAGZ"
    ]
    {
        "mot":[
            14,0,
            8206,8187,8181,
            4235,8668,8128,
            8294,8237,7938
        ],
        "sid":"462c4d75-113f-4664-a443-3aaa02c178d0",
        "time":1559902927.7428
    }
    [
      "Battery",
      "Signal",
      ["AF3","T7","Pz","T8","AF4","OVERALL"],
      "BatteryPercent"
    ]
    {
      "dev": [
        3,
        1,
        [4,1,1,2,4,25],
        74
      ],
      "sid": "edcb9287-f6d5-4c22-9b3f-783d72750f24",
      "time": 1590403053.5002
    }
    [
        "Battery","Signal",
        ["AF3","F7","F3","FC5","T7","P7","O1","O2","P8","T8","FC6","F4","F8","AF4","OVERALL"],
        "BatteryPercent"
    ]
    {
        "dev":[
            4,2,
            [2,0,1,0,1,0,0,4,0,1,0,1,0,1,24],
            98
        ],
        "sid":"d02af7d5-2bc0-46f4-8804-026a42ad7841",
        "time":1559903194.6721
    }
    [
      "batteryPercent",
      "overall",
      "sampleRateQuality",
      "AF3","T7","Pz","T8","AF4"
    ]
    {
      "eq": [
        78,
        25,
        1.0,
        4,1,1,2,4
      ],
      "sid": "edcb9287-f6d5-4c22-9b3f-783d72750f24",
      "time": 1590403053.5002
    }
    [
        "AF3/theta","AF3/alpha","AF3/betaL","AF3/betaH","AF3/gamma",
        "T7/theta","T7/alpha","T7/betaL","T7/betaH","T7/gamma",
        "Pz/theta","Pz/alpha","Pz/betaL","Pz/betaH","Pz/gamma",
        "T8/theta","T8/alpha","T8/betaL","T8/betaH","T8/gamma",
        "AF4/theta","AF4/alpha","AF4/betaL","AF4/betaH","AF4/gamma"
    ]
    {
      "pow": [
        1.246,0.706,0.566,1.065,0.602,
        10.293,4.374,11.638,351.767,40.273,
        50.159,4.585,0.467,1.481,3.764,
        9.861,3.139,2.094,3.342,4.452,
        75.652,1.972,2.932,2.555,7.005
      ],
      "sid": "ff0245d1-9531-424c-9f6d-9f736f465516",
      "time": 1590403491.0307
    }
    [
        "AF3/theta","AF3/alpha","AF3/betaL","AF3/betaH","AF3/gamma",
        "F7/theta","F7/alpha","F7/betaL","F7/betaH","F7/gamma",
        "F3/theta","F3/alpha","F3/betaL","F3/betaH","F3/gamma",
        "FC5/theta","FC5/alpha","FC5/betaL","FC5/betaH","FC5/gamma",
        "T7/theta","T7/alpha","T7/betaL","T7/betaH","T7/gamma",
        "P7/theta","P7/alpha","P7/betaL","P7/betaH","P7/gamma",
        "O1/theta","O1/alpha","O1/betaL","O1/betaH","O1/gamma",
        "O2/theta","O2/alpha","O2/betaL","O2/betaH","O2/gamma",
        "P8/theta","P8/alpha","P8/betaL","P8/betaH","P8/gamma",
        "T8/theta","T8/alpha","T8/betaL","T8/betaH","T8/gamma",
        "FC6/theta","FC6/alpha","FC6/betaL","FC6/betaH","FC6/gamma",
        "F4/theta","F4/alpha","F4/betaL","F4/betaH","F4/gamma",
        "F8/theta","F8/alpha","F8/betaL","F8/betaH","F8/gamma",
        "AF4/theta","AF4/alpha","AF4/betaL","AF4/betaH","AF4/gamma"
    ]
    {
        "pow":[
            0.225,0.213,0.537,0.19,0.34,
            0.511,0.808,1.706,0.839,0.416,
            ...
            0.92,0.469,1.657,1.443,0.912,
            2.675,0.824,0.951,0.303,0.881
        ],
        "sid":"f581b2bb-c043-4a00-8737-1e8e09a9a81b",
        "time":1559902987.133
    }
    [
        "attention.isActive",
        "attention",
        "cognitiveStress.isActive",
        "cognitiveStress"
    ]
    {
      "met": [True, 0.8, True, 0.4],
      "sid":"6a68b92a-cb1f-4062-bf1f-74424fbae066",
      "time": 1759225262.5052
      }
    [
        "eng.isActive","eng",
        "exc.isActive","exc","lex",
        "str.isActive","str",
        "rel.isActive","rel",
        "int.isActive","int",
        "attention.isActive","attention"
    ]
    {
        "met":[false,null,false,null,null,false,null,true,0.266589,false,null,true,0.098421],
        "sid":"6a68b92a-cb1f-4062-bf1f-74424fbae065",
        "time":1559903137.1741
    }
    ["act","pow"]
    {
        "com":["pull",0.564],
        "sid":"79cc669b-af2e-465a-bdc2-0e9bd4aebe80",
        "time":1559903099.348
    }
    ["eyeAct","uAct","uPow","lAct","lPow"]
    {
        "fac":["neutral","neutral",0,"clench",0.0576],
        "sid":"a4f69c56-9769-4a4d-950c-490eb5ebe372",
        "time":1559903035.2961
    }
    ["event","msg"]
    {
        "sid":"c7e7b527-2b2e-4ec6-8c74-cf16aae8540b",
        "sys":["mentalCommand","MC_Started"],
        "time":1559903035.2961
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "unsubscribe",
        "params": {
            "cortexToken": "xxx",
            "session": "c6b52ab2-8828-412c-b1b9-9c48842dc0c2",
            "streams": ["met","mot"]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "failure":[],
            "success":[
                {"streamName":"met"},
                {"streamName":"mot"}
            ]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "deleteRecord",
        "params": {
            "cortexToken": "xxx",
            "records": [
                "d8fe7658-71f1-4cd6-bb5d-f6775b03438f",
                "invalid-id"
            ]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "success": [
                {"recordId":"d8fe7658-71f1-4cd6-bb5d-f6775b03438f"}
            ],
            "failure": [
                {"recordId":"invalid-id","code":1234,"message":"..."}
            ]
        }
    }
    open a session
    createRecord
    markers
    updateRecord
    exportRecord
    queryHeadsets
    load a profile
    BCI
    special EEG sensor mapping
    session
    special EEG sensor mapping
    special EEG sensor mapping
    BCI
    authorize
    createSession
    subscribe
    createRecord
    headset object
    createSession
    updateSession
    updateSession
    authorize
    createSession
    authorize

    An interval marker is to mark a period of time, with a beginning and an end. First you create an instance marker with injectMarker. This sets the beginning of the interval. Then you call updateMarker to set the end of the interval, turning the instance marker into an interval marker.

    record
    injectMarker

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    record

    string

    yes

    A record id returned by createRecord.

    title

    string

    no

    The new title of the record.

    This parameter was added in Cortex 2.5.0

    description

    string

    no

    The new description of the record. Omit this parameter if you don't want to update the description.

    tags

    array of strings

    no

    The new tags of the record.Omit this parameter if you don't want to update the tags.

    record object
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "updateRecord",
        "params": {
            "cortexToken": "xxx",
            "record": "d8fe7658-71f1-4cd6-bb5d-f6775b03438f",
            "description": "My best record ever.",
            "tags": ["best", "snow", "direwolf"]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "applicationId": "com.jon.snow.winterfell-app",
            "applicationVersion": "1.0",
            "description": "My best record ever.",
            "endDatetime": "2019-06-06T11:42:23.436191+07:00",
            "experimentId": 0,
            "licenseId": "xxx",
            "licenseScope": ["pm","eeg"],
            "ownerId": "76c3468a-d9c0-428d-81b4-bdac5d63860e",
            "startDatetime": "2019-06-06T11:41:53.088632+07:00",
            "tags": ["best", "snow", "direwolf"],
            "title": "Cortex Examples C++",
            "uuid": "d8fe7658-71f1-4cd6-bb5d-f6775b03438f"
        }
    }

    Subjects

    A subject represents a human being who is the subject of a record, ie the person wearing the headset during the record. A subject is a permanent object. It is stored on the hard drive and then synchronized to the EMOTIV cloud.

    To associate a subject to a record, you must create the subject first, by calling createSubject. Then you must specify the subject name when you call createRecord. A subject is identified by his/her name.

    You can call querySubjects to list the subjects already created for the current user.

    An object with fields "from" and "to" to filter the records by their start date time.

    modifiedDatetime

    object

    An object with fields "from" and "to" to filter the records by their modification date time.

    duration

    object

    An object with fields "from" and "to" to filter the records by their duration.

    The offset you specified in the parameters.

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    query

    object

    yes

    An object to filter the records.

    orderBy

    array of objects

    yes

    Specify how to sort the records.

    limit

    number

    no

    The maximum number of records that this method should return. A limit of zero means no maximum.

    offset

    number

    no

    The number of record that this method should skip before returning the result. If the limit is zero, then Cortex will ignore this parameter.

    includeMarkers

    boolean

    no

    If true then the record objects in the result will include the markers linked to each record. The default value is false because a record may have a large number of markers.

    This parameter was added in Cortex 2.1

    includeSyncStatusInfo

    boolean

    no

    If true then the record object in the result will include the field "syncStatus". This field tells you if the record was uploaded to the EMOTIV cloud or not.

    The default value is false.

    This parameter was added in Cortex 2.6.3

    Name

    Type

    Description

    licenseId

    string

    Set this parameter to filter the records by their license.

    applicationId

    string

    If you set the licenseId, then you can set this parameter to further filter the records by application.

    keyword

    string

    Set this parameter to filter the records by title, description, or subject name.

    startDatetime

    Name

    Type

    Description

    records

    array of objects

    An array of record objects.

    count

    number

    The total number of records that match the query.

    limit

    number

    The limit you specified in the parameters.

    offset

    object

    number

    no

    If the status is "set" then you must set this parameter to true or false, in order to turn the opt-out feature on or off. If the status is "get" then you should omit this parameter.

    A text message.

    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.

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    status

    string

    yes

    Must be "get" or "set". Use "get" to read the current configuration of the opt-out feature. Use "set" to turn the opt-out on or off.

    newOptOut

    Name

    Type

    Description

    optOutAvail

    boolean

    If false then the opt-out is always off. The value of this field depends on the current license. Some license force you to upload the records to the cloud.

    forceOptOut

    boolean

    If true (and optOutAvail is also true) then the opt-out is always on. The value of this field depends on the current license. Some license don't let you upload the records to the cloud.

    currOptOut

    boolean

    The current configuration of the opt-out.

    If this value is true, then the records created by your application won't be uploaded to the cloud. If this value is false, then they will.

    message

    optOutAvail

    forceOptOut

    currOptOut

    Description

    true

    false

    Variable, false by default

    By default, currOptOut is false and the records created by your application will be uploaded to the cloud. You can change the opt-out configuration for each EmotivID.

    true

    true

    Always true

    The records will never be uploaded to the cloud. You cannot change the configuration.

    false

    Record object
    licenses

    boolean

    string

    false

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "queryRecords",
        "params": {
            "cortexToken": "xxx",
            "limit": 10,
            "offset": 0,
            "orderBy": [
                { "startDatetime": "DESC" }
            ],
            "query": {
                "applicationId": "com.emotiv.emotivpro",
                "licenseId": "yyy"
            },
            "includeSyncStatusInfo": true
        }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "count": 1,
        "limit": 10,
        "offset": 0,
        "records": [{
          "applicationId": "com.emotiv.emotivpro",
          "applicationVersion": "2.6.3",
          "demographics": {
            "uuid": "",
            "validated": false
          },
          "description": "A simple experiment with a drone",
          "endDatetime": "2021-01-06T16:32:50.572490+07:00",
          "experimentId": 0,
          "headbandPosition": null,
          "licenseId": "yyy",
          "licenseScope": ["pm", "eeg"],
          "localOnly": false,
          "ownerId": "ddeca960-9336-4a51-a2d2-9cb6e8fd5524",
          "startDatetime": "2021-01-06T16:32:13.431865+07:00",
          "subject": {
            "subjectName": "Ben Kenobi"
          },
          "syncStatus": {
            "status": "neverUploaded"
          },
          "tags": [],
          "title": "Experiment 42",
          "uuid": "1f2a8f85-7200-400a-a8f0-fd5c0b331852"
        }]
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "queryRecords",
      "params": {
        "cortexToken": "xxx",
        "includeMarkers": true,
        "limit": 2,
        "offset": 0,
        "orderBy": [
          {
            "startDatetime": "DESC"
          }
        ],
        "query": {
          "keyword": "Cortex Example"
        }
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "count": 9,
        "limit": 2,
        "offset": 0,
        "records": [
          {
            "applicationId": "com.xxx.cortex-examples",
            "applicationVersion": "1.0",
            "description": "",
            "endDatetime": "2020-03-09T15:59:34.794356+07:00",
            "experimentId": 0,
            "headbandPosition": null,
            "licenseId": "xxx",
            "licenseScope": [
              "pm",
              "eeg"
            ],
            "localOnly": false,
            "markers": [
              {
                "endDatetime": "2020-03-09T15:59:09.680802+07:00",
                "extras": {},
                "label": "test1",
                "port": "Cortex Example",
                "startDatetime": "2020-03-09T15:59:09.680802+07:00",
                "type": "instance",
                "uuid": "ba8ed3a9-3e0b-4a17-9227-96ae05fa1767",
                "value": 41
              },
              {
                "endDatetime": "2020-03-09T15:59:25.873059+07:00",
                "extras": {},
                "label": "test2",
                "port": "Cortex Example",
                "startDatetime": "2020-03-09T15:59:16.867054+07:00",
                "type": "interval",
                "uuid": "2cfe93cc-f242-49d6-8165-7b13147e7c10",
                "value": 42
              }
            ],
            "ownerId": "94f7c5ed-3d24-4c29-8243-96aa7db80d4a",
            "startDatetime": "2020-03-09T15:59:04.344671+07:00",
            "subject": {
              "subjectName": "Bob"
            },
            "tags": [],
            "title": "Cortex Examples C++",
            "uuid": "b26f35c3-42ee-4612-a9b9-09af04c2ba37"
          },
          {
            "applicationId": "com.xxx.cortex-examples",
            "applicationVersion": "1.0",
            "description": "",
            "endDatetime": "2020-03-09T15:58:37.792248+07:00",
            "experimentId": 0,
            "headbandPosition": null,
            "licenseId": "xxx",
            "licenseScope": [
              "pm",
              "eeg"
            ],
            "localOnly": false,
            "markers": [
              {
                "endDatetime": "2020-03-09T15:58:12.875515+07:00",
                "extras": {},
                "label": "test1",
                "port": "Cortex Example",
                "startDatetime": "2020-03-09T15:58:12.875515+07:00",
                "type": "instance",
                "uuid": "e22d46a0-480a-452a-a65e-d6b4448e3f7b",
                "value": 41
              },
              {
                "endDatetime": "2020-03-09T15:58:28.872019+07:00",
                "extras": {},
                "label": "test2",
                "port": "Cortex Example",
                "startDatetime": "2020-03-09T15:58:20.873850+07:00",
                "type": "interval",
                "uuid": "c8fd9191-43da-4e28-970d-bf9f24404c8a",
                "value": 42
              }
            ],
            "ownerId": "94f7c5ed-3d24-4c29-8243-96aa7db80d4a",
            "startDatetime": "2020-03-09T15:58:08.036369+07:00",
            "subject": {
              "subjectName": "Marie"
            },
            "tags": [],
            "title": "Cortex Examples C++",
            "uuid": "33d2c56a-4cdf-4e2b-a5bb-db127f838248"
          }
        ]
      }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "configOptOut",
        "params": {
            "cortexToken": "xxx",
            "status": "get"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "currOptOut": false,
            "forceOptOut": false,
            "message": "Get opt-out configuration successfully",
            "optOutAvail": true
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "configOptOut",
        "params": {
            "cortexToken": "xxx",
            "status": "set",
            "newOptOut": true
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "currOptOut": true,
            "forceOptOut": false,
            "message": "Update opt-out configuration successfully",
            "optOutAvail": true
        }
    }

    yes

    The path of a local folder. Cortex will write the exported files in that folder. You must create this folder before you call this method. Cortex will return an error if the folder doesn't exist.

    On iOS, this parameter doesn't exist. Cortex exports the data to the "Documents" folder of the current application.

    streamTypes

    array of strings

    yes

    List of the data streams you want to export.

    format

    string

    yes

    The format of the exported files. Must be "EDF", "EDFPLUS", "BDFPLUS" or "CSV".

    version

    string

    no

    If the format is "EDF", then you must omit this parameter.

    If the format is "CSV", then this parameter must be "V1" or "V2".

    licenseIds

    array of strings

    no

    The default value is an empty list, which means that you can only export the records created by your application. You can provide the license ID of other applications in order to export the records created by these applications.

    This parameter was added in Cortex 2.6.3

    includeDemographics

    boolean

    no

    If true then the exported JSON file will include the demographic data of the user. It is only for the records created by .

    The default value is false.

    This parameter was added in Cortex 2.6.3

    includeSurvey

    boolean

    no

    If true then the exported JSON file will include the survey data of the record. It is only for the records created by .

    The default value is false.

    This parameter was added in Cortex 2.6.3 From Cortex 3.5.0, survey data will be exported in a separate CSV file (along with JSON file).

    includeMarkerExtraInfos

    boolean

    no

    If true then the markers of the records will be exported to a CSV file. This file is compatible with .

    The default value is false.

    This parameter was added in Cortex 2.6.3

    includeDeprecatedPM

    boolean

    no

    If true then deprecated performance metrics (i.e. Focus) will be exported.

    The default value is false. This parameter was added in Cortex 3.5.6

    Export the band powers of each EEG sensor.

    1 CSV file for the markers if the parameter includeMarkerExtraInfos is true
    1 CSV file for the performance metrics
  • 1 JSON file for the markers

  • 1 CSV file for the markers if the parameter includeMarkerExtraInfos is true

  • Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    recordIds

    array of strings

    yes

    An array of record ids. These are the ids of the records you want to export.

    folder

    Stream

    Description

    EEG

    Export the raw EEG data, the contact quality of each EEG sensor, and the markers. The license scope of the record must contain the scope "eeg".

    MOTION

    Export the motion data.

    PM

    Export the results of the performance metric detection.

    If the license scope of the record contains the scope "pm" then Cortex will export the high resolution performance metrics, at 2 hertz. Otherwise Cortex will export the low resolution data, at 0.1 hertz.

    MC

    Export the results of the mental command detection.

    FE

    Export the results of the facial expression detection.

    Name

    Type

    Description

    success

    array of objects

    For each record you successfully exported, this array contains an object that includes the record id.

    failure

    array of objects

    For each record that couldn't be exported, this array contains an object that describes the error.

    Name

    Type

    Description

    recordId

    string

    The id of the record that was successfully exported.

    Name

    Type

    Description

    recordId

    string

    The id of the record that couldn't be exported.

    code

    number

    The error code.

    message

    string

    The error message.

    stop the record
    warning 30
    EmotivPRO user manualarrow-up-right

    string

    BP

    yes

    The title of the record. Must be 200 characters or less.

    description

    string

    no

    The description of the record.

    subjectName

    string

    no

    The name of a subject created by . The subject is the person wearing the headset during the record. If you omit this field, then Cortex assumes that the is using the headset.

    tags

    array of strings

    no

    A list of tags you can associate to this record. You can use to search the records by tags.

    experimentId

    number (integer)

    no

    An experiment id you can associate to this record. If you omit this parameter then the experimentId of the record will be zero.

    This parameter was added in Cortex 2.2.1

    Name

    Type

    Required

    Description

    cortexToken

    string

    yes

    A token returned by authorize.

    session

    string

    yes

    A session id returned by createSession.

    title

    Name

    Type

    Description

    record

    object

    A record object that represents the created record.

    sessionId

    string

    The id of the session this record is linked to.

    string

    The value you set in .

    label

    string

    The label of the marker.

    port

    string

    The port of the marker, ie where the marker comes from. Examples: "Software", "Serial", etc...

    startDatetime

    string (ISO date time)

    The timestamp you set in .

    endDatetime

    string (ISO date time)

    The timestamp you set in .

    If you didn't call this method, then endDatetime is equal to startDatetime.

    extras

    object

    Can be any extra information you want to associate with this marker.

    hashtag
    Examples

    An instance marker:

    An interval marker:

    Name

    Type

    Description

    uuid

    string

    The id of the marker.

    type

    string

    Can be "interval" or "instance".

    value

    string or number

    string

    yes

    A token returned by .

    recordIds

    array of strings

    yes

    A list of records id.

    hashtag
    Result

    The result is an array of record objects, including the markers of each record.

    hashtag
    Examples

    {
        "id": 1,
        "
    
    {
        "id": 1,
        "
    

    Name

    Type

    Required

    Description

    cortexToken

    .

    But Cortex doesn't automatically download the actual data of the record, ie the EEG, motion, CQ, the results of the detections, etc... So you cannot export this record. To download the actual data, you must call the method "requestToDownloadRecordData".

    hashtag
    Parameters

    Name
    Type
    Required
    Description

    cortexToken

    string

    yes

    A token returned by .

    recordIds

    array of strings

    yes

    A list of record ids.

    hashtag
    Result

    The result is an object with 2 fields:

    Name
    Type
    Description

    success

    array of objects

    List of the records that Cortex will start to download.

    failure

    array of objects

    List of the records that Cortex will not download.

    Each object in the success array include these fields:

    Name
    Type
    Description

    recordId

    string

    The id of a record that was added to the Cortex download queue.

    Cortex will now start the download.

    Each object in the failure array include these fields:

    Name
    Type
    Description

    recordId

    string

    The id of a record that Cortex cannot download.

    code

    number

    The error code for this record.

    message

    string

    The error message for this record.

    hashtag
    Example

    queryRecord
    getRecordInfos

    Description

    uuid

    string

    The id of this record.

    ownerId

    string

    The id of the user this record belongs to. It is a GUID, it is not the EmotivID of the user.

    applicationId

    string

    The id of the application that created this record.

    applicationVersion

    string

    The version of the application that created this record.

    title

    string

    The title of this record.

    description

    string

    The description of this record.

    tags

    array of strings

    The tags associated to this record.

    experimentId

    number (integer)

    The experiment id associated to this record.

    startDatetime

    string (ISO datetime)

    When this record was created.

    endDatetime

    string (ISO datetime)

    When this record was stopped.

    licenseId

    string

    The id of the license used by this record.

    licenseScope

    array of strings

    List of the data streams the license has access to.

    The scope "eeg" gives access to the raw EEG data.

    The scope "pm" gives access to the 2 hertz performance metrics.

    subject

    object

    This object has a single field "subjectName". It is the subject name used to create this record. You can use to get more information about the subject. If the record was created without a subject name, then the field "subjectName" contains the EmotivID of the user.

    localOnly

    boolean

    If true then this record will not be uploaded to the EMOTIV cloud.

    If false then it will be uploaded.

    headbandPosition

    string

    If the headset is an EPOC X, then this field tells you the position of the headband of this headset during this record. Can be "back" or "top". If the headset is not an EPOC X, then this field is null. See for details.

    This field was added in Cortex 2.4

    Depending on how you get the record, it may contains an additional field for the markers:

    Name

    Type

    Description

    markers

    array of objects

    A list of . The markers added to this record.

    hashtag
    syncStatus

    Record object returned from getRecordInfos has an additional field syncStatus:

    Name

    Type

    Description

    syncStatus

    object

    contain information of sync status (status field) and/or uploading/downloading progress (percent field).

    Available values for status:

    • "pending": the record is waiting for being downloaded.

    • "downloading": the record's data is being downloaded. Check progress in percent field.

    • "downloaded": the record's data is on both the Emotiv Cloud and the local machine.

    • "notDownloaded": the record's data is on the Emotiv Cloud and not on the local machine.

    • "failedEncryption", "failedDownload": sync status of the record if fails.

    • "notUploaded": the record is not uploaded to the Emotiv Cloud yet.

    • "uploading": the record is being uploaded to the Emotiv Cloud. Check progress in percent field.

    • "uploaded": the record is on both the Emotiv Cloud and the local machine.

    • "failedAccessFile", "failedDecryption", "failedUpload": sync status of the record whose uploading fails. Cortex will try uploading again.

    • "neverUploaded": The record will never be uploaded to the Emotiv Cloud. The record is created with virtual headsets in this case.

    For example:

    • A record is created but waiting for being uploaded to the Emotiv Cloud:

    • A record is waiting for downloaded from the Emotiv Cloud:

    • A record is created and is uploading to the Emotiv Cloud:

    hashtag
    Examples

    Name

    queryRecords

    Type

    number

    Raw value of the contact quality.

    MARKER_HARDWARE

    number

    1 if a hardware marker was received for this EEG sample.

    0 otherwise.

    MARKERS

    array of objects

    An array of markers. It includes the markers sent by all the applications working with this headset.

    This label was added in Cortex 2.1

    string or number

    The value of this marker, set by injectMarker.

    label

    string

    The label of this marker, set by injectMarker.

    port

    string

    The port of this marker, set by injectMarker.

    isStop

    boolean

    False if this is an instance marker.

    True if this marks the end of an interval marker.

    number

    X, Y, Z axis of the magnetometer.

    Q0, Q1, Q2, Q3

    number

    Quaternions of the gyroscope (newer EMOTIV headsets)

    GYROX, GYROY, GYROZ

    number

    X, Y, Z axis of the gyroscope (older EMOTIV headsets)

    number

    The battery level of the headset, from 0 to 100. It has the same purpose as the label "Battery", but it is more precise.

    This label was added in Cortex 2.7

    number

    The EEG quality of each EEG sensor, from 0 to 4.

    boolean

    Active flag for attention.

    number

    Stress measures emotional tension experienced when completing a task.

    rel

    number

    Relaxation measures calm focus after a period of intense concentration.

    int

    number

    Interest measures attraction or aversion to stimuli.

    attention

    number

    Attention measures sustained focus on a single task.

    eng.isActive

    boolean

    Active flag for engagement.

    exc.isActive

    boolean

    Active flag for excitement.

    str.isActive

    boolean

    Active flag for stress.

    rel.isActive

    boolean

    Active flag for relaxation.

    int.isActive

    boolean

    Active flag for interest

    attention.isActive

    boolean

    Active flag for attention.

    string

    The lower face action.

    lPow

    number

    Power of the lower face action. Zero means "low power", 1 means "high power".

    getDetectionInfo
    getDetectionInfo

    updateMarker

    This method is to update a marker that was previously created by injectMarker.

    This method set the end date time of a marker, turning an "instance" marker into an "interval" marker. You can also update the extras object.

    The marker must belong to a record that is still in progress. You cannot update the marker if the record is already stopped.

    hashtag
    Parameters

    hashtag
    Result

    The result is an object containing these fields:

    hashtag
    Examples

    updateSubject

    This method is to update an existing subject.

    This method was added in Cortex 2.1

    hashtag
    Parameters

    Name

    Type

    A subject is identified by his/her name, so you must provide the name of the subject you want to update. Then you can set one or more of the not required fields to update their value.

    hashtag
    Result

    The result is a representing the updated subject.

    hashtag
    Examples

    Update the date of birth of a subject.

    injectMarker

    This method is to create an "instance" marker to the current record of a session. Then you can call updateMarker to turn this marker into an "interval" marker.

    circle-info

    You must call createRecord before you call this method.

    hashtag
    Parameters

    hashtag
    Result

    The result is an object containing these fields:

    hashtag
    Examples

    stopRecord

    This method is to stop a record that was previously started by createRecord. This will set the end date time of the record to the current date time.

    hashtag
    Parameters

    Name

    Type

    Required

    A record is linked to a session. So to close a record, you need to provide the session id.

    hashtag
    Result

    The result is an object containing these fields:

    hashtag
    Example

    getDemographicAttributes

    This method returns the list of valid names and values for the demographic attribute objects.

    This method was added in Cortex 2.1

    hashtag
    Parameters

    Name

    hashtag
    Result

    The result is an array of objects. Each object contain these fields:

    hashtag
    Example

    deleteSubjects

    This method is to delete one or more subjects.

    triangle-exclamation

    Deleting a subject is irreversible. There is no way to recover a deleted subject.

    This method was added in Cortex 2.1

    hashtag
    Parameters

    A subject is identified by his/her name, so you must provide the name of the subjects you want to delete.

    hashtag
    Result

    The result is an object that includes these fields:

    In case of success, you get an object with these fields:

    In case of failure, you get an object with these fields:

    hashtag
    Examples

    .

    Subject object

    A subject represents a human being who is the subject of a (ie an experiment).

    hashtag
    Description

    A subject object includes these fields:

    getCurrentProfile

    This method returns the training profile that is currently loaded for a specific headset.

    hashtag
    Parameters

    BCI

    You can use the Cortex API to develop a brain–computer interface (BCI), using facial expressions, mental commands, or both.

    circle-info

    Before you start programming your own BCI, it is strongly recommended that you use to get familiar with the main BCI features of Cortex. You should also check out the .

    circle-info

    getDetectionInfo

    This method returns useful information about the mental command training or the facial expression training.

    hashtag
    Parameters

    setupProfile

    This method is to manage the training profiles of the user.

    You create, rename or delete a profile. You can load and unload a profile for a headset if the EEG channels of this headset is supported by this training profile. And you can save a profile after the user completed a , or after you changed the of the profile.

    Before you load or unload a profile, you can call to know if a profile is currently loaded, and if it was loaded by your application.

    hashtag

    queryProfile

    This method returns the list of all the training profiles of the user.

    hashtag
    Parameters

    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "exportRecord",
        "params": {
            "cortexToken": "xxx",
            "folder": "/tmp/edf",
            "format": "EDF",
            "recordIds": [
                "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
            ],
            "streamTypes": [
                "EEG",
                "MOTION"
            ]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "failure": [],
            "success": [
                {
                    "recordId": "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
                }
            ]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "exportRecord",
        "params": {
            "cortexToken": "xxx",
            "folder": "/tmp/csv1",
            "format": "CSV",
            "recordIds": [
                "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
            ],
            "streamTypes": [
                "EEG",
                "MOTION",
                "PM",
                "BP"
            ],
            "version": "V1"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "failure": [],
            "success": [
                {
                    "recordId": "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
                }
            ]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "exportRecord",
        "params": {
            "cortexToken": "xxx",
            "folder": "/tmp/csv2",
            "format": "CSV",
            "recordIds": [
                "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
            ],
            "streamTypes": [
                "EEG",
                "MOTION",
                "PM",
                "BP"
            ],
            "version": "V2"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "failure": [],
            "success": [
                {
                    "recordId": "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
                }
            ]
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "method": "createRecord",
        "params": {
            "cortexToken": "xxx",
            "session": "1067dc90-eb17-489b-9514-69cb79ac696c",
            "title": "Cortex Examples C++"
        }
    }
    {
        "id": 1,
        "jsonrpc": "2.0",
        "result": {
            "record": {
                "uuid": "222eb845-bc44-4a01-bf28-07445a7c7e8a",
                "applicationId": "com.jon.snow.winterfell-app",
                "applicationVersion": "1.0",
                "description": "",
                "endDatetime": "",
                "experimentId": 0,
                "licenseId": "xxx",
                "licenseScope": ["pm","eeg"],
                "ownerId": "76c3468a-d9c0-428d-81b4-bdac5d63860e",
                "startDatetime": "2019-05-31T11:06:24.398560+07:00",
                "tags": [],
                "title": "Cortex Examples C++"
            },
            "sessionId": "1067dc90-eb17-489b-9514-69cb79ac696c"
        }
    }
    {
        "extras": {},
        "label": "test2",
        "port": "Cortex Example",
        "startDatetime": "2019-06-06T15:57:41.529661+07:00",
        "endDatetime":   "2019-06-06T15:57:41.529661+07:00",
        "type": "instance",
        "uuid": "26fccfd8-e487-4623-910a-1ba8591fcdcf",
        "value": 42
    }
    {
        "extras": {},
        "label": "test2",
        "port": "Cortex Example",
        "startDatetime": "2019-06-06T15:57:41.529661+07:00",
        "endDatetime":   "2019-06-06T15:57:49.530743+07:00",
        "type": "interval",
        "uuid": "26fccfd8-e487-4623-910a-1ba8591fcdcf",
        "value": 42
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "method": "requestToDownloadRecordData",
      "params": {
        "cortexToken": "xxx",
        "recordIds": [
            "33a9aa44-5a90-4881-8613-78493752b86d", 
            "3a4b7eb0-3b6c-4e16-a480-cbda8181f092"
          ]
      }
    }
    {
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
        "failure": [{
          "code": -32186,
          "message": "The record already exists.",
          "recordId": "33a9aa44-5a90-4881-8613-78493752b86d"
        }],
        "success": [{
          "recordId": "3a4b7eb0-3b6c-4e16-a480-cbda8181f092"
        }]
      }
    }
    {
        "status": "notUpload"
    }
    {
        "status": "pending"
    }
    {
        "status": "uploading",
        "percent": 30
    }
    {
        "applicationId": "com.jon.snow.winterfell-app",
        "applicationVersion": "1.0",
        "description": "",
        "startDatetime": "2019-06-06T15:57:28.596410+07:00",
        "endDatetime": "2019-06-06T15:57:58.472229+07:00",
        "experimentId": 0,
        "licenseId": "xxx",
        "licenseScope": [
            "pm",
            "eeg"
        ],
        "localOnly": false,
        "markers": [
            {
                "endDatetime": "2019-06-06T15:57:33.523627+07:00",
                "extras": {},
                "label": "test1",
                "port": "Cortex Example",
                "startDatetime": "2019-06-06T15:57:33.523627+07:00",
                "type": "instance",
                "uuid": "3e8d3a26-f4bf-486c-8ece-6efb8b739a51",
                "value": 41
            },
            {
                "endDatetime": "2019-06-06T15:57:49.530743+07:00",
                "extras": {},
                "label": "test2",
                "port": "Cortex Example",
                "startDatetime": "2019-06-06T15:57:41.529661+07:00",
                "type": "interval",
                "uuid": "26fccfd8-e487-4623-910a-1ba8591fcdcf",
                "value": 42
            }
        ],
        "ownerId": "76c3468a-d9c0-428d-81b4-bdac5d63860e",
        "subject": {
            "subjectName": "Hodor"
        },
        "tags": ["snow", "cold", "winter"],
        "title": "Cortex Examples C++",
        "uuid": "db01c15e-d916-4a7b-9f1d-16295fd1c643"
    }