uppert
June 11, 2026, 10:19am
1
I am not able to place forever order using API or Python Library, here is my code snippet. Please suggest what is wrong
url = "https://api.dhan.co/v2/forever/orders"
headers = {"access-token": <ACCESS_TOKEN>, "Content-Type": "application/json", "Accept": "application/json"}
payload = {"dhanClientId": "1111967573",
"orderFlag": "SINGLE",
"transactionType": "SELL",
"exchangeSegment": "NSE_EQ",
"productType": "CNC",
"orderType": "LIMIT",
"validity": "DAY",
"securityId": "3499",
"quantity": 1,
"disclosedQuantity": 1,
"price": 189.55,
"triggerPrice": 190.5}
res = requests.post(url, headers=headers, json=payload)
I tried to place the same order using python library but it is not going through, able to put the same using dhan app though
Hi @uppert
can you also share the error you are getting
Also are you sending the order from the same server, which is registered in
Dhan api page > static ip panel
uppert
June 11, 2026, 12:10pm
3
Hi @Tradehull_Imran
Here is the error message
b’{“errorType”:“Order_Error”,“errorCode”:“DH-906”,“errorMessage”:“Incorrect request for order and cannot be processed”}’
I am running this on Dhan cloud, the normal order I am able to put through API on this, getting error only for this. Doesn’t seem like an ip issue
Hi @uppert
yes this is not a IP issue,
try use below code , it worked fine on my end
{
"dhanClientId": "2601292566",
"orderFlag": "SINGLE",
"transactionType": "BUY",
"exchangeSegment": "NSE_EQ",
"productType": "CNC",
"orderType": "LIMIT",
"validity": "DAY",
"securityId": "3499",
"quantity": 5,
"price": 189.55,
"triggerPrice": 190.5
}
uppert
June 11, 2026, 5:11pm
5
Thanks @Tradehull_Imran
Its working for ‘BUY’, but not for ‘SELL’, any potential reason for that?
I think this may be a DDPI activation issue