Call this endpoint to explicitly invalidate the active session token before your application exits or restarts. Shoonya session tokens are otherwise flushed automatically during the daily Beginning of Day (BOD) process, but an explicit logout is recommended whenever your app controls its own lifecycle — it immediately revokes the token server-side and frees up any WebSocket subscriptions tied to that session.
API Endpoint
Method
POST
URL
https://api.shoonya.com/NorenWClientAPI/Logout
Content-Type
text/plain
Authorization
Bearer <AccessToken> — requires a valid AccessToken from Login.
Once invalidated, the access token cannot be reused — any subsequent API call returns Session Expired and requires a fresh OAuth login.
Logging out does not cancel open orders or close positions — it only terminates the API session. Use Cancel Order or Exit Order explicitly if that's the intent.
Any active WebSocket connection tied to the session is disconnected once the token is invalidated — reconnect with a fresh token rather than reusing the old socket.
Overview
Call this endpoint to explicitly invalidate the active session token before your application exits or restarts. Shoonya session tokens are otherwise flushed automatically during the daily Beginning of Day (BOD) process, but an explicit logout is recommended whenever your app controls its own lifecycle — it immediately revokes the token server-side and frees up any WebSocket subscriptions tied to that session.
API Endpoint
POSThttps://api.shoonya.com/NorenWClientAPI/Logouttext/plainBearer <AccessToken>— requires a validAccessTokenfrom Login.jData=<JSON payload>Request
The
jDatapayload:uidResponse
statrequest_timeemsgOn failure:
Python example
JavaScript example
Behavior notes
Session Expiredand requires a fresh OAuth login.