Kotak Neo API: "unauthorized" (100008) and "session ip doesnt match" (1037)
Kotak Neo checks two things on every order: that it comes from a whitelisted static IP, and that the session was created from that same IP. Failing the first gives stCode 100008, "unauthorized". Failing the second gives stCode 1037, "session ip doesnt match with reqest ip".
stCode 100008: "unauthorized"
The order came from an address that isn't on your Trade API app. Check it from inside your bot with the SDK's whatsmyip(), which returns the IP Kotak sees for your session, and compare it with the IPs under More, Trade API.
- Different address: route your Kotak client through the registered IP. The SDK takes an
httpxtransport with a proxy; the code is on static IP for the Kotak Neo Trade API. - Left over IPv6: Kotak's order hosts have IPv6 addresses, but kotakneo.com says only IPv4 is supported for now. A connection that can use IPv6 may reach Kotak from an address you can't register. Use an IPv4-only exit.
- Just changed the IP: the old session stays alive but can't place orders. Log in again.
stCode 1037: "session ip doesnt match with reqest ip"
You logged in from one address and sent the order from another. This happens when the login runs on your normal connection and only the order call goes through the proxy, or the other way round. Send the login (totp_login and totp_validate) and the orders through the same IP.
A common mistake
Don't use ipconfig or ifconfig to find the IP to register. They show your local network address, which Kotak never sees. Use a public check such as curl https://ifconfig.co, or curl -x http://USER:PASS@HOST:PORT https://ifconfig.co for a proxy.
FAQs
Do Kotak Neo data and WebSocket calls need the static IP?
No. Kotak checks only place, modify and cancel order calls. Login, reports, portfolio, data and streams work from any IP, but the session used for orders must have been created from the whitelisted IP.
How often can I change my Kotak Neo static IP?
Once every 7 days per IP. You need a new session after a change.
Sources
- Kotak Neo: static IP whitelisting for retail algo trading
- Kotak-Neo GitHub: static IP whitelisting
- Kotak-Neo GitHub: troubleshooting
Get your dedicated static IP
IPv6 ₹50 a month, IPv4 ₹200 a month, plus GST. Live in minutes, whitelisted once.