How to Fix the "IP Not Whitelisted" Error on Indian Broker APIs

How to Fix the "IP Not Whitelisted" Error on Indian Broker APIs

Getting IP-not-whitelisted or invalid-session errors from Zerodha, Fyers, Dhan or Angel One APIs? Diagnose the cause and fix it permanently with a static IP.

What the error actually means

When a broker API returns "IP not whitelisted", "request origin mismatch" or abruptly invalidates your token, its edge servers compared the source IP of your HTTPS request against the address registered for your API key — and they didn't match. The broker is working as designed; your network is the problem.

Step 1 — Find out what IP the broker is seeing

Run this twice a few hours apart (or after rebooting your router). If the two answers differ, you have a dynamic IP — the root cause.

Step 2 — Understand why your IP keeps changing

Step 3 — The permanent fix: dedicated static IP

Provision a dedicated Indian static IP, whitelist it once in the broker portal, and route your bot through it via HTTP or SOCKS5 proxy. Your origin address becomes constant regardless of what your ISP does.

Step 4 — Verify and monitor

Errors that disappear after this fix