KiteTicker WebSocket 403 Forbidden — HTTP APIs work fine, minimal test also fails

Market_Maniac
Hi, I'm getting a persistent 403 error on WebSocket connection while all HTTP endpoints work correctly with the same credentials.

App details:
- App type: Connect (paid, ₹500/month)
- Status: Active
- Subscription valid until 01 Sep 2026
- Kite Connect client: pykiteconnect (Python), version 5.2.1

Error:
kiteconnect.ticker | ERROR | Connection closed: 1006 - connection was closed uncleanly
(WebSocket connection upgrade failed (403 - Forbidden))

What's confirmed working with the same api_key/access_token, same session:
- Login flow (generate_session) — succeeds
- kite.historical_data() — succeeds, fetches candles correctly
- kite.instruments() — succeeds

What's failing:
- KiteTicker WebSocket connection — always 403, every attempt

Troubleshooting already done:
1. Confirmed no duplicate/leftover process holding another connection (ps aux clean)
2. Confirmed constructor argument order is correct: KiteTicker(api_key, access_token) — matches library signature (pykiteconnect 5.2.1)
3. Generated a completely fresh access_token via auth.py and retried — same 403
4. Waited several minutes in case of temporary rate-limiting — same 403
5. Confirmed this isn't a static IP issue (per docs, WebSocket data is exempt from the SEBI static IP requirement — only order placement needs it)
6. Tested with a completely minimal, bare-bones WebSocket connection (just KiteTicker + on_connect + on_ticks, no other code, no other files) — same 403 error. This confirms it's not an application-level bug.

Minimal reproduction code:
kws = KiteTicker(api_key, access_token)
kws.on_connect = on_connect
kws.on_ticks = on_ticks
kws.connect(threaded=True)

Since HTTP endpoints authenticate fine with this exact token but WebSocket specifically rejects it, this looks like it could be a permission/activation issue specific to the WebSocket endpoint on my app. Could someone from the team take a look? Happy to share my API key (not secret) if needed for lookup.

Thanks!
  • salim_chisty
    A 403 generally means the session expired or permission was not granted for initiating the WebSocket connection. Make sure you have created a Kite Connect app on the Developer Console and not a Kite personal app. To verify this, please check the type of your app in the Developer Console and ensure that you are using the correct api_key associated with your paid Kite Connect application.

    We have checked this and verified at our end, and we didn't observe any issue with the WebSocket tick data.
    Please review the WebSocket example code and ensure you are using the correct instrument token from the instrument list to check for any errors. Additionally, you can refer to the Python WebSocket streaming FAQs for further guidance.
Sign In or Register to comment.