Swap Calculate

This endpoint allows you to instantly calculate how much cryptocurrency you'll receive when swapping one currency for another. Designed for ease of use, it provides real-time rates to ensure accurate calculations. Simply integrate this feature into your app to access the latest rates anytime. Whether you're buying or selling, this endpoint simplifies the process by giving you quick and precise swap amounts for your desired currency.

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
post
import requests
import json

url = 'https://api.oxapay.com/v1/general/swap/calculate'

data = {
    "amount": 12,
    "from_currency": "USDT",
    "to_currency": "TRX"
}

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": {
    "to_amount": 94763.06,
    "rate": 94763.06,
    "amount": 1
  },
  "message": "Operation completed successfully!",
  "error": {},
  "status": 200,
  "version": "1.0.0"
}

Last updated