Futures API how to close at market price (like the "market" button uder the section "close")

Hi,

I just simply want to CLOSE a opened position at market price without extra features…
Example in the futures website portion : there is a section “close” and a button “market”
when we hit the market button => it instantly close the position no matter what…

I want the EXCAT behaviour that this market close button via the API.

** I can OPEN a position at market price with this:
symbol=BTCUSDT&side=SELL&positionSide=SHORT&type=MARKET&quantity=0.01

** But when I try to close it with this

without stopPrice:
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true
I get Stop price less than zero.

with stopPrice :
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true&stopPrice=30895.00
I get Order’s position side does not match user’s setting.

different type:
symbol=BTCUSDT&side=SELL&type=STOP&closePosition=true&stopPrice=30895.00
ProfitTarget strategy invalid for orderType STOP

what’s wrong or what parameter I’m missing ???

After discussion with support I found out i mixed the BUY, SELL …

OPEN SHORT
symbol=BTCUSDT&side=SELL&positionSide=SHORT&type=MARKET&quantity=0.01

CLOSE SHORT
symbol=BTCUSDT&side=BUY&positionSide=SHORT&type=MARKET&quantity=0.01

OPEN LONG
symbol=BTCUSDT&side=BUY&positionSide=LONG&type=MARKET&quantity=0.01

CLOSE LONG
symbol=BTCUSDT&side=SELL&positionSide=LONG&type=MARKET&quantity=0.01