Liquidate Positions
Authentication
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
Response
Non-empty if the request failed
Bearer authentication of the form Bearer <token>, where token is your auth token.
Non-empty if the request failed
Available to: All authenticated users
Environments: Demo, Live
Rate Limit: 500 requests per hour, 1-second back-off, counts all requests
Flattens several positions in a single request. For each position in the positions array, the endpoint cancels the working orders tied to that position and closes the remaining position with a market order. To flatten one position at a time by accountId and contractId, use liquidatePosition instead.
The request body requires positions (an array of position IDs, maximum 100 entries) and the admin boolean. Setting admin to true requires admin privileges; non-admin callers must send false. The optional customTag50 carries a registered tag, and isAutomated should be set to true when a code or automated process triggers the request and false only when a human triggers it directly.
Set isAutomated to true when this is triggered by code or an automated process, and false only when a human triggers it directly.
Each position is liquidated independently, so the request can partially succeed: some positions may flatten while others fail. The endpoint returns a SimpleResponse with an ok boolean and an errorText field. ok is true only when every position liquidated without error; if any position fails, ok is false and errorText reports the first failure encountered. Inspect each account’s positions afterward to confirm the final state.
Common Failure Scenarios
admin is true but the caller has no admin privileges.customTag50 is missing or unregistered.Error Messages
When ok is true, errorText is empty and all positions were flattened.