Exchange Request

Effortlessly initiate currency conversions for a specific amount from one cryptocurrency to another in real-time, receiving your desired currency at the prevailing global market price. To explore the available conversion options, refer to the exchange pairs endpoint, which provides a comprehensive list of supported currency pairs for seamless transactions. Whether you're swapping Bitcoin for Tether or Tether for Litecoin, this feature ensures quick and accurate conversions at the current market rates.

POST https://api.oxapay.com/exchange/request

To use this endpoint, you need to make a POST request to the specified URL with the required parameters. The typical parameters for this request include:

Request Body

NameTypeDescription

key*

string

Your general API key for authentication and authorization.

toCurrency*

string

The currency code of the cryptocurrency you want to convert to

fromCurrency*

string

The currency code of the cryptocurrency you want to convert from

amount*

decimal

The amount of cryptocurrency to you want to exchange

{
  "result": integer, // The result code indicates the success or failure of the request.
  "message": string, // A message providing additional information about the result.
  "trackId": string, // The unique identifier for the payout request in the OxaPay payment gateway. 
  "status": string // The current status of the payout (Processing, Sending, Complete, or Rejected).
  "amount": string, // The amount you want to exchange
  "fromCurrency": string, // The currency code of the cryptocurrency you want to convert from
  "toCurrency": string, // The currency code of the cryptocurrency you want to convert to
  "toAmount": string, // The amount you'll receive in your desired cryptocurrency.
  "rate": string, // The real-time exchange rate representing the number of units of `fromCurrency` equivalent to `toCurrency`.
  "date": string // exchange time
}

Please ensure that you provide the necessary parameters accurately in the request to create a exchange request successfully.

Please note that a successful request will return a result code 100. In case of any issues or validation problems, refer to the corresponding result codes for further details.

Example codes

curl -X POST https://api.oxapay.com/exchange/request \
-d '{
  "key": "YOUR_GENERAL_API_KEY",
  "amount": 0.5,
  "fromCurrency": "BTC",
  "toCurrency": "USDT"
}'

Replace YOUR_GENERAL_API_KEY with your actual API key and adjust the parameters as needed for your specific use case.

Last updated