is there way to cencel all positions at once? using api

i know that i can cancel all my open order but i dont know how to cancel all positons…

Cancel all Open Orders on a Symbol (TRADE)

DELETE api/v3/openOrders

Cancels all active orders on a symbol.
This includes OCO orders.

Weight: 1

Parameters

Name Type Mandatory Description
symbol STRING YES
recvWindow LONG NO The value cannot be greater than 60000
timestamp LONG YES
2 Likes

i am so sorry that i didn’t mentioned ‘not spot account but perpettual swap future account’…is there way???

Hi 111,

The people above have answered your question, but I also wanted to link the API documentation for future reference should you have future questions.

Spot Documentation

Perpetual Futures

DELETE /fapi/v1/allOpenOrders