Skip to content

Quote Transaction ​

Returns the exact total that Create Transaction with the same body would charge right now, and writes nothing. Unlike Calculate, which shows the published tariff, this is the figure the purchase is priced at.

For an energy order larger than the largest energy service (up to 20 000 000 per order), the answer also lists the parts the order will be filled in. To hold the purchase to this figure, send the returned amount back as expected_amount on /v1/transaction/new — optional; recommended for a large order.

POST /v1/transaction/quote

Request ​

The body is the Create Transaction body: service, params (and external_id, which is ignored here). It is validated in the same order with the same error codes.

json
{
  "service": "energy",
  "params": {
    "address": "TRX_ADDRESS",
    "amounts": { "energy": 10000000 },
    "duration": 1
  }
}

Response ​

FieldTypeDescription
result.servicestringThe service quoted
result.amountsobject|nullThe resource amounts quoted
result.durationintegerDuration in hours
result.amountstringThe total in TRX — every part, and the activation if one is included
result.activationbooleanWhether the total includes activating the address
result.partsarray|nullThe parts of a large energy order: resource_amount and amount (TRX) each; null for an order filled in one part
json
{
  "code": 0,
  "request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
  "result": {
    "service": "energy",
    "amounts": { "energy": 10000000 },
    "duration": 1,
    "amount": "601.200000",
    "activation": false,
    "parts": [
      { "resource_amount": 4000000, "amount": "240.480000" },
      { "resource_amount": 4000000, "amount": "240.480000" },
      { "resource_amount": 2000000, "amount": "120.240000" }
    ]
  }
}

A quote is a moment, not a reservation: prices move. If the order then prices differently, /v1/transaction/new with expected_amount refuses it with code 409 price_moved and charges nothing.

This endpoint counts against the same quote budget as Calculate and Estimate Energy.

Possible Errors ​

The errors of Create Transaction that happen before payment: 1, 2, 10, 11, 12, 24, 25, 35, 50, 429 when the quote budget is spent, 503 temporarily_unavailable when the TRON network did not answer the address check in time (HTTP 503, with a Retry-After header; retry in a moment), and 500.

Tron Energy API Documentation