/api/v1/mystery/purchase packs:purchaseCustodial purchase: debits the end-user’s credit balance and a rip.fun relayer executes the on-chain buy — the user never signs anything. Requires an Idempotency-Key header; re-sending the same key returns the original purchase. Returns 202: fulfillment is asynchronous (VRF).
POST /api/v1/mystery/purchase money These inputs are shared across all docs pages — an id entered here carries over.
{
"external_user_id": "demo-explorer",
"tier_id": 1
}Not run yet — press Run to make a live call against https://staging-service.rip.fun (through this demo's server-side proxy; the API key never reaches the browser).
curl -X POST 'https://staging-service.rip.fun/api/v1/mystery/purchase' \
-H 'X-API-Key: rip_v1_…' \
-H 'Idempotency-Key: demo-demo-explorer-1' \
-H 'Content-Type: application/json' \
-d '{"external_user_id":"demo-explorer","tier_id":1}' | Field | Type | Required | Description |
|---|---|---|---|
external_user_id / wallet_address | string | yes | End-user identity (at least one) |
tier_id | number | yes | Tier to purchase |
max_price_usdc | string | — | Cap; user is debited the ACTUAL on-chain amount, difference returns to available |
Idempotency-Key | header | yes | Required; reuse with a different tier_id → 409 |
data)| Field | Description |
|---|---|
id / status / custody | Purchase id; starts RESERVED, custody CUSTODIAL |
price / price_usdc | Reserved amount (micros + decimal) |
| Status | Code | When |
|---|---|---|
| 400 | missing_idempotency_key | header omitted |
| 402 | insufficient_funds | available balance < price |
| 409 | idempotency_mismatch | same key reused with a different tier_id |
| 503 | relayer_disabled | custodial purchasing temporarily unavailable |
See Errors for the response envelope and the full code list.