Dhan API Static IP: Fix Your Cloud Bot After the SEBI Deadline

QuotaGuard Engineering
April 2, 2026
5 min read
Pattern

Route your Dhan API calls through QuotaGuard Shield, get a dedicated static IP, and register it in the Dhan API dashboard. Your bot works again.

We tested on April 2, 2026. A request to api.dhan.co through a QuotaGuard Shield proxy on AWS us-west-2 returned a clean authentication. No CDN block. No IP-level rejection. The connection reached Dhan's servers. Once you register your static IP, authenticated requests go through.

SEBI's static IP mandate for retail algo trading took effect April 1, 2026. Dhan, along with every other major Indian broker, now requires a registered static IP for API order placement. Full regulatory background, SEBI circular citations, and all affected brokers here.

The fundamental problem: Heroku, Render, Railway, Fly.io, and most PaaS cloud platforms don't assign static outbound IP addresses. Every time your container restarts, it may use a different IP. You can't whitelist a moving target.

Fix It With QuotaGuard Shield

QuotaGuard Shield is an egress proxy that gives your cloud app a dedicated, static outbound IP. You route your Dhan API calls through Shield. They exit from an IP that never changes. You register that IP with Dhan. Order placement works again.

Shield uses SSL passthrough. Your access token and order data travel encrypted end-to-end between your app and Dhan's servers. The proxy forwards packets without decrypting them. Your broker credentials don't pass through QuotaGuard's infrastructure in plaintext.

Each account gets a dedicated IP. Not shared. Not rotating. SEBI's requirement specifies the IP must be traceable to the individual trader. A shared proxy pool fails that test. A dedicated static IP passes it.

Setup

Sign up at quotaguard.com/products/pricing. Your proxy URL and dedicated static IP are in the dashboard immediately. Set QUOTAGUARDSHIELD_URL as an environment variable on your platform (Railway, Render, Fly.io, EC2, or anything else).

If you're on Heroku, Shield is also available as an add-on: heroku addons:create quotaguardshield:starter. It sets the environment variable automatically.

Python: dhanhq Library

import os
from dhanhq import dhanhq

proxy_url = os.environ['QUOTAGUARDSHIELD_URL']
os.environ['HTTPS_PROXY'] = proxy_url
os.environ['HTTP_PROXY'] = proxy_url

dhan = dhanhq("client_id", "access_token")

Set HTTPS_PROXY and HTTP_PROXY before initializing the dhanhq client. The library uses requests under the hood and reads proxy settings from environment variables. All outbound calls route through Shield from that point.

Quick Connectivity Test

import os
import requests

proxy_url = os.environ.get('QUOTAGUARDSHIELD_URL')
proxies = {'http': proxy_url, 'https': proxy_url}

response = requests.get('https://api.dhan.co', proxies=proxies, timeout=10)
print(f"Status: {response.status_code}")
# 401 = connectivity confirmed (authentication required)
# Any HTTP response = the network path is open

Register Your IP With Dhan

Your static IP is in your QuotaGuard Shield dashboard. Log in to your Dhan API dashboard at api.dhan.co and look for the IP whitelisting or static IP settings. If you don't see it or the process isn't clear, contact Dhan support directly. Don't guess at the URL or skip this step.

Once Dhan has registered your static IP, test with a simple balance or holdings call before running your full strategy. The 401 should resolve to a successful response.

Latency Won't Affect Your Strategy

Shield adds roughly 10-50ms per request. HFT firms don't deploy on Heroku. They use NSE co-location. If you're running a cloud-based bot, you're running daily bars, hourly signals, or intraday momentum. For those timeframes, 20-50ms is irrelevant.

The SEBI requirement is an identity verification layer. It runs at connection time, before orders are placed. It's not in the critical path of execution speed. It needs to succeed. It doesn't need to be fast.

Get Back to Trading

Your Dhan bot stopped working because the SEBI static IP requirement took effect April 1, 2026. Two steps: get a dedicated static IP through QuotaGuard Shield, then register it in your Dhan API dashboard.

We confirmed the connection on April 2, 2026. api.dhan.co responds through a QuotaGuard Shield proxy. The infrastructure works. The registration step is what's left on your end.

Sign up at quotaguard.com/products/pricing. Also available as a Heroku add-on.

QuotaGuard Static IP Blog

Practical notes on routing cloud and AI traffic through Static IPs.

Reliability Engineered for the Modern Cloud

For over a decade, QuotaGuard has provided reliable, high-performance static IP and proxy solutions for cloud environments like Heroku, Kubernetes, and AWS.

Get the fixed identity and security your application needs today.