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...
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 WebSocket server that uses the JSON-RPC protocol.
Communicate with the Cortex API using the WebSocket Secure 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 online client.
Please note that Cortex only supports the WebSocket Secure (wss) protocol. It doesn't support the plain WebSocket (ws) protocol without encryption.
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"}
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 this
or if you use python, you can configure the application like this.
Here is the link to the Emotiv Root CA file.
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 cortexaccess tool.
Connect using the IP address:
Only applied if the IP address of your Raspberry Pi device is in the below range:
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.
Please note that websocket server on Raspberry Pi accepts only 1 remote connection at a time (not counting the remote connection from EMOTIVApp).
After you have successfully opened the WebSocket connection, communicate with Cortex using the JSON-RPC 2.0 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 JSON-RPC 2.0 specification for details.
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 overview of the API flow.
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
object
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
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
number or string
The id you included in the request
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.
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 Launcher. 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.
This method is to connect or disconnect a headset. It can also refresh the list of available Bluetooth headsets returned by queryHeadsets.
Please note that connecting and disconnecting a headset can take a few seconds.
Before you call createSession on a headset, make sure that Cortex is connected to this headset. You can use queryHeadsets to check the connection status of the headset.
This method is not available on iOS. On iOS the user must connect and disconnect the headset in EMOTIV App.
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.
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".
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.
The result is an object containing these fields:
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.
Use the refresh command to start searching for new Bluetooth headsets.
Then you will receive a warning with code 142 when scanning is finished.
Then you will receive a warning with code 104 if the connection is successful:
Shows details of any headsets connected to the device via USB dongle, USB cable, or Bluetooth. You can query a specific headset by its id, or you can specify a wildcard for partial matching.
For the parameter id, you can use these wildcards:
The result is an array of headset objects, or an empty array if no headset matches the request.
If no headset matches your request, then the result is an empty array.
Request user approval for the current application through EMOTIV Launcher.
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.
Any application that connects to Cortex must call this API to request approval from the user through EMOTIV Launcher.
Most of the methods of the API will fail if the user didn't approve your application.
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.
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.
Support for the previous generation EMOTIV SDK Community Edition version 3.5, and EMOTIV Cortex v1.x, has reached the end of life on 31st December 2020.
Developers should migrate their applications to work with our new Emotiv Cortex V2, which is described in this document and can be downloaded from our website.
Learn more about the system requirements and support platforms for Cortex.
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 store.
Currently, it is not possible to use a MN8 headset with Cortex on Linux Ubuntu.
As with other EMOTIV services, you are required to have an EmotivID account. You can create an ID on www.emotiv.com.
With a valid EmotivID, you have access to the basic data streams, including:
Motion Data
Mental Commands
Facial Expressions
Performance Metrics (low-resolution, 0.1Hz)
Frequency Bands
Contact Quality
Battery Level
A paid subscription will be required for data streams such as:
EEG Data
Performance Metrics (high-resolution, 2Hz)
A Developer API license is required to access the Raw EEG API and the High-resolution Performance metrics API. Please complete the SDK application form, and our customer support team will respond as soon as possible with assistance and licensing options.
Visit https://www.emotiv.com/developer/ for more details. If you have questions about the licensing plans please contact the EMOTIV Customer Support.
Create the application ID and generate the corresponding client ID and client secret for your application in order to grant access to Cortex API.
Login to www.emotiv.com.
Go to My Account Dashboard (https://www.emotiv.com/my-account/).
Select Cortex Apps.
Read the Developers EULA carefully and click Accept only if you agree to all the terms and conditions. You cannot develop an application that works with Cortex if you do not agree to all of the terms.
Enter the name of your new application - an application ID will be generated automatically in the form of com.{your-username}.{application-name}
. Note that the app ID string must contain only alphanumeric characters (A-Z, a-z, 0-9), hyphens (-), and periods (.).
(If you have purchased a subscription to the EEG Data API) Decide whether your application requires access to the EEG Data stream. If so, understand that your application will only be available to you until you contact EMOTIV for a deployment license. If your application does not require EEG data then you are entitled to share it with up to 10,000 users before contacting EMOTIV for a deployment license.
(If you have purchased a subscription to the EEG Data API and decided that your application would require access to the EEG Data stream), tick "My App requires EEG access". If you forget this, your application cannot subscribe to EEG stream data later.
Click Register Application. A client ID and a client secret will be presented to you. Copy them to somewhere safe immediately as the client secret will ONLY BE SHOWN ONCE ON THIS SCREEN FOR SECURITY. If you lost it, you will have to generate a new application ID later.
(If you have purchased a subscription to the EEG Data API and decided that your application would require access to the EEG Data stream), make sure you submit this form https://account.emotiv.com/cortex-sdk-application-form/ with necessary information. If you don't submit this form, your applications don't have permission to use the license later.
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 https://github.com/Emotiv/cortex-v2-example
If you have difficulty with the Cortex API, you can also open an issue on this Github repository.
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 release notes for details.
If you are new to the Cortex API, then please start with Connecting to the Cortex API.
Get the current logged in user.
There is no login or logout API in Cortex. Instead, users are required to login through the EMOTIV Launcher.
This method has no parameter.
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.
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.
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 queryHeadsets.
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.
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.
The setting parameter must be an object with these fields:
A motion rate of zero means that the motion sensors are disabled.
The result is an object containing these fields:
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.
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.
Some methods of the API return one or more headset objects, for example queryHeadsets. A session object also includes a headset object.
A headset object include these fields:
When you want to work with a headset, it is important to check its status.
The settings object include these fields:
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".
A motion rate of zero means that the motion sensors are disabled.
Currently, the flexMappings object contains a single field. It may include more fields in the future.
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 start a record 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
The result is an object containing these fields:
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 inject markers 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.
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.
Cortex sets the timestamps of each EEG sample using the monotonic clock 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 NTP 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.
This method takes 3 parameters:
Name | Type | Required | Description |
---|---|---|---|
The result is a JSON object with these fields:
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.
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.
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 , 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.
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.
Before you call this method, the user must approve your application in . See for details.
The Cortex token must remain secret. Do NOT share it. It is your responsibility to keep it secure.
The result is an object containing a field cortexToken. It may also include a field warning, if the user didn't accept the EULA.
Check if your application has been granted access rights or not in .
Any application that connects to Cortex must request approval from the user through . See for details.
The result is an object containing a boolean value "accessGranted" and a message.
If accessGranted is false, then your application should call If accessGranted is true, then no action is required
Name | Type | Description |
---|---|---|
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 queryHeadsets.
If the command is "refresh", then you should omit this parameter.
mappings
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
Name
Type
Description
command
string
The command that you set in the request
message
string
A success message
Name
Type
Required
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
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
Model
Firmware
Connection
EPOC
All
USB dongle
All
USB dongle, BLE 4.0
All
USB dongle, BLE 4.0
Bluetooth® 5.0 will be available with upcoming software and firmware updates
All
USB dongle, BLE 4.0
Insight
All
USB dongle, BLE 4.0
All
BLE 4.0
All
BLE 4.0
Flex
All
nRF dongle with BLE 5
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
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
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"
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
headset
string
yes
A headset id returned by queryHeadsets.
setting
object
yes
An object containing the setting to apply. See below.
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
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.
Name
Type
Description
headsetId
string
The headset id you set in the parameters.
message
string
A success message.
Name
Type
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 updateHeadsetCustomInfo 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 App.
This field was added in Cortex 2.4
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 controlDevice 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 createSession and start working with this headset.
You can call controlDevice to disconnect the headset.
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
number
The motion data sample rate, in hertz.
memsRes
number
The motion data resolution, in bits.
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" }
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
headsetId
string
yes
A headset id returned by queryHeadsets.
headbandPosition
string
yes
Must be "back" or "top".
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".
headset
string
yes
The headset id.
Use queryHeadset 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
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.
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.
Name | Type | Required | Description |
clientId |
| yes | The client id of your Cortex application |
clientSecret |
| yes | The client secret of your Cortex application |
Name | Type | Description |
accessGranted |
| True, if the user has already approved your application False, if the user declined your application, or didn't approve it yet |
message |
|
Name | Type | Required | Description |
clientId |
| yes | The client id of your Cortex application. |
clientSecret |
| yes | The client secret of your Cortex application. |
license |
| 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 |
| no |
Name | Type | Description |
cortexToken |
| The Cortex token of the user |
warning |
| Contains a message and the URL to accept the EULA |
Name | Type | Required | Description |
cortexToken |
| yes |
clientId |
| yes | The client id of your Cortex application |
clientSecret |
| yes | The client secret of your Cortex application |
Name | Type | Description |
cortexToken |
| The new Cortex token of the user |
Name | Type | Required | Description |
cortexToken |
| yes |
Name | Type | Description |
username |
| The EmotivID of the user |
firstName |
| The first name of the user |
lastName |
| The last name of the user |
licenseAgreement |
| An object that contain information about the EULA agreement |
Name | Type | Required | Description |
cortexToken |
| yes |
Name | Type | Description |
license |
| An object containing all the information about the current license |
isOnline |
| 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 |
This method returns the list of the sessions created by the current application. You can create a session with .
New in 2.0: Sessions are now temporary in-memory objects. So this methods only returns the current sessions, not your past sessions. See for details.
The result is an array of .
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 to connect the headset. You cannot open a session with a headset connected by a USB cable. You can use to check the status and connection type of the headset.
You can use to activate or close a session.
See for details.
Make sure the headset has the status "connected" before you call this method. Use to check the status of the headset.
If the status is "open", then the session won't be activated. You can activate the session later by calling .
The result is a representing the created session.
Open a session.
Open a session and activate it.
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 .
A session object includes these fields:
The status is linked to the license. If the session is activated, it will be debited from the quota of the user's license.
A session with an Epoc+ headset. It is not activated. We subscribed to the performance metrics and motion data.
After you opened a with a headset, you can to one or more data streams.
Each data steam 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 .
A subscription is linked to a . All the subscriptions of a session are automatically cancelled when the session is closed. You can call to cancel a subscription.
The available data streams depend on the of the user, and the model and of the headset. For an EPOC Flex, it also depends on the EEG sensor mapping.
Each data stream is identified by its name: "eeg", "mot", "dev", "eq", "pow", "met", "com", "fac", "sys".
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.
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.
This feature was added in Cortex 2.7.1
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 of the headset
create a and add
use
Your application can open only one session at a time with a given headset. But it can open multiple sessions with multiple headsets.
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.
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.
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.
A token returned by
A token returned by
A token returned by
Depending on the license and the model of the headset, some streams may be available or not, and may send at a different rate.
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 for the complete EPOC X configuration.
You must configure the EEG sensor mapping of your EPOC Flex when you call the method .
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.
First, you must open a session with a headset. Then you call createRecord to start a new record. When the record is in progress, you can add markers to this record. You stop a record with updateRecord.
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 exportRecord.
Name | Type | Required | Description |
cortexToken |
| yes |
Name | Type | Required | Description |
cortexToken |
| yes |
status |
| yes | Must be "open" or "active". |
headset |
| no |
Name | Type | Description |
id |
| The id of this session. |
status |
| Can be "opened", "activated", or "closed". |
owner |
| The EmotivID of the user. |
license |
| The id of the license used by this session. Or an empty string if the session wasn't activated. |
appId |
| The application id of your Cortex app. |
started |
| When this session was created. |
stopped |
| When this session was closed. |
streams |
|
recordIds |
|
recording |
| True if a record is currently in progress for this session. False otherwise. |
headset |
|
Status | Description |
opened |
activated |
closed | This session is closed, you cannot use it anymore. |
Name | Type | Required | Description |
cortexToken |
| yes |
session |
| yes |
status |
| yes | Must be "active" or "close". |
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. |
pow | The band power of each EEG sensor. It includes the alpha, low beta, high beta, gamma, and theta bands. |
met | The results of the performance metrics detection. |
com |
fac | The results of the facial expressions detection. |
sys |
Stream | Supported headsets | Sample rate in hertz |
eeg | All, but requires a license | 128 or 256, depends on the headset and its settings. |
mot | All | Disabled, 32, 64, 128, depends on the headset and its settings. 6.4 hertz for MN8. |
dev | All | 2 |
eq | All | 2 |
pow | All | 8 |
met | All EPOC Flex requires a special EEG sensor mapping |
com | All EPOC Flex requires a special EEG sensor mapping | 8 |
fac | All but MN8 EPOC Flex requires a special EEG sensor mapping | 32 |
sys | All |
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.
A record is linked to a session. So to close a record, you need to provide the session id.
The result is an object containing these fields:
After you successfully subscribe to a data stream, Cortex will keep sending you data sample objects. See Data Subscription for details.
A data sample object contains these fields:
To interpret the values in the <stream> array, you must check the field cols from the result of the subscribe method.
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.
The stream "eeg" uses these labels:
The maker objects include these fields:
Example for an INSIGHT:
Example for an EPOC+ or EPOC X:
The stream "mot" uses these labels:
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:
The stream "dev" uses these labels:
Example with INSIGHT:
Example with EPOC+ or EPOC X:
Please read this page to understand the difference between the contact quality and the EEG quality.
The stream "eq" uses these labels:
This stream was added in Cortex 2.7.0
Example with INSIGHT:
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:
The stream "met" uses these labels:
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 stream "com" uses these labels:
The stream "fac" uses these labels:
Use the method getDetectionInfo to get the possible actions.
The stream "sys" is used for the training of the mental command and facial expression. It uses these labels:
For example, just after you start a training for the mental command detection, you receive a system event like this:
This method is to create a new record.
You must create and activate a session before you call this method. See createSession for details.
The result is an object containing two fields:
This method is to cancel a subscription that was previously created by the subscribe method.
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.
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:
Unsubscribe successfully from the performance metrics and motion streams.
This method is to subscribe to one or more data streams. You can call unsubscribe to cancel a subscription. After you successfully subscribe to a stream, Cortex will keep sending you data sample objects.
See Data Subscription for details.
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.
To subscribe to the "eeg" stream, you must have a paid license and activate the session.
The result is an object that includes these fields:
In case of success, you get an object with these fields:
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:
Subscribe successfully to motion and performance metrics.
Subscribe successfully to performance metrics, but fail to subscribe to raw EEG.
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.
The result is a record object.
Update the tags and the description.
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 Record object to know if this record will stay on the local machine, or if it will be uploaded to the EMOTIV cloud.
Some licenses 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
The result is an object describing the current opt-out configuration. It includes these fields:
Here is an overview of the possible configurations:
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 PRO or EMOTIV LABS) then you must provide the license id of this application in the parameter licenseIds.
In order to export a record created by EMOTIV LABS, the current Cortex user must be the owner of the LABS experiment.
You must stop the record before you can export it. If you want to export a record immediately after you stop it then you must wait for the warning 30 before you try to export.
The format of the exported files is described in EmotivPRO user manual.
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
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.
Depending on the parameters format and version Cortex will create different files.
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
1 CSV file for the markers if the parameter includeMarkerExtraInfos is true
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
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
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
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
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:
This method is to ask Cortex to download the EEG/motion/CQ/detections data of a record from the EMOTIV cloud.
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 .
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 this record. To download the actual data, you must call the method "requestToDownloadRecordData".
Name | Type | Required | Description |
---|
The result is an object with 2 fields:
Name | Type | Description |
---|
Each object in the success array include these fields:
Name | Type | Description |
---|
Each object in the failure array include these fields:
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.
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.
The query object can contain one or more of these fields:
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
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.
The result is an object that includes these fields:
Get the 10 most recent records created by EmotivPRO.
Get some records using a keyword.
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.
Deleting a record is irreversible. There is no way to recover a deleted record.
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:
Deleting two records, including one that has an invalid id.
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.
An interval marker is to mark a period of time, with a beginning and an end. First you create an instance marker with . This sets the beginning of the interval. Then you call to set the end of the interval, turning the instance marker into an interval marker.
A token returned by .
A token returned by .
A headset id returned by . If you omit this parameter, then Cortex will use the first connected headset.
The data streams you subscribed to. See .
The ids of all the records created by this session. See .
A . It contains information about the headset linked to this session.
The session was created with , but it doesn't use a license. You can activate or close this session with .
The session was activated with a license. You can close this session with .
The token returned by .
A session id returned by .
Please read this to understand the difference between the contact quality and the EEG quality.
The results of the mental commands detection. You must to get meaningful results.
The system events. These events are related to the training of the mental commands and facial expressions. See for details.
The must contain the scope "eeg". You must activate the before you subscribe.
Please check the of your headset.
Please check the of your headset.
2 if the license contains the scope "pm" and you activate the before you subscribe. 0.1 otherwise (1 sample every 10 seconds)
No fixed rate, see for details.
Name | Type | Description |
---|
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
session
string
yes
The session id you provided when you called createRecord.
Name
Type
Description
record
object
sessionId
string
The session id linked to the record.
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
string
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.
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
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
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
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.
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
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)
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
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
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>
number
The EEG quality of each EEG sensor, from 0 to 4.
Label
Type
Description
eng
number
Engagement
exc
number
Excitement
lex
number
Long term excitement. It is calculated from the excitement values of the last minute.
str
number
Stress / Frustration
rel
number
Relaxation
int
number
Interest / Affinity
foc
number
Focus
eng.isActive
boolean
Active flag for engagement.
exc.isActive
boolean
Active flag for excitement.
str.isActive
boolean
Active flag for stress / frustration.
rel.isActive
boolean
Active flag for relaxation.
int.isActive
boolean
Active flag for interest / affinity.
foc.isActive
boolean
Active flag for focus.
Label
Type
Description
act
string
A mental command action. Use the method getDetectionInfo 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".
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
string
The lower face action.
lPow
number
Power of the lower face action. Zero means "low power", 1 means "high power".
Label
Type
Description
event
string
The name of the detection. Can be "mentalCommand" or "facialExpression"
msg
string
Depends on the detection. Use the method getDetectionInfo to get the possible values, check the field events in the result.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
session
string
yes
A session id returned by createSession.
title
string
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 createSubject. The subject is the person wearing the headset during the record. If you omit this field, then Cortex assumes that the current user is using the headset.
tags
array of strings
no
A list of tags you can associate to this record. You can use queryRecords 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
Description
record
object
A record object that represents the created record.
sessionId
string
The id of the session this record is linked to.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
session
string
yes
A session id returned by createSession.
streams
array of strings
yes
The data streams you want to unsubscribe to.
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.
Name
Type
Description
streamName
string
The name of the stream.
Name
Type
Description
streamName
string
The name of the stream.
code
number
The error code.
message
string
The error message.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
session
string
yes
A session id returned by createSession.
streams
array of strings
yes
The data streams you want to subscribe to.
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.
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.
Name
Type
Description
streamName
string
The name of the stream.
code
number
The error code.
message
string
The error message.
Name
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.
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
boolean
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.
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
string
A text 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
false
Always false
The records will always be uploaded to the cloud. You cannot change the configuration.
false
true
Always false
The records will always be uploaded to the cloud. You cannot change the configuration.
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
string
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 EMOTIV LABS.
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 EMOTIV LABS.
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 EEGLAB.
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
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.
BP
Export the band powers of each EEG sensor.
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.
recordId |
| The id of a record that Cortex cannot download. |
code |
| The error code for this record. |
message |
| The error message for this record. |
Name | Type | Description |
recordId |
| The id of the record that couldn't be deleted. |
code |
| The error code. |
message |
| The error message. |
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.
cortexToken |
| yes |
recordIds |
| yes | A list of record ids. |
success |
| List of the records that Cortex will start to download. |
failure |
| List of the records that Cortex will not download. |
recordId |
| The id of a record that was added to the Cortex download queue. Cortex will now start the download. |
Name | Type | Description |
uuid |
| The id of this record. |
ownerId |
| The id of the user this record belongs to. It is a GUID, it is not the EmotivID of the user. |
applicationId |
| The id of the application that created this record. |
applicationVersion |
| The version of the application that created this record. |
title |
| The title of this record. |
description |
| The description of this record. |
tags |
| The tags associated to this record. |
experimentId |
| The experiment id associated to this record. |
startDatetime |
| When this record was created. |
endDatetime |
| When this record was stopped. |
licenseId |
| The id of the license used by this record. |
licenseScope |
| 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 |
|
localOnly |
| If true then this record will not be uploaded to the EMOTIV cloud. If false then it will be uploaded. |
headbandPosition |
| This field was added in Cortex 2.4 |
Name | Type | Description |
markers |
|
Name | Type | Required | Description |
cortexToken |
| yes |
recordIds |
| yes | A list of records id. |
Name | Type | Required | Description |
cortexToken |
| yes |
query |
| yes | An object to filter the records. |
orderBy |
| yes | Specify how to sort the records. |
limit |
| no | The maximum number of records that this method should return. A limit of zero means no maximum. |
offset |
| 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 |
| no | This parameter was added in Cortex 2.1 |
includeSyncStatusInfo |
| no | If The default value is This parameter was added in Cortex 2.6.3 |
Name | Type | Description |
licenseId |
| Set this parameter to filter the records by their license. |
applicationId |
| If you set the licenseId, then you can set this parameter to further filter the records by application. |
keyword |
| Set this parameter to filter the records by title, description, or subject name. |
startDatetime |
| An object with fields "from" and "to" to filter the records by their start date time. |
modifiedDatetime |
| An object with fields "from" and "to" to filter the records by their modification date time. |
duration |
| An object with fields "from" and "to" to filter the records by their duration. |
Name | Type | Description |
records |
|
count |
| The total number of records that match the query. |
limit |
| The limit you specified in the parameters. |
offset |
| The offset you specified in the parameters. |
Name | Type | Required | Description |
cortexToken |
| yes |
records |
| yes | An array of record ids. |
Name | Type | Description |
success |
| For each record you successfully deleted, this array contains an object that includes the record id. |
failure |
| For each record that couldn't be deleted, this array contains an object that describes the error. |
Name | Type | Description |
recordId |
| The id of the record that was successfully deleted. |
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.
The result is an object containing these fields:
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.
You must call createRecord before you call this method.
The result is an object containing these fields:
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
The result is a subject object representing the new subject.
Create a subject with only his name.
Create a subject with more information.
This method is to update an existing subject.
This method was added in Cortex 2.1
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.
The result is a subject object representing the updated subject.
Update the date of birth of a subject.
This method is to delete one or more subjects.
Deleting a subject is irreversible. There is no way to recover a deleted subject.
This method was added in Cortex 2.1
A subject is identified by his/her name, so you must provide the name of the subjects you want to delete.
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:
.
A subject represents a human being who is the subject of a (ie an experiment).
A subject object includes these fields:
The field attributes is a list of attributes. A demographic attribute is an object with 2 fields:
For example, to tell that the subject is right handed, you can add the attribute { "name":"Handedness", "value":"Right"}
This method returns a list of subjects owned by the current user.
This method was added in Cortex 2.1
Depending on the query, this method may return a lot of subjects. To avoid performance issues, you should always set an offset and a limit.
The query object can contain one or more of these fields:
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 subject'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 subjects by their names, in alphabetical order, you must use the object {"subjectName":"ASC"}
.
You can order the subjects by these fields: subjectName, dateOfBirth.
These parameters are to implement pagination. It useful if you want to display the subjects in a UI. You must order the results to use these parameters.
First you should call this method with a 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 subjects for your query.
The result is an object that includes these fields:
Find the 10 first female subjects born in 1979 or 1980.
You can use the Cortex API to develop a brain–computer interface (BCI), using facial expressions, mental commands, or both.
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 .
To use the BCI features with an EPOC Flex headset, you must use a special EEG mapping. Please see for details.
To get the results of the facial expression detection and the mental command detection, you must to the data streams "fac" and "com" respectively.
To use the mental command detection, you must a training profile that contains training data for at least one action. For the facial expression detection, the training is optional.
A profile is a persistent object that stores training data for the facial expression and mental command detections. A profile belongs to a user and is synchronized to the EMOTIV cloud.
You can use to list the profiles of the current user. Use to manage the profiles, and also to load or unload a profile for a headset. You can use to add training data to a profile.
Before v3.6.5, a profile can be loaded for both Epoc/Flex and Insight. Since v3.6.5, a profile can only be loaded for Epoc/Flex or Insight since their EEG channels are different. If you upgrade from version before 3.6.5, the existing profiles will become readonly. See
The training works that same for the mental command detection and the facial expression detection. However, they don't use the same actions, events or controls. So you should call to know what actions, controls and events you can use for each detection.
Before you start a training, you must to the data stream "sys" to receive the training events from Cortex. Then you can follow these steps:
Start the training by calling with the action you want to train and the control "start".
On the "sys" stream, you receive the event "started".
After a few seconds, you receive one of these two events:
Event "succeeded", the training is a success. Now you must accept it or reject it.
Event "failed", the data collected during the training is of poor quality, you must start over from the beginning.
Call with the control "accept" to add the training to the profile. Or you can use the control "reject" to reject this training, and then you must start over from the beginning.
Cortex sends the event "completed" to confirm that the training was successfully completed.
You should to persist this training. If you unload the profile without saving, then the training is lost.
After step 2, but before step 3, you can send the control "reset" to cancel the training.
The following chart illustrates the flow of BCI training with corresponding request for each step:
The following chart illustrates the streaming of Mental Commands data in live:
A token returned by .
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.
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.
A list of . The markers added to this record.
A token returned by .
A token returned by .
If true
then the 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.
An array of .
A token returned by .
You must call to know what are the valid attribute names, and what are the possible values for each attribute.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
session
string
yes
A session id returned by createSession.
markerId
string
yes
The id of the marker you want to update. This marker must belong to the current record of the session.
time
number
yes
The end timestamp of the marker. It is the number of milliseconds that have elapsed since 00:00:00 Thursday, 1 January 1970 UTC.
extras
object
no
Any extra information you want to associate with the marker.
Name
Type
Description
recordId
string
The id of the record this marker belongs to.
sessionId
string
The id of the session associated to the record.
marker
object
A marker object that represents the marker that was updated.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
session
string
yes
A session id returned by createSession.
The marker will be added to the current record of this session.
time
number
yes
The start timestamp of the marker. It is the number of milliseconds that have elapsed since 00:00:00 Thursday, 1 January 1970 UTC.
value
string or number
yes
The value of the marker. It can be a string or an integer.
If it is an integer then it must be positive or zero.
label
string
yes
The label of the marker.
port
string
no
The port of the marker, or where the marker comes from. Examples: "USB", "Serial", etc... The default value is "Software"
extras
object
no
Any extra information you want to associate with the marker.
Name
Type
Description
recordId
string
The id of the record this marker was added to.
sessionId
string
The id of the session associated to the record.
marker
object
A marker object that represents the marker that was created.
Name
Type
Description
uuid
string
The id of the marker.
type
string
Can be "interval" or "instance".
value
string or number
The value you set in injectMarker.
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 injectMarker.
endDatetime
string (ISO date time)
The timestamp you set in updateMarker.
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.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
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 Alpha-2 ISO code 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.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
subjectName
string
yes
The name of the subject.
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 Alpha-2 ISO code 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.
Name | Type | Description |
subjectName |
| The name of the subject. |
code |
| The error code. |
message |
| The error message. |
If you upgrade from EmotivBCI before v3.6.5, you should notice that we change the format of training profiles so that the existing training profile (i.e. created before v3.6.5) will not be fully supported. We call them readonly profiles which can only run at a live mode and cannot run on training mode.
These readonly training profiles only support headsets with 14 EEG channels (i.e. EPOC X and Flex with EPOC X config mapping).
Name | Type | Required | Description |
cortexToken |
| yes |
uuid |
| The unique ID of this profile. |
name |
| The name of the profile. |
readOnly |
|
eegChannels |
| The list of EEG channels of a headset with which this profile can be loaded.
For example, if |
Name | Type | Required | Description |
cortexToken |
| yes |
subjects |
| yes | A list a subject names. |
Name | Type | Description |
success |
| For each subject you successfully deleted, this array contains an object with the name of deleted subject. |
failure |
| For each subject you failed to delete, this array contains an object that describes the error. |
Name | Type | Description |
subjectName |
| The name of the deleted subject. |
Name | Type | Required | Description |
cortexToken |
| yes |
Name | Type | Description |
name |
| The name of the demographic attribute. |
value |
| The list of all the possible values for this attribute. |
Name | Type | Description |
subjectName |
| The name of the subject. |
dateOfBirth |
| The date of birth of the subject. The format is "YYYY-MM-DD", e.g. "1980-12-25". |
sex |
| Can be "M", "F" or "U". These letters stands for male, female and unknown respectively. |
experimentsCount |
|
countryCode |
|
countryName |
| The name of the country the subject lives in. |
state |
| The state the subject lives in. |
city |
| The city the subject lives in. |
attributes |
| A list of demographic attribute objects. See below. |
Name | Type | Required | Description |
name |
| yes | The name of the attribute. |
value |
| yes | The value of the attribute. |
Name | Type | Required | Description |
cortexToken |
| yes |
query |
| yes | An object to filter the subjects. |
orderBy |
| yes | Specify how to sort the subjects. |
limit |
| no | The maximum number of subjects that this method should return. A limit of zero means no maximum. |
offset |
| no | The number of subjects that this method should skip before returning the result. If the limit is zero, then Cortex will ignore this parameter. |
Name | Type | Description |
uuid |
| Set this parameter to get a subject by its id. |
subjectName |
| Set this parameter to filter the subjects by name. |
sex |
| Set this parameter to filter the subjects by their gender. Must be "M", "F" or "U". |
countryCode |
| Set this parameters to filter the subjects by their country. |
dateOfBirth |
| An object with fields "from" and "to" to filter the subjects by their date of birth. |
keyword |
| An object with the fields as the keyword to search and values are the list of fields to search. The list of fields to search can contains "subjectName", "lastName", "email" |
Name | Type | Description |
subjects |
|
count |
| The total number of subjects that match the query. |
limit |
| The limit you specified in the parameters. |
offset |
| The offset you specified in the parameters. |
There are a few steps to prepare before you can get the data streaming out from Cortex:
First you have to login to the EMOTIV Launcher with your EmotivID.
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).
Call the requestAccess API from your app to Cortex, and accept via the EMOTIV Launcher.
After access is granted, connect your EMOTIV brainwear headset via the USB dongle or Bluetooth.
Call the controlDevice API with "refresh" command to start the headset scanning.
Call the queryHeadsets API to list the available headsets.
Call the controlDevice API with "connect" command to connect to the desire headset.
Call the authorize API to get a Cortex token for subsequence requests.
Call the createSession API to open up a new session and be ready for BCI data streaming.
This method is to control the training of the mental command and facial expression detections. Before you start a training, you should subscribe to the "sys" data stream.
See BCI for details.
To get the available status for a detection, call getDetectionInfo, and check the field controls of the result object. Or you can check this list:
To get the available actions for a detection, call getDetectionInfo, and check the field actions of the result object.
However, note that for the facial expression detection, only these actions can be trained: "neutral", "surprise", "frown", "smile", "clench".
The result is an object containing these fields:
Start a mental command training for the action "push".
Accept a successful training for the action "push".
This method loads an empty profile for a headset. You can use this method to quickly load a profile, without having to create a profile with setupProfile.
The result is an object containing these fields:
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 training, or after you changed the attributes of the profile.
Before you load or unload a profile, you can call getCurrentProfile to know if a profile is currently loaded, and if it was loaded by your application.
Depending on the status, this method has different effects, and uses different parameters.
Create a new profile. It can be an empty profile, or a copy of a loaded profile.
Load an existing profile for a specific headset. If a profile is already loaded, then you must unload it first.
Unload the profile of a specific headset. After the unload, this headset will use a default empty profile. You should set the parameter profile to an empty string. You cannot unload a profile that was loaded by another application.
Save the profile used by a headset. You can save it with a new name, so it creates a new profile. Or you can save it with the same name, ie the name you used to load it. You cannot save a profile that was loaded by another application.
Rename an existing profile.
Delete an existing profile. If this profile is loaded for a headset, then it is automatically unloaded. You cannot delete a profile that is currently loaded by another application.
The result is an object containing these fields:
This method returns the duration of a training. It is the approximate time needed by Cortex to decide if a training is a success or a failure. See for details.
The result is an object containing these fields:
The time should be 8 seconds, for both mental command and facial expression.
This method can get or set the threshold of a facial expression action for a specific profile.
Actions with a low threshold are less likely to be detected. Actions with a high threshold will be detected more often.
You must set one of these 2 parameters: profile or session. for details.
If the status is "get", then the result is a number
that is the current threshold of the action.
If the status is "set", then the result is a string
that is a success message.
This method returns the list of the trained actions of a profile. For each action, you also see how many times the user trained this action.
You must set one of these 2 parameters: profile or session. for details.
If you set the session, then this method reads information from the profile that is currently loaded for the headset of this session.
If you set profile then this method reads information from the hard drive. The values you get can be different from reading from the session, especially if the profile was load, edited, and not saved yet.
The result is an object containing these fields:
The objects in trainedActions have 2 fields:
In this section, you will find some advanced BCI features. Please read the section first.
The methods in this section are to read and modify the attributes of a training profile. Changing these attributes affects the way the facial expression and mental command detections work. It can make an action easier to detect, or it can completely disable an action.
You can use to change the attributes of a profile and see how it affects the detections.
Most of the methods takes 2 optional parameters, a profile name and a session id.
You must set one of these 2 parameters, and omit the second parameter.
If you set the profile, then Cortex will read the attributes of a profile from the hard drive. You can only read the attributes, you cannot change them. The profile is read only.
If you set the session, then Cortex will read the attributes of a profile currently loaded in-memory. You can also change these attributes. The profile is in read-write mode. After you edited the attributes, you should to persist your changes.
If Cortex tells you that profile is a required parameter, then please set this parameter to an empty string.
There is a bug in Cortex 2.0.0. The parameter profile is required, even if you set the parameter session. So, to read/write attributes from a session, you should set the session to your session id and set profile to an empty string. Don't set it to null, don't omit it. This bug is fixed in Cortex version 2.1.0 and above.
This method is to get or set the active actions for the mental command detection.
If an action is inactive, then the mental command detection won't detect it anymore. Deactivate an action do not erase its trainings from the profile.
Check out and in our BCI app.
You must set one of these 2 parameters: profile or session. for details.
If the status is "get", then the result is an array of strings
that is the list of active actions.
If the status is "set", then the result is an object with these fields:
This method can get or set the signature used by the facial expression detection.
The "universal" signature contains some generic parameters. It doesn't need (nor accept) any training. It is the default signature. Cortex uses it automatically when the profile doesn't contain any training.
The "trained" signature uses the from the user. The profile must contain at least one training before you can switch to this signature.
You must set one of these 2 parameters: profile or session. for details.
The result is an object containing these fields:
A token returned by .
If a headset is created before v3.6.5, the profile will become read-only when upgrading to v3.6.5. See . This field is available since v3.6.5.
A token returned by .
A token returned by .
The of the country the subject lives in.
A token returned by .
An array of .
Name
Type
Required
Description
detection
string
yes
Must be "mentalCommand" or "facialExpression".
Name
Type
Description
actions
array of strings
The actions that this detection can detect.
controls
array of strings
The list of the status you can use when you call the training method.
events
array of strings
The events you can receive in the "sys" data stream when you train this detection.
signature
array of strings
The different types of signature that you can get or set with facialExpressionSignatureType.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
headset
string
yes
A headset id returned by queryHeadsets.
Name
Type
Description
name
string
The name of the loaded profile, or null
if no profile was loaded for this headset.
loadedByThisApp
boolean
true
if the profile was loaded by your application, false
if it was loaded by another application.
This field was added in Cortex 2.1
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
session
string
yes
A session id returned by createSession. The training will be for the headset linked to this session.
detection
string
yes
Must be "mentalCommand" or "facialExpression".
status
string
yes
Control what this method does, like start the training, or cancel it... Available status depends on which detection you selected.
action
string
yes
The action you want to train. Available actions depends on which detection you selected.
Status
Description
start
Start a new training for the specified action.
accept
Accept a successful training and add it to the profile.
reject
Reject a successful training. It is not added to the profile.
reset
Cancel the current training.
erase
Erase all the training data for the specified action.
Name
Type
Description
action
string
The action you set in the request.
status
string
The status you set in the request.
message
string
A success message.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
headset
string
yes
A headset id returned by queryHeadsets.
Name
Type
Description
action
string
Is always "load".
name
string
Is always "Guest Profile".
message
string
A success message.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
status
string
yes
Must be "create", "load", "unload", "save", "rename" or "delete".
profile
string
yes
The name of the profile.
headset
string
yes or no, depending on "status"
A headset id returned by queryHeadsets.
newProfileName
string
no
If the status is "rename", then you must set this parameter, and it is the new name of the profile.
Name
Type
Required
Description
profile
string
yes
The name of the new profile. It must be unique for the user. Use queryProfile to check if a name is already in use.
headset
string
yes
If omitted, create an empty profile.
If set, create a copy of the profile currently loaded for this headset.
Name
Type
Required
Description
profile
string
yes
The name of the profile to load.
headset
string
yes
The id of the headset to load the profile to.
Name
Type
Required
Description
headset
string
yes
The id of the headset to unload the profile.
profile
string
yes
Cortex will ignore this parameter. Should be an empty string.
Name
Type
Required
Description
headset
string
yes
The profile used by this headset will be saved.
profile
string
yes
The name of the profile.
If no profile with that name exists, then the method creates a new profile.
If it is the name of the profile that was previously loaded to this headset, then the method saves to this profile.
Name
Type
Required
Description
profile
string
yes
The name of the profile you want to rename.
newProfileName
string
yes
The new name of the profile.
Name
Type
Required
Description
profile
string
yes
The name of the profile you want to delete.
Name
Type
Description
action
string
The status you used in the request.
name
string
The profile you used in the request.
message
string
A success message.
Here is a list of the error codes that the Cortex API can return. This list is not exhaustive (yet) and will be updated in the future.
The message you sent to Cortex is not a valid JSON object. This is a bug is your application.
The message you sent to Cortex is a valid JSON object but it doesn't contain the expected fields. This a bug is your application. Please check Connecting to the Cortex API
You sent a request with an invalid method name. This a bug is your application. Please check this documentation to see which methods are available.
You sent a request to call a valid method, but the parameters are wrong. It can be because:
You didn't provide a required parameter
You provided a parameters with an invalid name
The name of parameter is correct but the value is invalid
This is a bug in your application. Please check the documentation of the method.
An unexpected error happened in Cortex while processing your request. This is probably a bug in Cortex. If the problem persists, please contact the EMOTIV customer support.
An unexpected error happened in the EMOTIV cloud while processing your request. It can be a temporary failure of the EMOTIV servers, like when the servers are in maintenance. Or it can be a bug in Cortex. If the problem persists, please contact the EMOTIV customer support.
The EMOTIV cloud cannot find the license of the user. When you call the method authorize, please make sure that you provide a valid license ID, or no license parameter at all. If the problem persists, then the owner of the license must contact the EMOTIV customer support.
Cortex must connect to the EMOTIV cloud to process your request, but the connection failed. Please make sure that you computer has a working internet connection.
You sent a request to perform an action on a specific headset, but Cortex cannot find this headset. Some possible reasons for this error:
You provided an invalid headset ID in your request
The headset was disconnected (maybe it is out of range of your computer)
The headset was switched off
You called the method createSession for a specific headset, but your application already has a session for this headset. This is a bug in your application. You cannot create 2 sessions for the same headset at the same time. You must close the existing session before creating a new one.
You called createSession or updateSession with the parameter "status" set to "active", but your license doesn't authorize you to activate a session. You have a paid EMOTIV license to activate a session. If you already have such a license but the problem still persists, then contact the EMOTIV customer support. You should also read the prerequisite.
You included a session ID in the parameters of your request, but Cortex cannot find this session. It can be because you session ID is invalid or because the session is already closed.
Many methods can return this error: updateSession, subscribe, unsubscribe, createRecord, injectMarker, training, etc...
You called a method that requires an active session, but the current session is inactive. It can happen if you call createRecord on an inactive session.
You included a Cortex token in the parameters of your request, but this token is invalid. This is a bug in your application. When a method requires a Cortex token, please make sure that your token comes from the result of the method authorize.
Your Cortex token has expired. You must call the method authorize again to get a new token. The Cortex token is valid for 48 hours.
You called the methods subscribe or unsubscribe with an invalid stream. The stream can be invalid for one of these reasons:
The name of the stream is incorrect. Check Data Subscription for the list of the available streams.
The stream is not available for this headset. For example, the motion data of an EPOC X headset can be disable.
The stream is "eeg" but the license doesn't allow you to access this stream. You can check the license with getLicenseInfo
You called createRecord for a specific session, but your application already started a record for the same session. You cannot create 2 records for the same session at the same time.
You tried to activate a session (with createSession or updateSession) but the "localQuota" of the license is zero. You can check the "localQuota" by calling the method getLicenseInfo. Every time you activate a session, the local quota of the license is reduced by 1.
To solve this error, you must increase the local quota of the license. Call authorize with the parameter "debit". For example, you can call authorize with a "debit" of 10, and this will increase the local quota by 10. Then you will be able to create and activate 10 sessions on this computer.
You called updateHeadset but the headset is connected to the computer via Bluetooth or a USB dongle. Instead, the user should connect the headset with a USB cable.
Your request includes an invalid client ID or an invalid client secret.
The license was used on too many devices (eg computer, tablet, phone...) The license has a device limit. You can check it by calling the method getLicenseInfo. If you want to increase the limit or transfer the license from 1 device to another, then please contact the EMOTIV customer support.
The license of the user has expired. You can check the license with getLicenseInfo. After the license is renewed, your application must call authorize to get a new token.
You called authorize with a valid license ID but your application doesn't have the permission to use this license.
When the computer is offline, you can use the license for a limited period of time. The end of this period is the "hard limit" of the license. You can check it with getLicenseInfo. After the "hard limit" has been reached, Cortex must connect to the EMOTIV cloud to validate the license again. To solve this problem, the computer must have an internet connection and then you must call authorize.
You sent a request to perform an action on a specific training profile, but Cortex cannot find this profile.
Cortex cannot process your request because no user is logged in. You must ask the user to log in in EMOTIV Launcher.
Your request includes a Cortex token that was created for a specific user, but the current user is a different one. In that case, that must call authorize again and get a new token. You can check the current user with getUserLogin.
You called training for an action that cannot be trained.
You tried to load a training profile for a specific headset, but this profile is already loaded for another headset. You cannot load the same profile on 2 different headset at the same time.
You tried to unload a training profile from a headset, but no profile was loaded for this headset.
You tried to perform an operation (eg setupProfile, training...) on a training profile, but this profile was loaded by another application. An application can only access a profile that loaded by itself. You can call getCurrentProfile to check if your application loaded the profile of a headset or not.
The user didn't approved your application yet. The user must open EMOTIV Launcher and approve your application.
Cortex failed to communicate with the headset. Maybe the wireless connection between the headset and the computer was interrupted. Your application should try again. You can also call queryHeadsets to check the status of the headset.
The EMOTIV ID of the user is inactive. The user must contact the EMOTIV customer support. You can call getUserLogin or getUserInformation to check the current user.
The EMOTIV cloud refused the user credentials provided by Cortex. The user must logout and login again.
There is something wrong with the Cortex token. Your application must call authorize to get a new Cortex token.
Your license cannot work when you are offline. You must be connected to the internet at all time to use this license. You can call getLicenseInfo to check the current license.
You tried to activate a session that is already active. You can call querySessions to check the status of your sessions.
You are trying to access a record that doesn't exist, or the record exist but you don't have the permission to access it.
You are trying to inject a marker or to stop a record but no record is is progress.
You are trying to inject a marker but its time is too far in the past. You should inject your markers in real time, at the moment the event you want to mark happens.
You are trying to inject a marker but its time is too far in the future. You should inject your markers in real time, at the moment the event you want to mark happens.
You called updateMarker with an invalid marker id.
You are trying to create or rename a training profile, but another profile with the same name already exists.
You are trying to update a marker that was already updated before.
The local Cortex database is corrupted. Please contact the EMOTIV customer support.
You are trying to update or delete a subject that doesn't exist. Or you are trying to create a record with an invalid subject.
You are trying to create a subject, but another subject with the same name already exists.
You are trying to load a training profile for a headset, but a profile was already loaded for this headset before. You must unload the current profile before loading a new one.
You are trying to create or update a record, but the record title is invalid. The title must be 200 characters long or less.
You are trying to export a record but Cortex cannot open the output CSV or EDF file.
You are trying to export a record but one of the data streams you requested is not available.
Whitelisting Domains for EMOTIV Applications
If you are encountering issues with EMOTIV Cortex or applications communicating with the EMOTIV Cloud, it may be due to some essential domains being blocked by your firewall, network settings, or security software. To ensure smooth operation, you will need to whitelist the following domains:
*.emotivcloud.com
*.emotiv.com
emotiv-cortex-prod-dropbox.s3.amazonaws.com
emotiv-cortex-prod-dropbox.s3.us-east-1.amazonaws.com
cerebrum-prod.s3.amazonaws.com
cerebrum-prod.s3.us-east-1.amazonaws.com
Firewall Settings:
Open your firewall application or built-in firewall settings.
Locate the section where you can add exceptions or whitelist URLs/domains.
Manually input each of the domains listed above into this section.
Save or apply the changes.
Security Software:
Launch your antivirus or security software.
Navigate to the settings or configuration section.
Search for an option related to whitelisting or exclusions.
Add each of the listed domains as exclusions.
Confirm and save your changes.
Router Settings (if you suspect your router is blocking access):
Access your router's admin panel. (Refer to the router's manual or online documentation for specifics).
Locate the section related to security or URL filtering.
Add each domain to the list of allowed domains or URLs.
Save or apply the changes.
Always ensure that you are only whitelisting domains from trusted sources. The domains listed here are essential for EMOTIV Cortex and applications.
If you use additional network or security tools that might restrict access, ensure you update them to allow the domains listed above.
After whitelisting, restart your EMOTIV application and check if the issue is resolved.
If problems persist, consider reaching out to EMOTIV's support team or refer to other troubleshooting documentation provided by EMOTIV.
This guide aims to simplify the process for you. Depending on the specific software or hardware you are using, some steps might look a bit different. When in doubt, refer to the user manual or help section of your software or device.
This command line tool is available only for Raspberry Pi to manage permissions for remote connections via IP addresses of remote desktop machines.
This tool is installed on Raspberry Pi device along with Cortex installation. It is located at /usr/local/emotivapps/bin/cortexaccess
.
List all IP addresses of remote desktop machines from which applications are allowed to create web socket connections to Cortex on Raspberry Pi device.
Command: cortexaccess ip list
If the IP address of your remote desktop isn't in the list, you should add it using accept
command.
Grant permissions a remote desktop machine (via its IP address) from which applications can create web socket connections to Cortex on Raspberry Pi device.
Command: cortexaccess ip accept <an-ip-address>
Remove permissions of remote desktop machines (via its IP address) so that applications on that machine cannot create web socket connections to Cortex on Raspberry Pi device anymore.
Command: cortexaccess ip deny <an-ip-address>
Remove permissions of current granted remote desktop machines so that applications on these machines cannot create web socket connections to Cortex on Raspberry Pi device anymore.
Command: cortexaccess ip clear
Name | Type | Required | Description |
cortexToken |
| yes |
detection |
| yes | Must be "mentalCommand" or "facialExpression". |
session |
| yes |
Name | Type | Description |
time |
| The approximate duration of a training, in second. |
detection |
| The detection you set in the request. |
Name | Type | Required | Description |
cortexToken |
| yes |
status |
| yes | Must be "get" or "set". |
action |
| yes | You get or set the threshold for this action. |
profile |
| no | A profile name. |
session |
| no |
value |
| no | If the status is "set", this parameter must be a number between 0 and 1000. This will be the new threshold of the action. |
Name | Type | Required | Description |
cortexToken |
| yes |
detection |
| yes | Must be "mentalCommand" or "facialExpression". |
profile |
| no | The name of a profile. |
session |
| no |
Name | Type | Description |
trainedActions |
| Contains 1 object for each trained action. |
totalTimesTraining |
| The total number of training the user did since the creation of this profile. |
Name | Type | Description |
action |
| The name of the action. |
times |
| How many times the user trained this action. |
Name | Type | Required | Description |
cortexToken |
| yes |
status |
| yes | Must be "set" or "get". |
profile |
| no | A profile name. |
session |
| no |
actions |
| no | If the status is "set", this parameter is the list of actions to activate. You can't activate more than 4 actions. This doesn't include "neutral". |
Name | Type | Description |
actions |
| The active actions. |
message |
| A success message. |
Name | Type | Required | Description |
cortexToken |
| yes |
status |
| yes | Must be "get" or "set". |
profile |
| no | The name of a profile. |
session |
| no |
signature |
| no | If the status is "set", then this parameter must be "universal" or "trained". |
Name | Type | Description |
currentSig |
| The current signature used by the profile. Can be "universal" or "trained". |
availableSig |
| The signatures you can use with the profile. The "universal" one is always available, but the "trained" one requires some training. |
Bug fixes for data synchronization issue, unexpected empty record issue
Interpolate CQ data for MN8 when there is data lost
Hot fix for authentication issue on LABS/Builder webapp.
Authentication flow improvement
Bug fixes
Support upgrade firmware of Flex 2 via native Bluetooth connection
Improve firmware upgrading
Support data sharing of organization
Support Flex 2 via native Bluetooth connection
Bug fixes
Bug fix for extender firmware upgrade (from very old version)
A hotfix for marker issue
Cortex API usage tracking
Time synchronization between different Emotiv headsets
Support firmware version x2F06 of Flex headset.
Improve headset setting feature for Flex
Bug fixes
Bug fixes
Improve timestamp algorithm for Flex.
Bug fixes
Update new certificate of the Cortex web socket server. The certificate before version 3.7.1 expires on Dec 9, 2023.
Bug fixes
Support Flex
Upgrade the core framework for BLE connection.
Upgrade to OpenSSL 3.0, TLS 1.2
Improve data quality
Performance enhancement and minor bug fixes
Training profiles are now supported for only specific types of Emotiv headset. All training profiles created before 3.6.5 will become readonly profiles.
Bug fixes
Attention detection will replace Focus detection
Focus detection can still be found via exportRecord
API with includeDeprecatedPM
option.
Save more data into database, even there is no record.
Update export policy on EmotivPRO with records from EmotivPRO mobile.
Support Xtrodes devices on EmotivPRO
Roll back the core framework for BLE connection (since the new version in 3.5.0/3.5.1 is not really stable).
Bug fixes
Hotfix for BTLE connection.
Improve timestamp correction algorithm.
exportRecord() API will also export survey data in CSV format (along with JSON format).
Upgrade the core framework for BLE connection.
New system requirement on Raspberry Pi:
Raspberry Pi OS - Debian version 11 (Beta release, 32-bit)
New system requirement on MacOS/Windows:
Windows 10 (64-bit) v1809+
macOS 10.14 Mojave or above
Support macOS 12.1
Bug fixes on some instances where the database cannot be initialised properly
No change in the Cortex API
Bug fixes, make the Bluetooth connection more stable
No change in the Cortex API
Fixed the scaled value from Interest / Valance that may go out of range in some cases.
Fixed Focus / Stress performance metrics with EPOC X.
No change in the Cortex API
Cortex is now available for Raspberry Pi OS
Bug fixes
No change in the Cortex API
Cortex is now available for Linux Ubuntu (Beta release)
Solve an issue on macOS 11, where EMOTIV headsets couldn't connect by Bluetooth.
No change in the Cortex API
No change in the Cortex API
macOS 10.12 Sierra is not supported anymore. In order to install Cortex 2.6.0 you must upgrade your Mac to macOS 10.13 High Sierra or above.
This version didn't introduce any change in the API.
There are significant changes from Cortex API version 1.x to 2.0.
To connect to Cortex 1.x, you used the url wss://emotivcortex.com:54321 In Cortex 2.0, you must use wss://localhost:6868
In Cortex 2.0, the user must login with EmotivID through the EMOTIV App. So, the API doesn't have a login or logout method anymore.
Some methods have been removed or renamed.
The parameters and result format of some methods have changed. If you get an error when calling a method, please check its documentation.
Name | Type | Required | Description |
profile |
| no | The name of a profile. |
session |
| no | A session id returned by . |
This method returns the brain map of a profile. The brain map is a graphic representation of the mental command training of the user. It indicates which actions are most distinct from each other and from the neutral state as measured by how often the training data is misclassified. The better training you do, the more separated the coordinates will be.
Check out the usage in our BCI app.
You must set one of these 2 parameters: profile or session. Read this for details.
The result is an array of objects. Each object is represents a trained actions and contains these fields:
This method returns the training threshold of the mental command detection. It also returns the score of the last mental command training.
The training threshold provides an indication of minimum threshold that you should target for when training the action, and it changes according to number of total actions that you have currently activated. Any training score above the threshold is very likely to improve your profile. Any training significantly below the threshold is likely to reduce the quality of your profile.
Check out the usage in our BCI app.
You must set one of these 2 parameters: profile or session. Read this for details.
The result is an object containing these fields:
In addition to method responses and data samples, Cortex can send a third type of message, called warnings.
These warnings inform your application about important events, like when the user logs in or out, or when a training profile is loaded or unloaded for a headset.
A warning object contain these fields:
The warning object has 2 fields:
The possible codes are:
This method get or set the sensitivity of the 4 active mental command actions.
Check out the usage in our BCI app.
You must set one of these 2 parameters: profile or session. Read this for details.
The array values contains the sensitivity of each active actions. The order of the values must follow the order of the active actions, as returned by mentalCommandActiveAction.
If the status is "get", then the result is an array of 4 numbers.
If the status is "set", then the result is a success message.
This method returns the skill rating of a mental command action, or the overall mental command skill rating. This is a measure of how often you can trigger the desired action as measured in the previous trainings. A higher rating indicates stronger ability to perform that action.
Deprecated: this method is superseded by mentalCommandBrainMap and will be removed in the future.
You must set one of these 2 parameters: profile or session. Read this for details.
The result is a number
that is the requested skill rating.
A token returned by .
A session id returned by .
A token returned by .
A session id returned by .
A token returned by .
A session id returned by .
A token returned by .
A session id returned by .
A token returned by .
A session id returned by .
Support EDF+/BDF+ file format, see API.
New device scanning workflow (see controlDevice with "refresh" command mentioned ).
See .
See new update on API.
Support the new headset
New method added
EMOTIV App is now called
Cortex 3.0 is not compatible with Windows 8. See the .
It is now possible to run all the detections with an EPOC Flex headset. This requires a specific EEG sensor mapping. See for details.
Check the page to see all the supported headsets and platforms.
New data stream "eq" to get the EEG quality. See . Please read this to understand the difference between the contact quality and the EEG quality.
New label "BatteryPercent" added to the "dev" data stream. See .
The method is now available on iOS and Android
New parameters added to the method
New parameters added to the method
Check the page to see all the supported headsets and platforms.
The sample rate of the data stream "dev" is now 2 hertz. See for details.
Check the page to see all the supported headsets and platforms.
Support the new headset
Support for iOS and Android (Beta release, see the for details)
New parameter title added to the method
In the method , you can now order the records by their applicationId.
New code 112 and 113
Check the page to see all the supported headsets and platforms.
Support the new headset
New field headbandPosition added in the and the (EPOC X only)
New method added to set the position of the headband (EPOC X only)
New field customName added in the
Change in the result of the method , new added to get the result of this method
New label overall in the device information
New parameter includeFlexMappings added to the method
New field lastLoginTime added in the result of the method
New method added
New parameter connectionType added to the method
New parameter experimentId added to the method
New added when the available space on the hard drive is too low
New added when the opt-out configuration changes
New label isActive in the performance metrics
New method added
New methods added to manage the
See for details.
Third party applications must be approved by the user before using the Cortex API. See the new method .
The method doesn't accept "anonymous mode" anymore. You must provide a client id and client secret.
See for details.
Call the method to connect a headset to Cortex. If the headset is not connected, then you can't create a session with this headset.
See for details.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
profile
string
no
A profile name.
session
string
no
A session id returned by createSession.
Name
Type
Description
action
string
The action name.
coordinates
array of 2 numbers
The (x, y) coordinates of this action in the brain map. x is in range [-1.0, 1.0] and y is in range [0.0, 1.0].
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
profile
string
no
A profile name
session
string
no
A session id returned by createSession.
Name
Type
Description
currentThreshold
number
The threshold of the mental command detection.
lastTrainingScore
number
The score of the last mental command training.
Name
Type
Description
jsonrpc
string
Always has the value "2.0".
warning
object
An object with the fields "code" and "message".
Name
Type
Description
code
number
The code of this warning. The possible codes are documented below.
message
any
The type and value of this field depends on the code. For most of the warnings it is just a string, but it can also be an object. See the examples below.
Code
Description
0
All the data streams you subscribed to have been automatically canceled by Cortex. This can happen if the headset was disconnected.
1
Your session was automatically closed by Cortex. This can happen if the headset was disconnected.
2
The user has logged in with EMOTIV App.
3
The user has logged out with EMOTIV App.
9
The user approved your application in EMOTIV App.
10
The user declined your application in EMOTIV App.
13
A training profile was loaded for a headset using setupProfile
14
A training profile was unloaded for a headset using setupProfile.
15
A training profile was automatically unloaded by Cortex. This can happen if the headset was disconnected, or if the application that loaded this profile was disconnected from Cortex.
17
The user accepted the EULA in EMOTIV App.
18
The record data has been successfully saved. Cortex sends this warning when a record is done with some long-run post processing after record is stopped.
19
The available disk space is low. Cortex send this warning when there is less then 1 GB available of the hard drive.
This warning was added in Cortex 2.2.1
20
The available disk space is critically low. Cortex send this warning when there is less then 300 MB available of the hard drive. When this happens Cortex automatically disconnect all the headsets. You cannot connect a headset until the user free up some space.
This warning was added in Cortex 2.2.1
21
The user has changed the opt-out configuration.
This warning was added in Cortex 2.2.1
22
Cortex has changed the opt-out configuration. This can happen when the license of the user is updated.
This warning was added in Cortex 2.2.1
26
The license of the user will expire in a few days.
This warning was added in Cortex 2.3.0
30
Data post-processing finishes. After record stops, Cortex still needs to run a lengthy process to improve timestamps or combine broken sessions. If you want to export the record just after it stops, you should wait until this warning is emitted from Cortex.
100 and 101
Cortex failed to connect to a headset. If the headset uses a Bluetooth connection, then you should try to disconnect the headset from the Bluetooth manager of the OS.
102
Cortex reached a timeout while trying to connect to a headset. This can happen if the wireless connection is of poor quality.
103
Cortex disconnected a headset because it didn't receive any data from this headset for more than 30 seconds. This can happen if the headset goes out of range of the computer, or if the wireless connection is of poor quality.
104
Cortex successfully connected to a headset.
110
Cortex successfully updated the configuration of a headset. See updateHeadset.
This warning was added in Cortex 2.4
111
Cortex failed to update the configuration of a headset. See updateHeadset.
This warning was added in Cortex 2.4
112
Cortex successfully updated a headset but the new configuration can only work with a USB dongle connection. The configuration is not compatible with a Bluetooth connection. See updateHeadset.
This warning was added in Cortex 2.5
113
Cortex failed to connect to an EPOC+ or EPOC X headset with Bluetooth. The configuration of the headset is not compatible with a Bluetooth connection. See controlDevice.
This warning was added in Cortex 2.5
142
Cortex finishes headset scanning which is started by controlDevice with "refresh" command.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
status
string
yes
Must be "get" or "set".
profile
string
no
A profile name.
session
string
no
A session id returned by createSession.
values
array of 4 numbers
no
If the status is "set", this parameters is the new sensitivities. Each value must be between 1 and 10. Bigger number indicates higher sensitivity.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
profile
string
no
A profile name.
session
string
no
A session id returned by createSession.
action
string
no
The mental command action. If omitted, then this method returns the overall skill ratting.
Method name in v1 | Equivalent in v2 |
login, logout |
acceptLicense |
controlBluetoothHeadset |
updateNote |
See
The user must accept the EULA in EMOTIV App. You can call to check if the user already accepted the EULA or not
See
See