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.
post
Header parameters
general_api_keystringRequired
Your General API Key for authentication and authorization.
Content-TypestringRequiredDefault:
application/json
Body
from_currencystringRequired
Specify the currency symbol you want to swap from.
to_currencystringRequired
Specify the currency symbol you want to swap to.
amountnumber · decimalRequired
Specify the amount of currency you want to swap.
Responses
200
Successful operation
application/json
400
Bad request
application/json
post
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