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β
| Parameter | Type | Required | Description |
|---|---|---|---|
external_user_id | string | Yes | Identifier of the user in the partner's own system. |
market_id | int64 | Yes | ID of the market to sell in. |
side | string | Yes | The side being sold: "yes" or "no". |
shares | int | Yes | Number of shares to sell. 100 shares = 1 token. |
client_bet_id | string | Yes | The 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β
| Field | Type | Description |
|---|---|---|
status | string | "accepted" when the sell was executed. |
client_bet_id | string | The idempotency key sent in the request. |
external_user_id | string | Identifier of the user in the partner's own system. |
user_id | int64 | ID of the Intotes sub-account mapped to external_user_id. |
market_id | int64 | Market the shares were sold in. |
side | string | Executed trade direction: "sell_yes" or "sell_no". |
payout_kopecks | int | Payout credited to the user's sub-account, in kopecks. |
shares_delta | int | Change 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β
| Status | Code | Description |
|---|---|---|
| 400 | BAD_BODY | The request body is not valid JSON. |
| 400 | BAD_PARAMS | A required field is missing or invalid. |
| 400 | TRADE_FAILED | The trade was rejected, for example because the market is closed. |
| 404 | NO_ACCOUNT | The 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.