Update for API Traders: New Changes in DhanHQ API Authentication Process and Updates

I have sent mail to help at dhan dot co already.

1 Like

Orders API is still failing with Token generated using API keys. For now I have switched to Token generated manually from Dhan portal and it is working fine.

Hi Team,

Thank you for your response regarding the static IP usage for algo trading accounts.

However, as per SEBI Circular No.: SEBI/HO/MIRSD/MIRSD-PoD/P/CIR/2025/0000013 dated February 04, 2025, it has been clearly mentioned that:

“Algos developed by tech-savvy retail investors themselves, using programming knowledge, shall also be registered with the Exchange, through their broker, only if they cross the specified order per second threshold. Further, the same registered Algo shall be permitted to be used by such retail investors for their family (but not for other investors). ‘Family’ for this purpose would mean self, spouse, dependent children and dependent parents.”

In light of the above, could you please clarify:

  1. Why is it mandated that each user must have a distinct static IP, even when the same registered algo is permitted to be used across family accounts by SEBI?
  2. Is this restriction an exchange-level compliance requirement or a broker-specific implementation?
  3. If this is broker-specific, would there be any provision in the future to align with SEBI’s stance so that a single IP may be mapped to family accounts running the same registered algo?

Looking forward to your clarification so that I can ensure compliance while optimizing infra usage for family accounts.

Thanks & Regards,
Shyam Darade

1) Short technical support request (concise)
Subject: IP whitelisting & API throughput — information request
Body:
Hi [Support Team],
I need clarity on your IP whitelisting and API throughput rules. Please confirm:

  1. Do you require static IP(s) for API order placement? Are rules per‑broker account, per‑PAN, or per‑API key?
  2. How many public IPs can we whitelist per account and what formats do you accept (single IP, CIDR)?
  3. What are the API rate limits (orders/sec, burst limits), and how to request higher throughput?
  4. Do you support NAT/egress IPs or mutual‑TLS as alternatives?
    Please reply with your documentation link and the expected SLA for IP activation.
    Thanks,
    [Name | Company | Account ID]

2) Detailed technical (for infra team / vendor onboarding)
Subject: Onboarding / Whitelisting — technical checklist & SLAs required
Body:
Hello [Team],
We are preparing to deploy production algos and need the full technical/onboarding checklist: IP whitelisting process, supported IP formats, max whitelisted IPs, CIDR support, NAT/egress rules, authentication methods (API key / mTLS / FIX), per‑account and per‑PAN constraints, production API rate limits (orders/sec and burst), failover/DR IP procedures, logging retention policy, and escalation contacts. Also provide sample request/response payloads, error codes, and replay APIs. Please supply SLA for IP onboarding and escalation contact. Account ID: .
Regards,
[Name | Role | Phone]

3) Compliance/legal template (to request NDA/contract language)
Subject: NDA & contractual terms for enterprise API/colocation access
Body:
Hi [Legal/Commercial],
We are evaluating enterprise API/colocation access. Please share your standard NDA and the commercial contract terms that cover confidentiality, IP whitelisting procedures, responsibilities for IP changes, penalties for policy violations, and data retention. Also include pricing for additional whitelisted IPs and higher rate tiers. We may request custom confidentiality language. Account ID: .

@Hardik , I am unable to get authenticated using TradeHull today, I used the same code which was working fine few months back, I have set static IP as per the new requirement. Is there something I am missing after this new change in authentication and access_code expiry every 24hours

Hey @haricharan @Azure_Sphere @vinay_rana8727

Yes, we are working on fixing this issue. Do note this won’t impact order placement with normal access token module.
For API key based toke, we will resolve this.

The highlighted quote from the circular talks about algo which is registered on the exchange and not the static IP. For registering an individual’s algo at the exchange, there is a different set of requirements which we are working on.

Yes, we will have the option to add same IP for the entire family. Again, it will take a while for us to operationalise the same.

@ROCKY2

Yes, it needs to be on a per broker account basis

Two IPs can be whitelisted per account

This has already been highlighted. For now, the Order Rate limits are at 25 order/second. However, it will be limited to 10 order per second. For higher throughput, there needs to be an Algo registration process, which will be outlined soon.

I am not sure if the other points are valid for this conversation.

@madan_i no, there are no further changes except for the access token validity reduced to 24 hours. Can you share the error that you are getting, can assist accordingly.

@Hardik

I tried to find some pattern, but had no luck. Sometimes the same TOTP worked on the 2nd or 3rd attempt, while other times it didn’t succeed even with the next generated TOTP.

i have captured the logs below:

url_for_weblogin=‘Unauthorized !’

Retry #1 Sleeping for 5 seconds before retrying next time, broker response : Something went wrong. Kindly contact system administrator.. Entered totp : 326485

Retry #2 Sleeping for 10 seconds before retrying next time, broker response : Something went wrong. Kindly contact system administrator.. Entered totp : 326485

Retry #3 Sleeping for 15 seconds before retrying next time, broker response : Something went wrong. Kindly contact system administrator.. Entered totp : 031822

Retry #4 Sleeping for 20 seconds before retrying next time, broker response : Something went wrong. Kindly contact system administrator.. Entered totp : 031822

Retry #5 Sleeping for 25 seconds before retrying next time, broker response : Something went wrong. Kindly contact system administrator.. Entered totp : 078434

All retries exhausted. However totp has not worked

you can check for below consent id what went wrong

dhanClientId’ = ‘1100163298’
consentAppId=‘1a112458-3c03-46be-89e1-3d9d7be89c39’

@Titamazon thanks for sharing the details, will get this checked.

I have evaluated that method and it cannot be run unattended, there is still a need to input a otp/login physically to generate a token, and if I can do that, then I might as well create a new access token everyday directly on Dhan. Basically there is no way anymore to run a headless server and let it run 24/7 like I was doing before due to the 30 day token expiry limit. SEBI in their misplaced wisdom like so many of their bizzare recent moves, have created further hurdles for the retail community.

Algo trading/static IP requirements postponed again till 3Jan26.
can’t post link

@Hardik new api autenticated token not working with websockets,you guys mentoined solution within this week, i have been using three different accounts and subcribed for data api each particularly for usage with websocket, hope you understand my concern and make it top priority for solving this issue.

@Hardik is this issue fixed now?

@vinay_rana8727 Does this require logging in every time a new token is generated, or is it a one-time login? If multiple logins are needed, can it be updated to automatically generate tokens without requiring regular manual intervention? like fully automated

@Hardik same error is happening with me wrt totp retries, keeps telling me to contact to sysadmin, please fix

@Hardik @PravinJ I m small retail trader my monthly profit itself is around max 10k , dedicated IP will cost me too much ,

After min what time can I change static IP in Dhan or add different IP ?

I’m thinking to maintain persistent internet connection so that IP is not changed for maybe 24 hrs or maybe a week.

Pls reply accordingly :folded_hands:t2::sob:

@harshn :point_down:

https://private-poc.madefortrade.in/t/update-for-api-traders-new-changes-in-dhanhq-api-authentication-process-and-updates/56286/24?u=t7support

@Dhan please make a youtube video and explain the new update the form is to messy the solution of all problems is a 1 detailed video

isse bhdiya to me daily access token generate karlu web app se hi itna tam jham kyu karu

3 Likes

kindly request Mr. Imran to give latest updated dhantradehull module file.

@Dhan, I expect a full refund for the 10-day API subscription during which no data was delivered thru websocket on account of anew access tokemn related problem. You’ve acknowledged the issue with the WebSocket access token, yet failed to provide timely support. This is unacceptable—please process the refund immediately.