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.
Commands
Section titled “Commands”| 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) |
Examples
Section titled “Examples”dhan ip get --json --no-colordhan ip set --ip 203.0.113.10 --yes --json --no-colordhan ip set --ip 203.0.113.10 --flag SECONDARY --yes --json --no-colordhan ip modify --ip 203.0.113.20 --flag PRIMARY --yes --json --no-colorGotchas
Section titled “Gotchas”- 7-day write window. Once
ip setregisters an IP, you cannot change it (useip modify) for 7 calendar days. Plan accordingly. - 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.
- IP set/modify themselves are live-state mutations and require
--yes.