Skip to main content

POST /api/v1/market/positions/{market_id}/close

Close the authenticated user's position in a given market. This creates a market order to sell all held shares at the current best available price.

Authentication​

Required. Bearer token in Authorization header.

Request​

Path Parameters​

ParameterTypeRequiredDescription
market_idint64YesID of the market to close the position in.

Example​

curl -X POST https://intotes.com/api/v1/market/positions/42/close \
-H "Authorization: Bearer <token>"

Response​

200 OK​

{
"message": "Position closed successfully"
}

The shares are sold at the current market price (via the orderbook and/or LMSR AMM), and the proceeds are credited to the user's balance.

Errors​

StatusCodeDescription
404POSITION_NOT_FOUNDNo open position found for this user in the market.
409MARKET_PAUSEDThe market is currently paused for trading.