Hello Everyone,
DhanHQ Trading and Data APIs are now widely used by many traders for its ease of implementation, complete documentation, wide choice of orders, and among many things - the speed of execution brought to you via our core proprietary trading engine - DEXT.
We are committed to making APIs more faster, stable and reliable. In accordance with the SEBI guidelines (which we recently discussed here), there are few updates on how you interact with DhanHQ APIs moving forward. We are making them easier, safer and accessible, while being in compliance with the regulations.
Here is what’s changing on your DhanHQ API experience:
1. Access tokens are now available only for 24 hours:
Keeping in line with the regulations, we are making access token validity to a maximum of 24 hours. While we always encouraged users to generate tokens for a maximum validity of 24 hours, we kept the option open for simplicity, where longer duration tokens could be generated. From now, only 24 hour tokens will be available and longer duration tokens can not be created.
2. API Keys - a new way to authenticate:
We are introducing a new way to login and authenticate your API access - API keys. Now, you can create API key and secret for initiating an OAuth based authentication with added security of 2FA login.
API keys is a preferred method for a lot of developers, wherein the process of generating new access tokens does not need to be done every day on the Dhan Web platform. Do note that the API key is valid for 12 months but you have to create a login session everyday. You can read more about the same here.
3. Authentication via TOTP
Along with the above changes, we are also introducing TOTP, a new method to authenticate 2FA while logging in to your Dhan account, only on API based login for yourself and on partner platforms.
4. Static IP whitelisting:
As an individual using APIs, we would want your Static IP address to be whitelisted with us, in order to continue using APIs post 1st October.
A static IP is a permanent internet address that never changes, unlike the regular dynamic IP your Wi-Fi assigns, which can change each time you reconnect. It must be procured from your ISP or cloud service provider. For retail algo traders, it ensures stable, fixed connectivity for APIs, whitelisting, and low-latency trading.
There are two ways to setup Static IP for your account:
- Go to web.dhan.co > DhanHQ Trading APIs > Setup Static IP
- Use Setup Static IP directly on APIs - Documentation
Static IP will be required for all Order APIs - to place, modify or cancel different types of orders including normal orders, super orders and forever orders. You can whitelist IPv4 or IPv6 based IP, depending on your choice.
We want to ensure that this transition is smooth for you, and our team is always available for you at help@dhan.co. While we implement the guidelines, we would like to know how we can improve your experience with APIs moving forward.
Do let us know your feedback here, as we continue building products with you.
Thank you
Hardik