> For the complete documentation index, see [llms.txt](https://emotiv.gitbook.io/cortex-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emotiv.gitbook.io/cortex-api/overview-of-api-flow.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
