Prepare sell-back

POST /api/v1/mystery/sellback/prepare packs:buyback

Returns unsigned calldata for the holder to sign from their own wallet — CardOS never holds the NFT and never broadcasts for them. Up to two calls: a one-time Card.setApprovalForAll (included only when approval_needed; the pool does safeTransferFrom inside the sale, so without it the whole tx reverts, and it never needs repeating for that wallet), then MysteryComboPool.acceptCardBuyback. min_total_usdc is on-chain slippage protection: the pool re-reads the oracle at execution time, so a minimum equal to the quote reverts on any downward drift — the default allows 1%. Every token must be eligible or this fails 409, because the on-chain call is all-or-nothing.

Try it POST /api/v1/mystery/sellback/prepare write

These inputs are shared across all docs pages, so an id entered here carries over.

request body
object · 2 keys
{
  "wallet_address": "0x0000000000000000000000000000000000000000",
  "token_ids": []
}
response

Not run yet. Press Run to make a live call against https://service.rip.fun (through this demo's server-side proxy; the API key never reaches the browser).

tracks the inputs above
curl -X POST 'https://service.rip.fun/api/v1/mystery/sellback/prepare' \
  -H 'X-API-Key: rip_…' \
  -H 'Content-Type: application/json' \
  -d '{"wallet_address":"0x0000000000000000000000000000000000000000","token_ids":[]}'

Request fields

FieldTypeRequiredDescription
wallet_addressstringyesThe holder signing the sale
token_idsstring[]yesCards to sell (max 50, all must be eligible)
min_total_usdcstringMinimum acceptable total; defaults to the quote less 1%
slippage_bpsintAlternative to min_total_usdc — tolerance in bps (default 100)

Response fields (data)

FieldDescription
calls[]to / data / kind / description, in order — send them from the holder’s wallet. kind is machine-readable: set-approval-for-all (present only when the one-time approval is missing), then sellback
min_total / min_total_usdcThe slippage floor encoded into the call
quoted_payout_usdcWhat the quote said at prepare time

Errors

StatusCodeWhen
409window_expireda card’s buyback window has closed — it can never be sold back
409wrong_holderthe wallet is not the card’s original recipient
409value_unknownthe oracle has no price for the card’s group (the contract would revert)
409insufficient_liquiditythe buyback pool cannot cover the payout right now

See Errors for the response envelope and the full code list.

Flow

  1. You: POST /sellback/quote → confirm every card is eligible
  2. You: POST /sellback/prepare → calls[]
  3. Holder: sign and send the calls from their own wallet
  4. You: POST /sellback/submit with the tx hash
  5. Webhook: sellback.confirmed