Swaps
Create Swap
Changed onSwaps one token for another in an account or user's wallet, or converts between their fiat balances at the mid-market rate. Crypto swaps finish in the background — retrieve the swap to follow its status.
post/swaps
Request
- Base URL: https://api.whop.com/api/v1
- URL: https://api.whop.com/api/v1/swaps
- Auth: one of:
- HTTP bearer
- HTTP bearer
- HTTP bearer
Headers
Idempotency-Keystring
Example:d9105228-4a08-46b1-8b91-42fed586d383
A unique key that makes this request safe to retry. See Idempotent requests.
Request body
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
Example response
{
"account_id": "biz_xxxxxxxxxxxxxx",
"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:swapwas added to the endpoint's security schemebearerAuth - info
the security scope
payout:transfer_fundswas removed from the endpoint's security schemebearerAuth
- info
- info
the security scope
crypto_wallet:swapwas added to the endpoint's security schemebearerAuth - info
the security scope
payout:transfer_fundswas removed from the endpoint's security schemebearerAuth
- info