Subject:
Issue connecting to WebSocket feed (Error 401 Unauthorized)
Message:
Hello Upstox Support Team,
I’ve created an API app named “DeltaSmart_BOT” in my developer console and can successfully use the REST API (for example /option/chain and /market/quote).
However, when I try to connect to the WebSocket feed (wss://api.upstox.com/v2/feed) using my access token, the connection fails with the following error:
Error: Handshake status 401 Unauthorized
I’m using the latest token generated from the developer portal (the same one that works fine for REST requests).
Could you please confirm the following points:
-
Is the access token generated via the Developer Dashboard → Generate Token valid for WebSocket authentication?
-
If not, how can I generate a WebSocket-compatible token using OAuth2 (authorization code flow)?
-
Are there any specific scopes or permissions required for real-time market data streaming?
-
Is there a test or sandbox WebSocket feed I can use for development purposes?
Goal:
I want to subscribe to the NIFTY option chain via the live feed (instrument keys like NFO_OPTIDX_NIFTY24NOV25200CE and NFO_OPTIDX_NIFTY24NOV25200PE) for real-time LTP updates.
Thank you for clarifying the correct authentication process for the WebSocket connection.
Best regards,
Sudhakar
(Developer – DeltaSmart_BOT project)
![]()