I cannot close my long position by fapi ("code": Number(-2019), "msg": String("Margin is insufficient."))

I open long position and the price goes high.
So my program order sell position for the exact same quantity of the long position to close the position.
However, I receive error message : {“code”: Number(-2019), “msg”: String(“Margin is insufficient.”)}
I tried both limit and market sell order, but received the same message.
What is the poblem and how can I solve it?

long order parameters:
symbol={}&side=BUY&type=MARKET&quantity={}&timestamp={}

short limit paramters:
symbol={}&side=SELL&type=LIMIT&quantity={}&price={}&timeInForce=GTC&timestamp={}

short market paramters:
symbol={}&side=SELL&type=MARKET&quantity={}&timestamp={}

Hey,
The error Margin is insufficient indicates that there isn’t enough margin balance to place the order. Please check your available balance and leverage before attempting again. Have a look at the article below for more details on margin requirements: