Preview an order's cost
const url = 'https://trongas.ai/api/v1/orders/preview?volume=1&days=example&resource=energy';const options = {method: 'GET', headers: {'X-Api-Key': '<X-Api-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://trongas.ai/api/v1/orders/preview?volume=1&days=example&resource=energy' \ --header 'X-Api-Key: <X-Api-Key>'Price an order before placing it: resource price, the address-activation fee if target is not activated yet, the estimated saving versus burning TRX (energy only), your current TRX balance and availableTrx — the part of it an order may spend (your balance minus what your active automations hold for their next firing; null if it can’t be computed right now). Read-only — charges nothing. resource is energy (default) or bandwidth. 503 pricing.unavailable while the price is temporarily unknown — retry shortly.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters”Amount of the resource: energy units or bandwidth bytes. Limits: see GET /orders/options (orders) or GET /automations/options (automations).
Rental period (despite the name): 15m, 1h or 1d. Same values as duration elsewhere; see GET /orders/options.
energy or bandwidth. Defaults to energy where optional.
Recipient TRON address (T…). Lets the preview include the exact address-activation fee.
Responses
Section titled “ Responses ”OK
object
object
Examplegenerated
{ "priceTrx": "example", "baseCostTrx": "example", "commissionTrx": "example", "activationTrx": "example", "burnCostTrx": "example", "savingsPercent": "example", "balanceTrx": "example", "availableTrx": "example"}object
Examplegenerated
{ "priceTrx": "example", "baseCostTrx": "example", "commissionTrx": "example", "activationTrx": "example", "burnCostTrx": "example", "savingsPercent": "example", "balanceTrx": "example", "availableTrx": "example"}Service Unavailable