Skip to main content
Close a single position on one trading account at market, for example when your risk team decides a trade must come off. The rest of the account is untouched: other positions stay open, the account keeps its status and the trader can keep trading. To close everything on an account at once, use POST /organization/trading-accounts/{accountId}/flatten. To cancel working orders and leave positions open, see Cancel orders without closing. Requires manage permission on traders.

Close a position

The contract in the path is the position’s contract symbol, as on the positions read and the real-time stream.

Whole or partial close

A whole-position close does for one contract what flatten does for the whole account.

Response

side is the position’s direction before the close. remainingQuantity is what is left open on the contract; closed is true when nothing is.

What else happens

The close is an ordinary market order. It fills at the market price with the usual commissions and updates the balance and rules like any other close.
  • Real-time stream: the usual OrderSubmitted, OrderFilled, PositionUpdate and AccountUpdate messages, and OrderCancelled for each cancelled order.
  • Order history: the orders carry reason Admin flatten: <who> — <your reason> and trigger admin_flatten, like a flatten.
  • Event log and webhooks: an ACCOUNT_UPDATED event with trigger admin_position_close, who closed it, the contract, the quantity closed, what remains and the number of cancelled orders, sent to account.updated webhook subscribers.

Market hours

A close is refused with 409 MARKET_CLOSED while the contract’s market is closed, for example during the daily break, at the weekend or on a holiday. Nothing is closed; send it again once the market is open.

Retries

Send an Idempotency-Key header. A retry with the same key and body returns the first response and never closes twice. Without a key, repeating a whole-position close is safe: once the position is gone it answers 404 NO_POSITION. Repeating a partial close without a key closes more. If the call ends with 504 CLOSE_OUTCOME_UNKNOWN, the position may or may not have been closed: read the account’s positions (GET /organization/trading-accounts/{accountId}/positions) before you retry.

Errors

Cancel orders without closing

Cancel an account’s working orders and leave every position open, for example to stop new entries while a trade is reviewed. The account keeps its status and the trader can keep trading.
The default matches a trader’s “Cancel all”. Requires manage permission on traders. Unlike a close, it also works while the market is closed.
ordersCancelled counts the orders this call cancelled; exitsKept the take-profit and stop-loss orders left working.
  • Real-time stream: an OrderCancelled message for each cancelled order.
  • Order history: the orders carry reason Admin cancel: <who> — <your reason> and trigger admin_flatten.
  • Event log and webhooks: when anything was cancelled, an ACCOUNT_UPDATED event with trigger admin_orders_cancel, who cancelled, the contract filter, include_exits and the counts, sent to account.updated webhook subscribers.
Retries are safe: a repeated call cancels nothing more and answers with ordersCancelled: 0. On 504 CANCEL_OUTCOME_UNKNOWN, some orders may have been cancelled; send the call again.