Based on this answer, this is correct:
POST /fapi/v1/leverage with {‘symbol’: ‘ETHUSDT’, ‘leverage’: 2}
POST /fapi/v1/order with {‘symbol’: ‘ETHUSDT’, ‘side’: ‘BUY’, ‘quantity’: xx, …}
WAIT FOR SOME TIME ...
POST /fapi/v1/leverage with {‘symbol’: ‘ETHUSDT’, ‘leverage’: 2}
POST /fapi/v1/order with {‘symbol’: ‘ETHUSDT’, ‘side’: ‘SELL’, ‘quantity’: xx, …}
what's important to understand is that when you are using leverage what changes is the "used balance".
For example if you want to sell 1 ETH with price 3000 USDT and 2x leverage, what changes is your free USDT balance will have less 1500 USDT instead of the 3000 USDT if you had no leverage.
To check your open positions leverage use THIS:
GET /fapi/v2/positionRisk