Dhan

Add and validate your Dhan account in AutoTrader Web.

Account setupBroker independentTOTP login
In short

To add a Dhan account in AutoTrader Web, pick one of two platforms. DHAN_V2_AT_IPV6 needs a one-time setup and then connects every day on its own. DHAN_V2_IPV6 is a manual backup where you generate the access token yourself each day. Both use Dhan's free trading APIs and need a static IP registered with Dhan.

AutoTrader Web uses the Dhan trading APIs, which are completely free.

Which platform should I use?

Dhan offers two ways to connect through its API. Each one is a separate platform in our system.

PlatformHow it connectsWhen to use it
DHAN_V2_AT_IPV6One-time setup, then connects every day on its ownRecommended for most users
DHAN_V2_IPV6You generate the access token each day and copy it into our systemBackup when the automatic connection fails

A few notes:

  • DHAN_V2_AT_IPV6 is the recommended platform. It sometimes fails to connect because Dhan’s APIs are not always reliable (see Common Issues). We have reported these issues to Dhan many times, but they remain.
  • If you see login errors, switch to the DHAN_V2_IPV6 platform for the time being.
  • DHAN_V2_IPV6 is also designed to auto-generate tokens. Each morning you can click the Validate All button to check if your token was regenerated. Generate the token manually only if you see a failure.

Demo

Platform 1: DHAN_V2_AT_IPV6

Step 1 – Generate API Key

  1. Log in to the Dhan trading website.
  2. Open the menu on the top right by clicking your profile picture.
  3. Click Dhan HQ Trading APIs.
  4. By default it shows “Access Token”. Switch to “API key” using the toggle button.
  5. Fill in the API details:
    • Application Name: MyTradingApp
    • Redirect Url: https://webx.stocksdeveloper.in/auth/dhan
    • Postback Url: https://apix.stocksdeveloper.in/postback/dhan
    • Click Generate API Key (see screenshots below)
  6. Set up the static IP:
    • The API screen has an option to set up static IPs.
    • See Step 3 below to learn how to get your primary and secondary static IP.
    • Register both the primary and secondary static IP with Dhan.

Step 2 – Setup TOTP

The same API page has an option to set up TOTP.

  • Enable TOTP.
  • Scan the QR code in your authenticator app, such as Google Authenticator.
  • Copy the TOTP Key (a long string of 15 to 30 random characters). This step is important.
  • Save the TOTP Key, as you will need it in the next step.
  • Click the Enable TOTP button.

Step 3 – Add your Dhan account

  1. Go to the AutoTrader Web menu (Accounts -> Trading Accounts).
  2. Click the Create button.
  3. Select Broker as Dhan.
  4. Select Platform as DHAN_V2_AT_IPV6, then enter:
    • Dhan Client ID
    • Click the Static IP button to get your static IP
    • MPIN
    • TOTP Key
    • 10 digit Phone number registered with your Dhan account
    • API Key (shown on the Dhan API screen)
    • API Secret (shown on the Dhan API screen)
    • A nickname
  5. Click Validate and Save.
  6. That’s it. You have successfully added your Dhan account. Do not forget to read these known limitations.

Screenshots

Dhan API Key Generation

Platform 2: DHAN_V2_IPV6

Step 1 – Generate Access Token

  1. Log in to the Dhan trading website.
  2. Open the menu on the top right by clicking your profile picture.
  3. Click Dhan HQ Trading APIs.
  4. By default it shows “Access Token”.
  5. Fill in the API details:
    • Application Name: MyTradingApp
    • Postback Url: https://apix.stocksdeveloper.in/postback/dhan
    • Click Generate Access Token
  6. Set up the static IP:
    • The API screen has an option to set up static IPs.
    • See Step 2 below to learn how to get your primary and secondary static IP.
    • Register both the primary and secondary static IP with Dhan.

