> For the complete documentation index, see [llms.txt](https://ajaib.gitbook.io/ajaib-exchange-open-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajaib.gitbook.io/ajaib-exchange-open-api/websocket-references/authentication.md).

# Authentication

To subscribe to a WebSocket, the client needs to generate the listenKey, which will be valid for 60 minutes after creation, and pass it in the WebSocket URL as `/ws/<listenKey>` .

* A `POST` request on an account with an active listenKey will return the current listenKey and extend its validity for 60 minutes.
* A `PUT` request on an active listenKey will also extend its validity for another 60 minutes.
* A `DELETE` request on an active listenKey will close the stream and invalidate the listenKey.

Once the client is connected to the WebSocket, user data will be streamed to the client without the need to subscribe to it, but for other streams it requires an explicit subscription.
