Hey @Shashwat @Azure_Sphere @Kush
We tried this at our end and this is working as expected. Can you please raise tickets on help@dhan.co. It is not possible for us to debug this without details here.
Hey @Shashwat @Azure_Sphere @Kush
We tried this at our end and this is working as expected. Can you please raise tickets on help@dhan.co. It is not possible for us to debug this without details here.
This is literally the forum and people have been facing the same problem repeatedly yet the reply we keep getting is “at our end this is working.”
As clearly stated above, this flow was built for end users, not the internal team. So if multiple users continue to face the same issue where the only feedback is a generic “Something went wrong, Kindly contact system administrator” message, maybe it’s time to improve the error handling instead.
At the very least, the system should indicate what went wrong, whether the TOTP is invalid, expired, or if there’s some internal failure, so users know if they’re making a mistake or if it’s a backend issue. Right now, it’s impossible to tell.
Hey @Shashwat
The implication here was the facility is working as expected for all users. In case there are specific failures like this, it becomes difficult for us to resolve this here, given there is no way of personal identification and linking it back to your Dhan account.
There are error scenarios which might not be accounted for, hence requesting you to kindly drop a note at help@dhan.co. We will ensure that we connect with you and resolve this on priority.
Alternatively, you can also DM me your Client ID and I will connect with you on the same.
I don’t know why you guys are taking this complicated route. Just found out this in the docs and it makes this whole piece a cakewalk. It looks like this is only for individual algo traders like you and me, making life easier. There is always a way around if you know where to look.
My problem got solved with this solution- do try out, you guys try it out as well. And do let me know if you have any problem will try to solve it from my end
I tried. but received the following error :{“errorType”:“Input_Exception”,“errorCode”:“DH-905”,“errorMessage”:“Missing required fields, bad values for parameters etc.”}
I’ve already shared the requested logs and all required details (refer post #90 of current topic), but it’s been over 15 days and still no response.
It almost feels like the new process has been designed to test our patience and coding skills at the same time. ![]()
same
Hi @Shashwat Well this is the reason we have relied always on our own authentication systems as we know the exact answer and solve for it on priority. We prefer our own auth systems as we can solve concerns if any, quikcly.
When we enable third party authenticators via TOTP, we do not know which ones are being used and what configurations in place for that. When you shared the response, there is practically no way for us to replicate that, other than testing this on our side with a third-party auth product and confirming that this works.
We do monitor our auth systems, and failures get highlighted. We opened TOTP based only for API based users as an option.
@Hardik why dont you seperate access token for trading api and data api. Trading API access token expires in 24hrs while data api access token expires in 1 month for monthly subscription and 1 year for yearly subscription or it remains valid till subscription is cancelled.
Hi @Hardik any update / progress on this ?
905 error …
could you please share your code.
does this require static IP address
is any one else facing issues with daily historical data endpoint? it no longer returns the data?
Hey @Asif_Shaik
Welcome to MadeForTrade community!
What is the exact error that you are getting on this endpoint?
@Hardik
As a test I subscribed to Data API. Only 2 days could download LTP and on 30th Oct’25 9:15 onwards same code is returning
8:17:19 PM
Info
HTTP Response Code: 400
8:17:19 PM
Info
Full Raw Response Body: {“data”:{“814”:“Invalid Request”},“status”:“failed”}
Neither LTP nor OHLC data I am getting. Customer care is useless. As a test also I made the following Google Script:
function test_DhanApiDiagnosticProbe() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const credentialsSheet = ss.getSheetByName(“CREDENTIALS”);
const cred = Object.fromEntries(credentialsSheet.getRange(“A2:B” + credentialsSheet.getLastRow()).getValues().filter(r => r[0]));
const DHAN_DATA_API_ACCESS_TOKEN = cred[“Access Token”];
const DHAN_CLIENT_ID = cred[“Client ID”];
Logger.log(--- 🎯 INITIATING DHAN DIAGNOSTIC PROBE as requested by Dhan Support ---);
try {
// — Step 1: Build the Definitive API Request (EXACTLY as requested by Dhan) —
const apiUrl = “https:-api.dhan.co/v2/marketfeed/ltp”; ( I changed // to - as link is not accepted)
// The precise, hardcoded payload suggested by the Dhan support team.
const payload = { "NSE_EQ": ["1333"] }; // Security ID for HDFCBANK
const options = {
'method': 'post',
'contentType': 'application/json',
'headers': {
'access-token': DHAN_DATA_API_ACCESS_TOKEN,
'client-id': DHAN_CLIENT_ID,
'Accept': 'application/json'
},
'payload': JSON.stringify(payload),
'muteHttpExceptions': true
};
Logger.log("--- Request Details ---");
Logger.log(`Request URL: ${apiUrl}`);
Logger.log(`Request Method: POST`);
Logger.log(`Payload Sent: ${JSON.stringify(payload)}`);
// --- Step 2: Execute the API Call ---
const response = UrlFetchApp.fetch(apiUrl, options);
// --- Step 3: THE DEFINITIVE FORENSIC ANALYSIS ---
// This is the most important part of the log for Dhan's team.
const responseCode = response.getResponseCode();
const responseBody = response.getContentText();
Logger.log("--- Forensic Log of Server Response ---");
Logger.log(`HTTP Response Code: ${responseCode}`);
Logger.log(`Full Raw Response Body:\n${responseBody}`);
Logger.log(`--- End of Forensic Log ---`);
// --- Step 4: The Definitive Conclusion ---
let result = {};
try {
result = JSON.parse(responseBody);
} catch(e) {
// Handle cases where the response is not valid JSON
}
if (responseCode === 200 && result.status === "success") {
const ltp = result.data["NSE_EQ"]["1333"].last_price;
Logger.log("--- ✅ CONCLUSION: TEST SUCCESS! ---");
Logger.log(`The Dhan API is working correctly. Received LTP for HDFCBANK (1333): ₹${ltp}`);
Logger.log("This proves that your Access Token, Client ID, and the basic connection are all VALID.");
Logger.log("The failure in the multi-ID request is likely caused by an invalid ID in the larger list.");
} else {
Logger.log("--- ❌ CONCLUSION: TEST FAILED ---");
Logger.log("The API call did not succeed, even for a single, known-good Security ID.");
Logger.log("This provides definitive evidence for the Dhan support team that the issue is likely related to your account's API access, IP whitelisting, or a server-side problem on their end.");
}
} catch (e) {
Logger.log(--- 💥 CRITICAL SCRIPT ERROR ---);
Logger.log(An unexpected error occurred within the Apps Script environment itself.);
Logger.log(Error Message: ${e.message});
Logger.log(“This type of error is typically not related to the Dhan API itself.”);
}
Logger.log(“—
DIAGNOSTIC PROBE COMPLETE —”);
}
Which is still returning the log as I copied before. Please note that the same access token is working as Trading API and I am successfully doing BUY/SELL in my Algo regularly.
Please reply at the earliest.
Thank You @Trishul_Devadiga ,
With your help I identified the issue.
I was using const payload = { “NSE_EQ”: [“1333”] };
Correct version is const payload = { “NSE_EQ”: [1333] };
Security ID should be in number.