Static IP for the Dhan API

Since 1 April 2026, Dhan accepts API orders only from a static IP registered on your account. You can register a primary and a secondary IP, in IPv4 or IPv6, and change each no more than once in 7 days. Only order placement is checked; data calls work from anywhere.

Last checked against the broker's own docs on 13 November 2026

What Dhan checks

From Dhan's API docs, support pages and staff posts on MadeForTrade:

On sharing, Dhan's docs say each individual needs a unique static IP. A Dhan staff reply on MadeForTrade (6 November 2026) adds that parents, spouse and children can share one, linking up to four other accounts, through an offline request to apihelp@dhan.co.

How to register your IP with Dhan

  1. Get a dedicated IP with its proxy details: host, port, username and password.
  2. Check the exact exit address: curl -x http://USER:PASS@HOST:PORT https://ifconfig.co
  3. On web.dhan.co go to My Profile, Get Trading & Data APIs, Add Static IP, and enter it as the primary IP.
  4. Generate your access token after adding the IP. Dhan says to regenerate it once if the IP was added later.

Dhan also has APIs for this (setIP, modifyIP, getIP), which the Python SDK exposes on DhanLogin.

Send Dhan orders through the fixed IP

The official dhanhq client has no proxy argument, but it uses requests, which reads the standard proxy variables:

import os
PROXY = os.environ["PROXY_URL"]  # http://USER:PASS@HOST:PORT
for v in ("HTTPS_PROXY", "HTTP_PROXY"):
    os.environ[v] = PROXY  # set before importing dhanhq

from dhanhq import DhanContext, DhanLogin, dhanhq

login = DhanLogin(os.environ["DHAN_CLIENT_ID"])
token = login.generate_token(os.environ["DHAN_PIN"], os.environ["DHAN_TOTP"])["accessToken"]
dhan = dhanhq(DhanContext(os.environ["DHAN_CLIENT_ID"], token))

The full Dhan proxy guide on GitHub covers WebSockets, IP checks and troubleshooting.

Check what Dhan sees

In Dhan Web, open Profile, Get Trading & Data API, then Sandbox, IP Setup, Get Static IP. It shows your registered IPs and the Detected IP. They must match.

Common Dhan errors

More on the most common one: fixing DH-905 Invalid IP.

Dhan static IP: FAQs

Does Dhan accept IPv6 for API whitelisting?

Yes. Dhan's API docs say both IPv4 and IPv6 formats are supported, so a dedicated IPv6 at ₹50 a month plus GST works.

Do I need a static IP for Dhan Cloud?

No. Dhan says Dhan Cloud deployments aren't subject to the static IP requirement for external API orders.

How often can I change my Dhan static IP?

Once every 7 days.

Can my family use my IP on Dhan?

A Dhan staff reply says parents, spouse and children can share one IP, up to four linked accounts, through an offline request to apihelp@dhan.co. Dhan's docs otherwise say each individual needs a unique IP, so confirm with Dhan.

Sources

Get your dedicated static IP

IPv6 ₹50 a month, IPv4 ₹200 a month, plus GST. Live in minutes, whitelisted once.

Get IPv6 · ₹50/mo + GSTGet IPv4 · ₹200/mo + GST

Other brokers

Kotak Neo Trade API

Kotak Neo accepts API orders only from your whitelisted IP with a session created from that IP. Two IPs, 7-day changes, family sharing and Python setup.

ICICI Direct Breeze

ICICI Direct Breeze accepts orders only from the static IP on your API key. Primary and secondary IPs, weekly changes, family sharing and Python setup.

Shoonya (Finvasia)

Shoonya checks your registered IP on login and every API call, not just orders. Primary and backup IPs, why IPv4 is safer, and the Python setup.

Samco Trade API

Samco accepts API orders only from a whitelisted IPv4. One change per 7 days across your account, one client per IP, and the Python SDK proxy setup.

Zerodha Kite Connect

Zerodha Kite Connect accepts API orders only from a whitelisted IP. The rules, IPv4 or IPv6, where to add the IP, and Python code to route orders through it.

Upstox API

Upstox accepts API orders only from your registered static IP. The rules, IPv4 or IPv6, where to add the IP, and the Python SDK setup that avoids 407 errors.

All 10 brokers