API Reference
Initialize Swap [POST]

Initialize Swap


https://sandboxapi.onbrails.com/api/v1/wallets/initialize-swap (opens in a new tab)

Initialize a currency swap

Body Parameters

ParametertypeRequired
sourceCurrencystring
amountstring
targetCurrencystring

Request

Wallets/Initialize Swap [POST]
curl --request POST \
   --url https://sandboxapi.onbrails.com/api/v1/wallets/initialize-swap \
   --header 'Authorization: Bearer YOUR_SECRET_KEY' \
   --header 'accept: application/json' \
   --header 'content-type: application/json' \
   --data '
{
"sourceCurrency": "string",
"amount": 0,
"targetCurrency": "string"
}
'

Responses

🟢 200 - Result example
{
"status": true,
"message": "Quote retrieved successfully",
"data": {
  "sourceAmount": "10",
  "targetAmount": "11500.00",
  "id": "4996aa57-602c-417b-ac51-bee4617d6ddc",
  "fee": "0",
  "amount": "11500.00",
  "createdAt": "2023-12-12T23:11:01.239Z",
  "usdAmount": "10",
  "updatedAt": "2023-12-12T23:11:01.239Z",
  "expiration": "2023-12-12T23:15:11.000Z",
  "sourceCurrency": "usd",
  "targetCurrency": "ngn",
  "expirationInSec": "250",
  "conversionRate": {
    "amount": "1150",
    "currency": "ngn"
  }
}
}