How to Liquidate All the Open Position via API

curl --location 'https://demo.tradovateapi.com/v1/order/liquidatePositions' \
--header 'Authorization: Bearer $TOKENVAL' \
--header 'Content-Type: application/json' \
--data '{
  "positions": [
    0
  ],
  "admin": true,
  "customTag50": "string"
}'

I am getting following error Access is denied error
I am following this document: Tradovate API

Same token is working for this API


curl --location 'https://demo.tradovateapi.com/v1/order/placeOrder' \
--header 'Authorization: Bearer $TokenVal' \
--header 'Content-Type: application/json' \
--data '{
    "accountId": 20012345,
    "accountSpec": "DEMO",
    "symbol": "NQM5",
    "orderQty": 1,
    "orderType": "Market",
    "action": "Sell",
    "isAutomated": false
}'

it seems to be missing account info

I’ve passed that as well.
Response Body

Access is denied

Show raw log

JSONError: Unexpected token ‘A’ at 1:1Access is denied^

same setup is working for oither request

curl --location 'https://demo.tradovateapi.com/v1/order/liquidatePositions' \
--header 'Authorization: Bearer $TokenVal' \
--header 'Content-Type: application/json' \
--data '{
  "accountId": 20012324,
  "positions": [
    0
  ],
  "admin": true,
  "customTag50": "string"
}'

you first have to get a position list and then use that instead of 0 to close it