Dhan
Add and validate your Dhan account in QUANT LEVELS.
Step 1 - Generate API Key
- Open the Dhan app or web.dhan.co and log in.
- Go to Profile → DhanHQ Trading APIs.
- Generate an API Key (API Secret is optional for Dhan, but add it if shown).
-
Fill in these URLs on the API settings page:
Field Value Redirect Url https://quantlevelsdevloper.in/auth/dhanPostback Url https://quantlevelsdevloper.in/postback/dhan?key=jByKSan5riiFoxHxtetuI2dkBRkOA_dm
Step 2 - Enable TOTP
- On the same API page, enable TOTP.
- Scan the QR code in Google Authenticator (or any TOTP app).
- Copy the TOTP Secret Key shown - you'll need it below.
Step 3 - Set up a static IP
Dhan whitelists API access by IP. Use the Auto Assign button on the Add Account form to get a free IP from our pool, or paste your own proxy. Save the shown IP against your Dhan account.
Step 4 - Add the account
- Go to Accounts → Add New Account.
- Select Broker as Dhan.
- Enter Dhan Client ID, 6-digit MPIN, TOTP Secret Key, API Key and API Secret.
- Save. Your token generates immediately and auto-refreshes every day at 8:30 AM.
Common Issues
Login failed: Invalid Token / TOTP Validation Failed
Usually means the TOTP Secret Key was copied wrong, or your server clock has drifted (TOTP codes are time-based). Re-copy the key from Dhan's TOTP setup page and re-save.
Order rejected but account shows as logged in
Check your registered IP against Dhan matches the Proxy IP shown on this account's edit page - Dhan rejects order placement (not login) from a non-whitelisted IP.
Copy trading on Dhan
Dhan sends a live postback for every order on the account, including trades placed manually via Dhan's own app - so a Dhan master account detects your manual trades immediately, no extra setup needed. Mark any Dhan account as Master from Master Overview to start copying its trades to your mapped slave accounts.
FAQ
Do I need a paid Dhan API plan?
No. Dhan's trading APIs are free to use.
Can I use the same Dhan account as both master and slave for different masters?
An account can be a master or a slave, not both at once.