Skip to main content

POST /api/v1/partner/sell

Sell the given number of shares on behalf of one of the partner's users, closing all or part of a position opened with Place Bet.

The payout stays on the user's sub-account β€” it does not return to the float account. It can fund the user's next bets, or be read through Get User State.

Authentication​

Required. Partner API key in X-Partner-Key header.

Request​

Body Parameters​

ParameterTypeRequiredDescription
external_user_idstringYesIdentifier of the user in the partner's own system.
market_idint64YesID of the market to sell in.
sidestringYesThe side being sold: "yes" or "no".
sharesintYesNumber of shares to sell. 100 shares = 1 token.
client_bet_idstringYesThe partner's unique idempotency key for this sell.

Example​

curl -X POST https://api.intotes.com/api/v1/partner/sell \
-H "X-Partner-Key: <partner_key>" \
-H "Content-Type: application/json" \
-d '{
"external_user_id": "user_42",
"market_id": 12345,
"side": "yes",
"shares": 91234,
"client_bet_id": "sell_abc_001"
}'

Response​

200 OK​

{
"status": "accepted",
"client_bet_id": "sell_abc_001",
"external_user_id": "user_42",
"user_id": 987654,
"market_id": 12345,
"side": "sell_yes",
"payout_kopecks": 61000,
"shares_delta": -91234
}

The side field in the response is the executed trade direction β€” "sell_yes" or "sell_no" β€” not the side value sent in the request.

Response Fields​

FieldTypeDescription
statusstring"accepted" when the sell was executed.
client_bet_idstringThe idempotency key sent in the request.
external_user_idstringIdentifier of the user in the partner's own system.
user_idint64ID of the Intotes sub-account mapped to external_user_id.
market_idint64Market the shares were sold in.
sidestringExecuted trade direction: "sell_yes" or "sell_no".
payout_kopecksintPayout credited to the user's sub-account, in kopecks.
shares_deltaintChange in the position, negative for a sell. 100 shares = 1 token.

Idempotency​

The pair (partner, client_bet_id) is unique, so repeating a request with a client_bet_id that was already accepted does not execute the sell a second time.

The body returned on such a repeat is not documented for this endpoint. The documented repeat response is on Place Bet, and the full idempotency contract is in Partner Integration.

Notes​

  • Amounts are integers in kopecks, where 1 RUB = 100 kopecks. See Money Format.
  • The shares are sold into the shared LMSR pool, the same pool that backs regular platform trades. See LMSR AMM and Positions.

Errors​

StatusCodeDescription
400BAD_BODYThe request body is not valid JSON.
400BAD_PARAMSA required field is missing or invalid.
400TRADE_FAILEDThe trade was rejected, for example because the market is closed.
404NO_ACCOUNTThe user has no sub-account or no positions.

The authentication errors shared by every partner endpoint are listed in the Overview, and the full catalogue is in Error Handling.