Swaps

Swaps one token for another in an account or user's wallet, or converts between their fiat balances. Crypto swaps finish in the background — retrieve the swap to follow its status.

post/swaps

Request

  • Base URL
    https://api.whop.com/api/v1
  • Auth
    • HTTP bearer
    • or HTTP bearer
    • or HTTP bearer

Headers

Api-Version-Date, string
Example:2026-11-30

Pins the request to a dated API version.

Idempotency-Key, string
Example:d9105228-4a08-46b1-8b91-42fed586d383

A unique key that makes this request safe to retry. See Idempotent requests.

Request body

object required
account_id, string

Business account that makes the swap, prefixed biz_. Provide this or user_id.

amount, string nullable

Source token amount. Required for a crypto pair: a decimal amount, or all to swap the whole from_token balance in the account's wallet, read from the chain when the swap is created (any token but USDT). An amount above that balance is rejected when the balance can be read. For fiat pairs: the amount of from_token to convert; omit (along with to_amount) to repay the full negative to_token balance instead.

from_chain, union

Source chain name or chain ID. Defaults to the source token's chain when omitted.

from_token, string required

Source token contract address or ticker symbol, such as "USDT".

slippage_bps, integer nullable

Maximum slippage tolerance in basis points.

to_amount, string nullable

Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount.

to_chain, union

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

to_token, string required

Destination token contract address or ticker symbol, such as "XAUT".

user_id, string

The caller's own user ID, prefixed user_, to swap in their personal account. Provide this or account_id.

Example request

{
  "account_id": "biz_xxxxxxxxxxxxxx",
  "amount": "100",
  "from_chain": "plasma",
  "from_token": "usd",
  "slippage_bps": 50,
  "to_amount": "180.00",
  "to_chain": "plasma",
  "to_token": "cad"
}

Response

swap created

object required
account_id, string required

Account that owns the swap: a business ID prefixed biz_, or the user ID for a personal account.

amount, string nullable

Crypto pairs only: the from_token amount the swap spends, as a decimal string. A request for all returns the wallet balance it read.

amount_in, number nullable

Fiat pairs only: amount of the source currency converted. Null while the conversion is settling.

amount_out, number nullable

Fiat pairs only: amount credited in the destination currency. Null while the conversion is settling.

amount_out_expected, string

Expected destination token amount.

amount_out_min, string

Minimum destination amount after slippage.

from_token, object nullable

Fiat pairs only: the source currency.

id, string

Swap ID. Poll GET /swaps/:id for status.

object, 'swap' required
rate, string

Quoted exchange rate used to create the swap.

status, 'queued' | 'working' | 'complete' | 'failed' required

Swap status. Crypto swaps start queued. Fiat conversions return complete, or working while the conversion settles.

to_chain, string

Destination chain for the swap.

to_token, object nullable

Fiat pairs only: the destination currency.

user_id, string nullable required

User whose personal account owns the swap, prefixed user_. Null for a business account.

Example response

{
  "account_id": "biz_xxxxxxxxxxxxxx",
  "amount": "100.0",
  "amount_in": 131.4,
  "amount_out": 180,
  "amount_out_expected": "98.9",
  "amount_out_min": "98.4",
  "from_token": {
    "symbol": "usd"
  },
  "id": "vault-swap-cwal_xxxxxxxxxxxxxx",
  "object": "swap",
  "rate": "0.989",
  "status": "queued",
  "to_chain": "ethereum",
  "to_token": {
    "symbol": "cad"
  }
}

Changes

    • info

      the security scope crypto_wallet:swap was added to the endpoint's security scheme bearerAuth

    • info

      the security scope payout:transfer_funds was removed from the endpoint's security scheme bearerAuth

    • info

      the security scope crypto_wallet:swap was added to the endpoint's security scheme bearerAuth

    1 more change in this revision