Connect Dhan to AlgoCrab — Complete Setup Guide
Connect DhanHQ API to AlgoCrab: Client ID, access token, verification, first strategy deploy, and troubleshooting for Indian algo traders.
10 July 2026 · 10 min read
Dhan + AlgoCrab overview
Dhan’s developer stack (DhanHQ) is popular with active F&O traders. AlgoCrab integrates Dhan for connect, orders, positions, holdings, funds, historical data, and live market data — one of the more complete broker implementations on the platform.
Unlike Zerodha’s OAuth redirect, Dhan connection is typically token-based: you provide Client ID and Access Token from the Dhan developer portal.
Prerequisites
Active Dhan trading account with API access enabled.
Client ID and Access Token from Dhan’s developer documentation / portal (see https://dhanhq.co/docs/latest/).
AlgoCrab account ready to open Connect Broker → Dhan.
A plan for token refresh if Dhan rotates access tokens on a schedule — expired tokens stop live algos.
Step 1 — Create DhanHQ credentials
Log in to Dhan’s developer section and create or view your API application.
Copy Client ID and generate/copy the Access Token as per Dhan’s latest UI.
Screenshot placeholder: [Screenshot: Dhan developer portal API credentials].
Store tokens offline. Never embed them in public TradingView scripts.
Step 2 — Connect Dhan inside AlgoCrab
Go to Connect Broker → Dhan.
Paste Client ID and Access Token into the form. Screenshot placeholder: [Screenshot: AlgoCrab Dhan connect form].
Submit and wait for a successful connection state.
No OAuth browser hop is required for the standard Dhan token flow on AlgoCrab.
Step 3 — Verify the connection
Open Broker Panel: confirm funds/margin.
Load order book and positions — empty books are OK.
Optional: place and cancel a safe limit order to confirm routing.
Screenshot placeholder: [Screenshot: AlgoCrab broker panel with Dhan connected].
Step 4 — First strategy on Dhan
Backtest a simple options or futures rule on liquid index instruments.
Enable stop-loss / target fields before Start.
Start with minimal lots. Watch rejects related to margin or freeze quantity.
Dhan’s modify-order support on AlgoCrab helps when you need controlled amendments — still prefer strategy-level exits over manual chaos.
Common errors and fixes
401 / auth failures: Regenerate Access Token and reconnect.
Rate limits: Reduce parallel strategies or polling intensity.
Symbol mapping issues: Select instruments via AlgoCrab search so Dhan tokens map correctly.
Historical fetch timeouts: Large history jobs can take time; retry off-peak if needed.
FAQs
Q: Is Dhan better than Zerodha for algos? A: Depends on brokerage, margins, and your workflow. AlgoCrab supports both — compare brokers, not just platforms.
Q: Can I run Dhan and Zerodha together? A: Yes. Multi-broker is a core AlgoCrab use case — connect both and assign strategies carefully.
Disclaimer
Educational broker integration guide — not investment advice. Confirm DhanHQ terms and token policies on official docs.