Unable to place Exit order from API for CNC orders

I have placed CNC order from API, now i want to exit on same day from API.

When i place request it from api -

data = {
    "id":"NSE:ABCAPITAL-EQ-CNC"
}

response = fyers.exit_positions(data=data)
print(response)

I get response - {‘code’: 201, ‘message’: ‘Exit request has been sent. Kindly refresh your positions to check the status.’, ‘s’: ‘ok’}

But if i check in web portal i get rejected message - Sell Overnight/Invest orders only be placed if it is available in the holdings. Check for pending orders or missing eDIS authorisation.

Note : I have enabled DDPI

If i have taken some position to carry for next day selecting CNC order, but if i want to close it today itself from API, how to achieve it?

Hey @manju.663lrtyj ,

You will see this rejection message if you already have a pending counter order for the open position , please check it

thanks, after removing counter position it worked