This morning I was running my daily scripts for data ingestion and ran into an issue with the daily historical data API endpoint.
Request:
curl --request POST \
--url https:// api.dhan.co / v2 / charts / historical \
--header 'access-token: [REDACTED]' \
--header 'content-type: application/json' \
--data '{
"securityId": "13",
"exchangeSegment": "IDX_I",
"instrument": "INDEX",
"expiryCode": 0,
"oi": false,
"fromDate": "2025-01-01",
"toDate": "2025-12-31"
}'
Response:
400 Bad Request along with the following response:
{
"errorType": "Input_Exception",
"errorCode": "DH-905",
"errorMessage": "Missing required fields, bad values for parameters etc."
}
This script has worked without issues until 24 hours ago. Something has changed in the API endpoint overnight.
I have already reached out to the support team via email [#4772731] and the suggested fix was that I include a timeframe field (which is now required, apparently) in the request. However, the issue remains unresolved.
The suggested request per support team below still produces the same error.
curl --request POST \
--url https: // api.dhan.co / v2 / charts / historical \
--header 'access-token: [REDACTED]' \
--header 'content-type: application/json' \
--data '{
"securityId": "13",
"exchangeSegment": "IDX_I",
"instrument": "INDEX",
"expiryCode": 0,
"oi": false,
"fromDate": "2025-01-01",
"toDate": "2025-12-31",
"timeframe": "1D"
}'
There is no mention of this required timeframe field in the official documentation here /docs/v2/historical-data/.
Please advise.