Step 2 – Add your Dhan account

  1. Go to the AutoTrader Web menu (Accounts -> Trading Accounts).
  2. Select Broker as Dhan.
  3. Click the Create button.
  4. Select Platform as DHAN_V2_IPV6, then enter:
    • Dhan Client ID
    • Enter Access Token
      • Note: the access token expires every day. Remember to regenerate it every morning and update it.
    • A nickname
  5. Click Validate and Save.
  6. Set up the static IP:
    • Click the small EDIT icon next to your account’s client id or login id to edit it.
    • Click the Static IP button to get your static IP.
    • Register both the primary and secondary static IP with Dhan.
  7. That’s it. You have successfully added your Dhan account. Do not forget to read these known limitations.

Common Issues

These are some common errors seen on the Dhan broker. Most of them are bugs on Dhan’s side, and we have already reported them to Dhan. These errors do not happen all the time. They come and go, so they are hard to get fixed.

  1. Login failed: Error from Dhan: [DH-906 – Invalid Token]
  2. Login failed: Please regenerate the API token on Dhan & update in our system
  3. Login failed: Error from Dhan: TOTP Validation Failed: [RS-0060] Too many requests, please try again after some time
  4. Login failed: Error from Dhan: Dhan Consent API Failed: [CONSENT_LIMIT_EXCEED] Consent limit Exceeded
  5. TOTP Rejected by Server (isValid: false). Check Time/Clock Sync

Solution

If you see any of these errors, switch to the Dhan DHAN_V2_IPV6 platform. That platform requires you to manually generate the access token every day and update it in our system.

This is explained at the start of the demo video above.

Bracket and cover orders on Dhan

Dhan offers bracket and cover orders of its own, and you can carry on using them — they are still in the Variety list and nothing about them changes. AutoTrader has its own versions too, and they are worth knowing about because they behave the same way on every broker you trade.

An AutoTrader bracket order (AT_BO) attaches a target and a stop-loss to your Dhan order, with an optional trailing stop that follows the price in your favour and never moves back. An AutoTrader cover order (AT_CO) is the same thing with a stop-loss only. Your entry reaches Dhan as an ordinary intraday order, and AutoTrader Web watches the price and sends the closing order when your level is reached. Use it when you want a trailing stop that behaves identically across brokers, when you want to change your levels after placing, or when you trade several brokers and want one set of rules.

Place one from the order window, from your own code, or from a chart alert. It is intraday only, it does not give you the extra intraday margin some brokers give on their own bracket orders, and the position is squared off automatically a short while before the market closes.

Read the risk before you use it. A stop-loss decides when we try to exit — it does not decide the price you get. A sudden move can take the price straight past your level, so your loss can be larger than the stop-loss you set. The full explanation, and the one-time terms you agree to before your first one, are on Bracket & Cover Orders.

Frequently asked questions

Does AutoTrader Web support Dhan?

Yes. Dhan is fully supported. You can connect one or many Dhan accounts and monitor live P&L, holdings and positions, place and manage orders, and copy trade across all of them from one screen, on web or mobile.

Can I copy trade with Dhan?

Yes. You can copy trade with Dhan in two ways — PMS copy from our terminal and master-child copy in the background — across accounts and brokers, with per-account sizing. You set up and control everything.

Can I manage multiple Dhan accounts together?

Yes. Add as many Dhan accounts as you like and see consolidated P&L, holdings and positions live, and trade across all of them at once.

How much does it cost to use Dhan with AutoTrader Web?

AutoTrader Web is ₹295 to ₹495 per account per month, with all taxes included, and a free 1-month trial. Your account also needs a static IP — this is required for every broker, not optional. It is ₹100 per month for one IPv6 static IP — you get a primary and a backup address, and the backup is included free (taxes included) — or bring your own IP for free. If Dhan charges separately for API access, that fee is set by the broker.

Can I place a bracket order on Dhan?

Yes, in two ways. You can use Dhan's own bracket and cover orders, which are unchanged, or an AutoTrader bracket order (AT_BO) or cover order (AT_CO), which behave the same way on every broker. Ours adds a trailing stop everywhere and lets you change your target and stop-loss after placing. It is intraday only and gives no extra margin, and a sudden price move can still take your exit past the level you set.

Bracket & cover orders →

Next steps

Was this page helpful?

Last updated 8 August 2026