Initialize Crypto Swap
https://sandboxapi.bitnob.co/api/v1/wallets/initialize-crypto-swap (opens in a new tab)
Initialize a swap between cryptocurrencies or between a cryptocurrency and USD.
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| source | string | ✅ | Source currency (enum) |
| amount | number | ✅ | Amount to swap |
| target | string | ✅ | Target currency (enum) |
Allowed values for source and target: "trx", "usd", "bnb"
Request
Wallets/Initialize Crypto Swap [POST]
curl --request POST \
--url https://sandboxapi.bitnob.co/api/v1/wallets/initialize-crypto-swap \
--header 'Authorization: Bearer API-KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"source": "trx",
"amount": 399,
"target": "usd"
}
'Responses
🟢 200 - Result example
{
"status": true,
"message": "Quote retrieved successfully",
"data": {
"quote": {
"expiration": "2024-07-31T16:29:09.492Z",
"expirationInSec": "60",
"amount": 3.99,
"volume": 30.69230769,
"price": 0.13,
"expireTimestamp": 1722443349492,
"cryptocurrency": "TRX",
"__v": 0,
"description": "quote for selling $3.99 of TRX",
"action": "sell TRX",
"id": "66aa6619e3876fbfc108430e"
},
"quoteId": "66aa6619e3876fbfc108430e"
}
}