Swaps
Exchange supported cryptocurrencies within your Ivorypay business wallet using the IVB swap API.
Exchange one cryptocurrency for another directly within your Ivorypay business wallet: no external transfers required.
Base path: /v1/crypto-swap
Authentication: API Key (Authorization: <secret-key>)
Endpoints
POST
/v1/crypto-swap/estimate
Preview a swap rate without executing it
POST
/v1/crypto-swap/initiate
Execute a crypto-to-crypto swap
POST /v1/crypto-swap/estimate
Returns the estimated output amount, conversion rate, and fee for a proposed swap. No funds are moved during estimation.
Request
Headers
Authorization: <your-secret-api-key>
Content-Type: application/jsonBody
{
"sourceCurrency": "USDT",
"targetCurrency": "BTC",
"amountInSourceCurrency": 100
}targetCurrency
string
Yes
Token you want to swap to. Must differ from sourceCurrency.
amountInSourceCurrency
number
Yes
Amount in the source token. Must be a positive number.
Response
sourceCurrency
string
Token being swapped from
targetCurrency
string
Token being swapped to
amountInSourceCurrency
number
Amount you're swapping
amountInTargetCurrency
number
Estimated amount you will receive
feeInSourceCurrency
number
Platform fee deducted from source amount
conversionRate
number
Exchange rate at time of estimation
Error Responses
400
The source currency must be different from the target currency
Same token for source and target
400
Your <token> wallet is inactive. Please enable.
Wallet is disabled
400
Insufficient balance
Not enough funds for the swap + fee
401
Unauthorized
Missing or invalid API key
POST /v1/crypto-swap/initiate
Executes the swap. Debits amountInSourceCurrency + fee from your source wallet and credits the converted amount to your target wallet.
Request
Headers
Body
sourceCurrency
string
Yes
Token to swap from.
targetCurrency
string
Yes
Token to swap to. Must differ from sourceCurrency.
amountInSourceCurrency
number
Yes
Amount to swap in the source token.
reference
string
Yes
Your unique identifier for duplicate detection and reconciliation.
Response
Error Responses
400
The source currency must be different from the target currency
Same token for source and target
400
Duplicate transaction
A swap with the same reference already exists
400
Insufficient balance
Not enough funds for the swap + fee
400
Unable to retrieve swap conversion
Exchange rate service unavailable
401
Unauthorized
Missing or invalid API key
Swap Lifecycle
PENDING
Swap queued for processing
SUCCESS
Source wallet debited, target wallet credited
FAILED
Swap failed: no funds moved
Swaps are processed asynchronously. Use webhooks to get notified when a swap completes.
Supported Tokens
USDT
Tether USD
USDC
USD Coin
BTC
Bitcoin
ETH
Ethereum
SOL
Solana
Both
sourceCurrencyandtargetCurrencymust be tokens supported by your account. UseGET /v1/crypto-transfer/supported/network-tokensto see your enabled tokens.
Fee Structure
The platform fee is calculated dynamically by the conversion service at the time of the request and returned as feeInSourceCurrency in both the estimate and initiate responses. It is added to the source amount when calculating the total debit.
Use /v1/crypto-swap/estimate first to preview the exact amounts before executing.
Code Examples
Node.js
cURL
Python
Last updated