Skip to content

Calculate Price

POST /v1/orders/calculate

Returns the exact TRX price for a hypothetical order without creating one. Use this to show users the cost before they commit to a deposit.

This is a pure pricing endpoint — it does not touch the TRON network.

Request body

FieldTypeRequiredDescription
durationintegeryesResource rental duration in hours. Must be 1.
activationbooleannoIf true, include the account activation fee in total. Defaults to false.
resources.energyintegerno*Amount of energy to deliver.
resources.bandwidthintegerno*Amount of bandwidth to deliver.

* At least one of resources.energy or resources.bandwidth must be greater than zero.

Examples

bash
curl -X POST https://api.tronzap.com/v1/orders/calculate \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "duration": 1,
    "activation": false,
    "resources": {
      "energy": 65000,
      "bandwidth": 345
    }
  }'
javascript
const response = await fetch('https://api.tronzap.com/v1/orders/calculate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  },
  body: JSON.stringify({
    duration: 1,
    activation: false,
    resources: { energy: 65000, bandwidth: 345 },
  }),
})
const data = await response.json()
console.log(data.result.total, data.result.currency)
php
$response = file_get_contents('https://api.tronzap.com/v1/orders/calculate', false, stream_context_create([
  'http' => [
    'method' => 'POST',
    'header' => "Content-Type: application/json\r\nAccept: application/json",
    'content' => json_encode([
      'duration' => 1,
      'activation' => false,
      'resources' => ['energy' => 65000, 'bandwidth' => 345],
    ]),
  ],
]));
$data = json_decode($response, true);
echo $data['result']['total'] . ' ' . $data['result']['currency'];
python
import requests

resp = requests.post('https://api.tronzap.com/v1/orders/calculate', json={
    'duration': 1,
    'activation': False,
    'resources': {'energy': 65000, 'bandwidth': 345},
})
result = resp.json()['result']
print(result['total'], result['currency'])

Response

json
{
  "code": 0,
  "request_id": "550e8400-e29b-41d4-a716-446655440000",
  "result": {
    "energy":     { "amount": 65000, "price": 2.34 },
    "bandwidth":  { "amount": 345,   "price": 0.35 },
    "activation": { "required": false, "price": 0 },
    "total": 2.69,
    "currency": "TRX",
    "duration": 1
  }
}

With activation: true (activating a new account):

json
{
  "code": 0,
  "request_id": "550e8400-e29b-41d4-a716-446655440000",
  "result": {
    "energy":     { "amount": 65000, "price": 2.34 },
    "bandwidth":  { "amount": 345,   "price": 0.35 },
    "activation": { "required": true, "price": 1.40 },
    "total": 4.09,
    "currency": "TRX",
    "duration": 1
  }
}

Response fields

FieldTypeDescription
energy.amountintegerEcho of the requested energy amount.
energy.pricenumberTRX cost for the energy.
bandwidth.amountintegerEcho of the requested bandwidth amount.
bandwidth.pricenumberTRX cost for the bandwidth.
activation.requiredbooleanEcho of the activation flag you sent.
activation.pricenumberTRX cost of activation. 0 when not requested.
totalnumberSum of energy + bandwidth + activation prices.
currencystringAlways TRX.
durationintegerEcho of the requested duration.

total matches create-order amount

The total from this endpoint equals the amount that POST /v1/orders will require, given the same inputs and matching activation outcome.

TronZap Partner Documentation