Static IP for Dhan HQ API

Static IP for Dhan HQ API

Dhan HQ checks the source IP on order APIs. You can register more than one address, but a rotating home IP still burns slots. One dedicated IPv4 is the stable option.

Dhan API facts

How to whitelist a static IP

  1. Allocate Algo-IP IPv4 (IPv6 only if Dhan’s field accepts IPv6).
  2. In web.dhan.co open API profile → Static IP and paste the address.
  3. Set HTTP proxy host + port 443 on REST and WebSocket clients.
  4. Verify egress with api.ipify.org before the first live order.

Python / proxy hint

Use requests Session.proxies or httpx proxies pointing at HOST:443.

Common errors

Dhan 401 / 403 IP error

Order did not exit the whitelisted IP. Confirm proxy on both REST and market-data sockets.

Related guide: dhan-hq-api-static-ip-whitelisting-guide. Also see dedicated IPv4, trading proxy and all brokers.

Other broker setups