POST /api/v1/partner/bets
Place a bet in a prediction market on behalf of one of the partner's users. The stake is debited from the partner's float account, and the position is opened on the Yoyo Market (hereinafter “Yoyo”) sub-account mapped to external_user_id.
Amounts are integers in kopecks, where 1 RUB = 100 kopecks. See Money Format for the money and price conventions used across the API.
Authentication
Required. Partner API key in X-Partner-Key header, not a Bearer token. See Partner Integration.
Request
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
external_user_id | string | Yes | Identifier of the user in the partner's own system. The user is mapped to a Yoyo sub-account automatically. |
market_id | int64 | Yes | ID of the market to bet in. |
side | string | Yes | Side to buy: "yes" or "no". |
amount_kopecks | int | Yes | Stake in kopecks. Debited from the partner's float account. |
client_bet_id | string | Yes | The partner's unique idempotency key for this bet. |
Market IDs are returned by Get Markets By Pool, which lists the markets of a pool; the pool IDs themselves come with each event in Get All Events.
Example
curl -X POST https://yoyo.market/api/v1/partner/bets \
-H "X-Partner-Key: <partner_key>" \
-H "Content-Type: application/json" \
-d '{
"external_user_id": "user_42",
"market_id": 12345,
"side": "yes",
"amount_kopecks": 50000,
"client_bet_id": "bet_abc_001"
}'
Response
200 OK
{
"status": "accepted",
"client_bet_id": "bet_abc_001",
"external_user_id": "user_42",
"user_id": 987654,
"market_id": 12345,
"side": "yes",
"cost_kopecks": 50000,
"shares_delta": 91234,
"fee_bps": 300
}
The resulting position goes into the shared LMSR pool, the same pool that backs regular platform trades. See LMSR AMM. The position can be closed later with Sell Position.
Response Fields
| Field | Type | Description |
|---|---|---|
status | string | "accepted" when the bet was placed. |
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 Yoyo sub-account mapped to external_user_id. |
market_id | int64 | Market the bet was placed in. |
side | string | Side that was bought: "yes" or "no". |
cost_kopecks | int | Amount charged to the float account, in kopecks. |
shares_delta | int | Number of shares added to the position. 100 shares = 1 token. |
fee_bps | int | Trade fee in basis points. |
How trade fees are applied on the platform is described in Fees and Commissions.
Idempotent Repeat
Repeating a request with a client_bet_id that was already accepted returns the following body. The bet is not placed a second time and the float account is not debited again.
{
"status": "already_accepted",
"client_bet_id": "bet_abc_001"
}
See Partner Integration for the full idempotency contract.
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 | BET_LIMIT | The stake is above the partner's per-bet limit. |
| 400 | TRADE_FAILED | The trade was rejected, for example because the market is closed. |
| 402 | INSUFFICIENT_FLOAT | The float account does not have enough funds. Top it up. |
| 500 | RESOLVE_USER_FAILED | The sub-account could not be created or found. |
| 500 | RECORD_FAILED | Internal write error. |
The authentication errors shared by every partner endpoint are listed in the Overview, and the full catalogue is in Error Handling.