How to use
Quick reference for tokens, intervals, CSV format, and common errors.
1. Generate a Dhan access token
From your Dhan account, top-right → My Profile → DhanHQ Trading APIs → Access Token.
- Log in to web.dhan.co.
- Go to Profile → DhanHQ Trading APIs.
- Generate a new access token (valid for ~24 hours).
- Copy it and paste into the token field in the header. Optionally add your Client ID.
- Click Verify — the pill turns green when the token works.
2. Intervals & date windows
Intraday intervals: 1, 5, 15, 25, 60 minutes. Daily: D.
Intraday history is limited to ~90 days per request — long ranges are auto-chunked and stitched. Daily history covers a longer window in one call.
3. CSV schema
timestamp,datetime_ist,date,open,high,low,close,volume,open_interest
Timestamps are Unix seconds. datetime_ist is for human reading; date is ISO 8601.
4. Troubleshooting
| Error | Likely cause / fix |
|---|---|
| 401 | Token expired or wrong. Regenerate it in Dhan dashboard. |
| 429 | Rate-limited. Engine auto-retries; increase delay (ms) if it persists. |
| Empty | No data — check trading days; expired contract may not cover the range. |
| No contract | Click Refresh on the instrument master. |
| CORS | Default proxy mode avoids it — only happens if you switch to direct mode. |
Privacy
Your token is sent only to Dhan via our request proxy, never stored, never written to disk, never logged. Closing this tab wipes it from memory.
