Dhan (DhanHQ) — How to Get Your API Credentials

DhanHQ offers two credential modes — a single Access Token, or an API Key + Secret pair. This guide covers getting either one from your Dhan Web account. It stops once you have your credentials in hand.

Before You Start

Step 1: Open "Access DhanHQ APIs"

Log in to Dhan Web, click your profile icon in the top-right corner, then select "Access DhanHQ APIs" (also reachable via Profile → DhanHQ Trading APIs).

📸 Screenshot 1: Profile menu showing "Access DhanHQ APIs" Highlight the profile icon and the menu entry.

Step 2: Request access (first time only)

If this is your first time using Dhan's APIs, click "Request Access" and refresh the page. Per Dhan's documentation, access is granted within seconds.

📸 Screenshot 2: "Request Access" screen Highlight the Request Access button.

Step 3: Choose Access Token mode or API Key mode

By default this page opens in Access Token mode. Use the toggle in the top-right to switch to API Key Mode instead if you'd rather have a separate API Key and Secret pair.

📸 Screenshot 3: Access Token / API Key Mode toggle Highlight the toggle control.

Step 4: Generate your credentials

Click "Generate API Key" (or "Generate Access Token", depending on the mode chosen). Then scroll to Profile Details and copy your Client ID — used alongside your API credentials.

📸 Screenshot 4: Generated credentials with Client ID Mask the actual key/secret/token values before sharing — use dummy values if illustrating this step.

Step 5: Complete TOTP setup

Under "Optional Settings" (despite the name, Dhan's documentation states this step is mandatory), click "Set-up TOTP" and follow the instructions to configure two-factor authentication for API access.

📸 Screenshot 5: TOTP setup screen Highlight the Set-up TOTP button.

What You Should Have Now

Important Limitations

🔒 Security warning: Keep your Access Token, API Secret, and TOTP details confidential. Never share them publicly. Never include real credentials in screenshots — use dummy values or mask them.

Screenshot Checklist

  1. Profile menu showing "Access DhanHQ APIs"
  2. "Request Access" screen
  3. Access Token / API Key Mode toggle
  4. Generated credentials with Client ID
  5. TOTP setup screen

Source: Dhan's official DhanHQ API documentation (dhanhq.co/docs) and Dhan Support articles (dhan.co/support).