Skip to content

dhan ip

Manage the static IPs whitelisted on your Dhan account for live trading. Dhan refuses to authorise order placement / modification / cancellation from a non-whitelisted IP — this is the upstream constraint, not a CLI limitation.

Subcommand Dhan endpoint Purpose Flags
dhan ip get GET ip/getIP Show configured primary and secondary static IPs.
dhan ip set --ip <ip> --yes [--flag PRIMARY] Live action POST ip/setIP Set a static IP. Once set, an IP cannot be changed for 7 days. --ip (req), --flag (default PRIMARY), --yes (req)
dhan ip modify --ip <ip> --yes [--flag PRIMARY] Live action PUT ip/modifyIP Modify within the allowed window. --ip (req), --flag (default PRIMARY), --yes (req)
Terminal window
dhan ip get --json --no-color
dhan ip set --ip 203.0.113.10 --yes --json --no-color
dhan ip set --ip 203.0.113.10 --flag SECONDARY --yes --json --no-color
dhan ip modify --ip 203.0.113.20 --flag PRIMARY --yes --json --no-color
  1. 7-day write window. Once ip set registers an IP, you cannot change it (use ip modify) for 7 calendar days. Plan accordingly.
  2. No retry loop on auth / static-IP errors. If a live trading command returns an authorization / static-IP error, do not retry — Dhan will continue to refuse (and may rate-limit). Stop, surface the error, ask the operator to fix the IP whitelist on the Dhan dashboard.
  3. IP set/modify themselves are live-state mutations and require --yes.