Dhan API IP Not Whitelisted — Fix HQ 401 / 403 Origin Errors
Dhan HQ 401 or 403 IP error after a working day? Confirm api.ipify.org through HTTP proxy 443 and the Static IP field on web.dhan.co — not the VPS public IP.
Dhan’s Static IP field
In web.dhan.co open API profile → Static IP. Dhan commonly offers multiple slots (confirm the current portal — do not treat “5” as a guarantee). Filling slots with yesterday’s Jio address does not help tomorrow.
401 vs 403 on Dhan HQ
A 401 after a token that worked at 9:00 usually means the next request left from a new public IP. A 403 can also be a missing header — check the official Dhan error body before assuming whitelist. If the body mentions IP or origin, fix egress first.
IPv6 caution on Dhan
Dhan’s IPv4 API endpoints cannot use an IPv6-only plan. If api64.ipify.org through the proxy still shows an IPv4, that is expected when egress is bound to IPv4. Whitelist that IPv4, not an IPv6 literal, unless the form accepts IPv6.
Checklist
- HTTP CONNECT to HOST:443 with dashboard user/pass.
- Same proxy on REST and market-data sockets.
- api.ipify.org through the session equals the Dhan field.
- See /brokers/dhan for the setup sequence.