Angel One SmartAPI IP Whitelisting: Complete Setup Guide
How to whitelist a static IP for Angel One SmartAPI, configure your Python bot through a dedicated Indian proxy, and eliminate AG8001/AB1004 session errors.
SmartAPI and origin IP checks
Angel One's SmartAPI is free and powerful, which makes it a favourite for retail algo traders. It is also strict: sessions are bound to the network fingerprint of the login, and erratic IP changes trigger token expiry errors like AG8001 (Invalid Token) and AB1004 (Something went wrong) far more often on rotating home connections.
Step 1 — Register your static IP with SmartAPI
In the SmartAPI developer portal (smartapi.angelbroking.com), open your app settings. Where the portal asks for a redirect/postback and server details, register the static IP you received from Algo-IP. If you use their IP-restriction feature, add the same address there.
Step 2 — Route SmartConnect through the proxy
Step 3 — TOTP and stable sessions
SmartAPI mandates TOTP-based 2FA for API login. Combined with a static IP, your bot's login now looks identical every day: same credentials, same TOTP device, same origin address. That consistency is what keeps long-running sessions alive through the trading day.
Checklist before market open
- Verify the exit IP with api.ipify.org through the proxy — it must match the address you registered.
- Generate the session after 8:30 AM so the token covers the full trading day.
- Keep WebSocket (SmartWebSocketV2) traffic on the same proxy as REST calls.
One dedicated IPv4 from Algo-IP covers one Angel One account's REST plus streaming traffic comfortably within our 200 GB monthly bandwidth allowance.