# Overview of API flow

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

1. First you have to login to the EMOTIV Launcher with your [EmotivID](/cortex-api/master.md#create-an-emotivid).
2. Make sure that you are using the correct application ID, client ID and client secret that you generated from the Account dashboard on Emotiv website in your application ([see here](/cortex-api/master.md#create-a-cortex-app)).
3. Call the [requestAccess](/cortex-api/authentication/requestaccess.md) API from your app to Cortex, and accept via the EMOTIV Launcher.
4. After access is granted, connect your EMOTIV brainwear headset via the USB dongle or Bluetooth.
5. Call the [controlDevice](/cortex-api/headset/controldevice.md) API with "refresh" command to start the headset scanning.
6. Call the [queryHeadsets](/cortex-api/headset/queryheadsets.md) API to list the available headsets.
7. Call the [controlDevice](/cortex-api/headset/controldevice.md) API with "connect" command to connect to the desire headset.
8. Call the [authorize](/cortex-api/authentication/authorize.md) API to get a Cortex token for subsequence requests.
9. Call the [createSession](/cortex-api/session/createsession.md) API to open up a new session and be ready for BCI data streaming.

![](/files/-M8R5tEmDnp-tghr3nhZ)


---

# Agent Instructions: Querying This Documentation

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

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

```
GET https://emotiv.gitbook.io/cortex-api/overview-of-api-flow.md?ask=<question>
```

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

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