Swap Request
This endpoint allows you to swap your account assets. You can swap one cryptocurrency for another instantly at the current market rate. To see the supported swap options, refer to the swap pairs endpoint. Whether you're swapping Bitcoin for Tether, Tether for Litecoin, or any other supported combination, this feature ensures secure and accurate asset swaps. Swaps are processed in real-time to provide you with the best available rates.
Your General API Key for authentication and authorization.
application/jsonSpecify the currency symbol you want to swap from.
Specify the currency symbol you want to swap to.
Specify the amount of currency you want to swap.
Successful operation
A message containing additional information about the result of the request.
The status of the request response. Typically provided as a numeric code (e.g., 200 for success or other codes for errors).
The version of the API being used.
Bad request
import requests
import json
url = 'https://api.oxapay.com/v1/general/swap'
data = {
"amount": 0.5,
"from_currency": "BTC",
"to_currency": "USDT"
}
headers = {
'general_api_key': 'YOUR_GENERAL_API_KEY',
'Content-Type': 'application/json'
}
response = requests.post(url, data=json.dumps(data), headers=headers)
result = response.json()
print(result){
"data": {
"track_id": "393831199",
"from_currency": "USDT",
"to_currency": "BTC",
"from_amount": 10,
"to_amount": 0.0001054,
"rate": 94876.66034156,
"date": 1736508792
},
"message": "Operation completed successfully!",
"error": {},
"status": 200,
"version": "1.0.0"
}Last updated