Skip to main content
POST
/
v1
/
cashout-requests
curl -X POST https://api.totalis.trade/v1/cashout-requests \
  -H "X-API-Key: $TOTALIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "position_id": "9f86d08818844f86d08818844f86d088" }'
{
  "data": {
    "cashout_request": {
      "id": "c3d4e5f6-7890-abcd-ef12-34567890abcd",
      "user_id": "did:privy:cm3abc...",
      "target_mm_id": "mm-uuid-1234",
      "position_id": "9f86d08818844f86d08818844f86d088",
      "position_pda": "7Xc3...PDA",
      "user_stake": 24.75,
      "total_payout": 100,
      "version": 1,
      "book_seq": 0,
      "status": "active",
      "expires_at": "2026-06-01T18:46:00.000Z",
      "position_expires_at": "2026-06-02T00:00:00.000Z",
      "legs": [
        { "id": "8ccf2c5d-3a61-4707-93f2-b6f0a0f0c0c6", "market_ticker": "KXBTC-26JUN01-T72500", "event_ticker": "KXBTC-26JUN01", "side": "yes", "venue": "kalshi" },
        { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "market_ticker": "KXBTC-26JUN01-T73000", "event_ticker": "KXBTC-26JUN01", "side": "no", "venue": "kalshi" }
      ]
    }
  }
}
Open a cashout request to close an active on chain position early instead of waiting for settlement. The request is offered to the position’s single counterparty market maker, who responds with a live buyback quote on the stream. Accepting that quote via Commit drives the buyback on chain and flips the RFQ to bought_back. The request is keyed on the position’s on chain position_id — a 16 byte hex string (the 0x prefix is optional). The position must be active (executed), owned by you, have a counterparty MM assigned, and not be within the near expiry buffer of its market end.

Authentication

API key required. Pass your API key in the X-API-Key header.
X-API-Key: <your-api-key>
A Privy JWT (Authorization: Bearer <jwt>) is also accepted — see Authentication.

Request body

position_id
string
required
The position’s on chain id — a 16 byte hex string (32 hex chars), with or without a 0x prefix.

Response

data
object

Errors

StatusCodeDescription
400VALIDATION_ERRORBody is not valid JSON, or position_id is not a 16 byte hex string. See details.issues.
401UNAUTHORIZEDMissing or invalid API key.
404NOT_FOUNDPosition not found, or not owned by you.
409CONFLICTPosition is not active, too close to expiry, or has no counterparty MM wallet assigned yet.
503SERVICE_UNAVAILABLEEligibility/economics read failed, or no counterparty MM is resolvable yet; retry.
curl -X POST https://api.totalis.trade/v1/cashout-requests \
  -H "X-API-Key: $TOTALIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "position_id": "9f86d08818844f86d08818844f86d088" }'
{
  "data": {
    "cashout_request": {
      "id": "c3d4e5f6-7890-abcd-ef12-34567890abcd",
      "user_id": "did:privy:cm3abc...",
      "target_mm_id": "mm-uuid-1234",
      "position_id": "9f86d08818844f86d08818844f86d088",
      "position_pda": "7Xc3...PDA",
      "user_stake": 24.75,
      "total_payout": 100,
      "version": 1,
      "book_seq": 0,
      "status": "active",
      "expires_at": "2026-06-01T18:46:00.000Z",
      "position_expires_at": "2026-06-02T00:00:00.000Z",
      "legs": [
        { "id": "8ccf2c5d-3a61-4707-93f2-b6f0a0f0c0c6", "market_ticker": "KXBTC-26JUN01-T72500", "event_ticker": "KXBTC-26JUN01", "side": "yes", "venue": "kalshi" },
        { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "market_ticker": "KXBTC-26JUN01-T73000", "event_ticker": "KXBTC-26JUN01", "side": "no", "venue": "kalshi" }
      ]
    }
  }
}