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

@Hardik please reply

Hi T7support,

Sounds interesting! Would it be possible to make a short video showing how to do this? It would be a huge help for people like me who aren’t very tech-savvy. :smile: :pray:

@jaison I can but from where to where do you want ?

From creating oracle user account to logging in to Linux shell via SSH (complete with static IPs and open ports) ?

If some one is not tech savvy then those steps are relatively easy compared to what follows next :grinning:

1 Like

@Hardik Sir

Sometimes (25% fail attempt as per my observation) I get the attached error. Is it because the API is unstable, or is there some other reason?

Info: I have entered the correct mobile number and TOTP.

1 Like

@Dhan
I am still waiting for the reply. This is most important as you fixed your deadline of 1st October then you should answer it immediately. When my entire algo is running from Google cloud then why you need static IP.

@Mrinal_Chakraborty

If u have set up a cloud server u will have a static IP for it. You can use that to get the API token access.

Need for static IP is mandated by the regulator. Broker cannot do anything about this.

1 Like

@Option_Snail

Thanku so much,
And i have taken proper static IP from my internet provider

Hi,

Are you using Tradehull or DhanHQ

Hello @Hardik , does this apply for Sandbox also? Coz, centralized auth config is what i have now, that case I may have to have diff architecture. Your help is greatly appreciated :+1: thank you

Hey @Bishnoi

There is an option to allow family members to access APIs from single static IP. However, that is still pending clarification on implementation.

No. Static IP is going to be required irrespective of the type of trading on APIs. What you are talking about applies to registration criteria for any algo. In case where a user wishes to place more orders than the TOPS, in those scenario Static IP is mandatory.

Yes, there is a limit of 25 consent ID on a daily level. Do note that there is no expiration to consent ID and you can use it throughout the day for generating login session.

This has been fixed. Do try it once again and confirm.

There won’t be any changes to the module, given it is post generation of access token. However, static IP requirement will be there.

You need to do this every time - starting from generating consent > login > access token

Need to take a look into this. Are you mapping IP here?

This has been documented on the usage of consent ID itself.

Yes, this is expected

Do let us know in case you are still facing this issue

TOTP automation can only be used for step 2, wherein you can autofill TOTP. Rest all remains independent modules.

No, in case of platforms where you do not paste your access token manually, we will capture the partner’s IP.

What is the error that you are getting here? Can help accordingly.

Yes, google sheet implementation will be difficult, given there is no static IP. While we have raised this point on discussions, the only way would be to route the orders to a backend and then send the orders on API.

Hey @Option_Snail
Can you send in your ID via DM? This module is working fine. You shouldn’t face this error just because of the Access Token generation method.

Can you share your client ID on help@dhan.co. This shouldn’t have been happening on this stage.

No, the static IP regulations do not apply to sandbox.

@Hardik

I am frequently encountering an error during the TOTP validation stage (https://partner-login.dhan.co/dhanhq/validateTOTP).

This is the response I received from the server:

{'data': [], 'dh_error_code': '', 'error_code': 'RS-0060', 'message': 'Something went wrong. Kindly contact system administrator.', 'status': 'error'}

The same error occurs during the manual web process (as shown in the earlier screenshot), and I am observing a similar issue at the API automation level.

I also noticed that there seems to be a restriction on the number of consent generations. Please fix this error; otherwise, the consent generation limit may be consumed unnecessarily due to the server-side issue.

@Hardik but in the python doc there is no explanation how to login through api and Secret key and the flow to verify the Totp also

When I’m using a new access token generated from the API key and API secret key, I’m getting this error: {ā€˜errorType’: ā€˜Input_Exception’, ā€˜errorCode’: ā€˜DH-905’, ā€˜errorMessage’: ā€˜Missing required fields, bad values for parameters etc.’}. However, when I use the normal access key from Dhan Web, it works fine. hardik this error fix for fetching order details and all but when i’m placing order this error is still there when will this fix or any thing else is a issue @Hardik

Is anyone facing challenges running api in multiple family accounts with single VPS? SEBI norms says immediate family members can share single static IP but dhan clarified over support email that this is not possible. Unique static IP per user is what is supported by dhan.

Hi @Hardik

I have been using my family member’s account for algo. I updated the static IP for one account, but the same IP is not being accepted for the other account.

Could you please confirm if it is restricted to one user per IP? If that’s the case, does it mean that each user would need a separate server with a different IP address?

Please clarify.

1 Like

I don’t see limit of 25 in the documentation. It says ā€œas many as they wantā€.

Let say we give 2 Static IPs are we allowed to place order using both IP’s?

Hi @Hardik ,

I use my account as well as my HUF account to trade from the same server. When I enter the static Ip used in one account, it says IP already in use for the other account.

So i’ve to execute trades also via different servers. That will be like setting up entire new setup. Suggest ?

@shyam_Darade Are you able to find any clarification on this.

Regards,

Please update on this option.

@Hardik Hardik
what does this mean? {ā€˜status’: ā€˜failure’, ā€˜remarks’: {ā€˜error_code’: ā€˜DH-905’, ā€˜error_type’: ā€˜Input_Exception’, ā€˜error_message’: ā€˜Invalid IP’},
I have a valid static ip setup on Dhan yet this message? This ip addresses actually resolves to a bunch of sites that i host, so there is no question of it being inaccessible.