REST API for developers

TRON Energy API

The TRONAgg API lets your application buy TRON Energy for any TRON address programmatically. Quote the price with GET /estimate, place the order with POST /buy and track it with GET /order/{id}. Orders are paid from your prepaid TRONAgg balance, and the Energy is delegated to the receiver for 1 hour, usually within seconds.

POST/buy
curl -s -X POST https://tronagg.ai/api/v1/buy \
  -H "X-API-Key: $TRONAGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "receiver_address": "TYourReceiverAddress",
    "resource_amount": 65000
  }'
201Createdapplication/json
{
  "order_id": "<uuid>",
  "status": "<string>",
  "total_price_sun": <integer>,
  "total_price_trx": "<string>",
  "activation_fee_sun": <integer>,
  "balance_after_sun": <integer>,
  "energy_pass_energy": <integer>
}
Base URL
https://tronagg.ai/api/v1
Every path on this page is relative to it.
Authentication
X-API-Key
Keys start with ta_. The pricing endpoints need no key.
Format
JSON over HTTPS
Amounts in SUN; _trx fields are decimal strings.
Idempotency
Idempotency-Key
On POST /buy, a retry with the same key within 24 hours returns the original order.
Rate limit
1,000 requests/min
Per account, all keys together. Past it: 429 with Retry-After.
On this page

Rent TRON Energy in three requests

Quote the price, buy from your prepaid balance, then follow the order until the Energy is delegated to the receiver.

  1. 01GET/estimate

    Quote

    The total for an Energy amount and a receiver, any one-time activation fee, and the order-size limits.

  2. 02POST/buy

    Buy

    Paid from your balance. Send an Idempotency-Key; the order starts as PENDING.

  3. 03GET/order/{order_id}

    Track

    Poll every 2 to 3 seconds until COMPLETED or FAILED. A failed order is refunded.

Quote, buy and track an order

Each example quotes 65,000 Energy for a receiver, buys it with a fresh Idempotency-Key and checks the order status. Set TRONAGG_API_KEY in your environment and replace the receiver address first.

curl -s -G https://tronagg.ai/api/v1/estimate \
  -d resource_amount=65000 \
  -d receiver_address=TYourReceiverAddress \
  -H "X-API-Key: $TRONAGG_API_KEY"

ORDER_ID=$(curl -s -X POST https://tronagg.ai/api/v1/buy \
  -H "X-API-Key: $TRONAGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"receiver_address": "TYourReceiverAddress", "resource_amount": 65000}' \
  | jq -r .order_id)

curl -s "https://tronagg.ai/api/v1/order/$ORDER_ID" \
  -H "X-API-Key: $TRONAGG_API_KEY"
import { randomUUID } from "node:crypto";
import { setTimeout as sleep } from "node:timers/promises";

const BASE_URL = "https://tronagg.ai/api/v1";
const headers = { "X-API-Key": process.env.TRONAGG_API_KEY };
const receiver = "TYourReceiverAddress";

const quote = await fetch(
  `${BASE_URL}/estimate?resource_amount=65000&receiver_address=${receiver}`,
  { headers },
).then((res) => res.json());
console.log("Total:", quote.total_price_trx, "TRX");

const res = await fetch(`${BASE_URL}/buy`, {
  method: "POST",
  headers: {
    ...headers,
    "Content-Type": "application/json",
    "Idempotency-Key": randomUUID(),
  },
  body: JSON.stringify({ receiver_address: receiver, resource_amount: 65000 }),
});
const purchase = await res.json();
if (res.status !== 201) throw new Error(JSON.stringify(purchase.detail));

let order;
do {
  await sleep(3000);
  order = await fetch(`${BASE_URL}/order/${purchase.order_id}`, { headers })
    .then((r) => r.json());
} while (!["COMPLETED", "FAILED"].includes(order.status));
console.log(order.status, order.delegation_txids);
import os, time, uuid
import requests

BASE_URL = "https://tronagg.ai/api/v1"
HEADERS = {"X-API-Key": os.environ["TRONAGG_API_KEY"]}
receiver = "TYourReceiverAddress"

quote = requests.get(
    f"{BASE_URL}/estimate",
    headers=HEADERS,
    params={"resource_amount": 65000, "receiver_address": receiver},
).json()
print("Total:", quote["total_price_trx"], "TRX")

res = requests.post(
    f"{BASE_URL}/buy",
    headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
    json={"receiver_address": receiver, "resource_amount": 65000},
)
if res.status_code != 201:
    raise RuntimeError(res.json()["detail"])
order_id = res.json()["order_id"]

while True:
    time.sleep(3)
    order = requests.get(f"{BASE_URL}/order/{order_id}", headers=HEADERS).json()
    if order["status"] in ("COMPLETED", "FAILED"):
        break
print(order["status"], order["delegation_txids"])
package main

import (
	"bytes"
	"crypto/rand"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"os"
	"time"
)

const baseURL = "https://tronagg.ai/api/v1"

// call sends one request and decodes the JSON reply into out.
func call(method, path string, body any, idempotencyKey string, out any) int {
	var payload io.Reader
	if body != nil {
		data, err := json.Marshal(body)
		if err != nil {
			panic(err)
		}
		payload = bytes.NewReader(data)
	}
	req, err := http.NewRequest(method, baseURL+path, payload)
	if err != nil {
		panic(err)
	}
	req.Header.Set("X-API-Key", os.Getenv("TRONAGG_API_KEY"))
	if body != nil {
		req.Header.Set("Content-Type", "application/json")
	}
	if idempotencyKey != "" {
		req.Header.Set("Idempotency-Key", idempotencyKey)
	}
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	if err := json.NewDecoder(res.Body).Decode(out); err != nil {
		panic(err)
	}
	return res.StatusCode
}

func main() {
	receiver := "TYourReceiverAddress"

	var quote struct {
		TotalPriceTRX string `json:"total_price_trx"`
	}
	query := url.Values{"resource_amount": {"65000"}, "receiver_address": {receiver}}
	call(http.MethodGet, "/estimate?"+query.Encode(), nil, "", &quote)
	fmt.Println("Total:", quote.TotalPriceTRX, "TRX")

	key := make([]byte, 16)
	if _, err := rand.Read(key); err != nil {
		panic(err)
	}
	var purchase struct {
		OrderID string          `json:"order_id"`
		Detail  json.RawMessage `json:"detail"`
	}
	order := map[string]any{"receiver_address": receiver, "resource_amount": 65000}
	status := call(http.MethodPost, "/buy", order, hex.EncodeToString(key), &purchase)
	if status != http.StatusCreated {
		panic(string(purchase.Detail))
	}

	var state struct {
		Status          string   `json:"status"`
		DelegationTxIDs []string `json:"delegation_txids"`
	}
	for state.Status != "COMPLETED" && state.Status != "FAILED" {
		time.Sleep(3 * time.Second)
		call(http.MethodGet, "/order/"+purchase.OrderID, nil, "", &state)
	}
	fmt.Println(state.Status, state.DelegationTxIDs)
}
<?php
const BASE_URL = 'https://tronagg.ai/api/v1';

function call(string $method, string $path, ?array $body = null, array $headers = []): array
{
    $headers[] = 'X-API-Key: ' . getenv('TRONAGG_API_KEY');
    $ch = curl_init(BASE_URL . $path);
    if ($body !== null) {
        $headers[] = 'Content-Type: application/json';
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
    }
    curl_setopt_array($ch, [
        CURLOPT_CUSTOMREQUEST => $method,
        CURLOPT_HTTPHEADER => $headers,
        CURLOPT_RETURNTRANSFER => true,
    ]);
    $data = json_decode((string) curl_exec($ch), true);
    return [curl_getinfo($ch, CURLINFO_RESPONSE_CODE), $data];
}

$receiver = 'TYourReceiverAddress';

[, $quote] = call('GET', '/estimate?' . http_build_query([
    'resource_amount' => 65000,
    'receiver_address' => $receiver,
]));
echo 'Total: ', $quote['total_price_trx'] ?? '?', " TRX\n";

[$status, $purchase] = call('POST', '/buy', [
    'receiver_address' => $receiver,
    'resource_amount' => 65000,
], ['Idempotency-Key: ' . bin2hex(random_bytes(16))]);
if ($status !== 201) {
    throw new RuntimeException(json_encode($purchase['detail'] ?? $purchase));
}

do {
    sleep(3);
    [, $order] = call('GET', '/order/' . $purchase['order_id']);
} while (!in_array($order['status'], ['COMPLETED', 'FAILED'], true));
echo $order['status'], ' ', implode(', ', $order['delegation_txids']), "\n";

Try it without a key

The live price as JSON, straight from your terminal:

cURL
curl -s https://tronagg.ai/api/v1/pricing

Authentication

Every account endpoint needs an API key in the X-API-Key header. Create a key in the TRONAgg workspace under API Keys; keys start with ta_. Keep the key on your server, because it can spend your balance.

The pricing endpoints and the Energy estimator are public and need no key. You can also restrict a key to a list of IP addresses or CIDR ranges; a request from anywhere else gets 403 ip_not_allowed.

Integer amounts are in SUN (1 TRX = 1,000,000 SUN). Fields ending in _trx, and unit_price_sun, are decimal strings: parse them with a decimal type, not a float.

Request header
GET /api/v1/account HTTP/1.1
Host: tronagg.ai
X-API-Key: $TRONAGG_API_KEY

Endpoints

All paths are relative to https://tronagg.ai/api/v1. The core flow is quote, buy and track; the public endpoints need no key.

TRON Energy API endpoints
EndpointAuthWhat it does
GET/estimateAPI keyA price quote for resource_amount Energy: the unit price in SUN, the total, any one-time activation fee for receiver_address, and the order-size limits min_amount and max_amount.
POST/buyAPI keyBuys Energy for receiver_address from your balance and answers 201 with an order_id in status PENDING. Send an Idempotency-Key header so a retry never charges twice.
GET/order/{order_id}API keyThe order status, the total charged and the on-chain delegation transaction IDs, usually listed in delegation_txids once the order is COMPLETED.
GET/accountAPI keyYour TRX balance, the deposit address for topping it up with TRX or USDT (TRC-20), and your separate USDT balance with its conversion settings.
GET/pricingPublicThe live price per Energy unit in SUN next to the market average, and the TRX cost of 65,000 and 131,000 Energy orders.
GET/pricing/historyPublicOur price against the market average over time: hourly for up to 168 hours, or daily for up to 365 days.
GET/pricing/auto-energyPublicAutoEnergy plan pricing: the activation fee, the daily fee and the per-transfer charges.
GET/calculator/estimate-energyPublicSimulates a TRC20 transfer (USDT by default) between two addresses and returns the exact Energy it would use.

Order history, the balance ledger, deposits, webhooks and AutoEnergy subscriptions are covered in the full API reference.

GET /estimate

Get Estimate

API keyDocs page GET /estimate

Returns TRONAgg's current price for resource_amount Energy delivered for 1 hour — what POST /buy would charge your balance right now (your VIP price if you have one).

Parameters:

  • resource_amount — amount of Energy to buy (in Energy units, not TRX)
  • receiver_address (optional) — the address that will receive the Energy. Pass it to include the one-time account-activation fee when the address is not yet activated on TRON. Without it the quote leaves that fee out, while POST /buy still charges it.

The response includes the unit price in SUN, the total cost, any activation fee, and the order-size limits (min_amount / max_amount). Use it to preview costs before committing to a purchase.

Parameters

  • resource_amountintegerqueryrequired> 0

    Amount of Energy to quote, in Energy units (not TRX). POST /buy accepts amounts between min_amount and max_amount from this response.

  • resource_type"ENERGY" | "BANDWIDTH"queryoptionaldefault ENERGY

    Resource to quote: ENERGY (default) or BANDWIDTH. Any other value returns 400 unsupported_resource.

  • receiver_addressstringqueryoptional

    Address that will receive the Energy. When it is not yet activated on TRON, the one-time activation fee is added to the totals and returned in activation_fee_sun.

Response 200

  • durationstring

    Rental duration — always 1h.

  • unit_price_sunstring

    Price per Energy unit in SUN, as a decimal string. It can be fractional — parse it with a decimal type, not as an integer.

  • total_price_suninteger

    Total your balance would be charged, in SUN — includes activation_fee_sun.

  • total_price_trxstring

    The same total in TRX (decimal string).

  • activation_fee_suninteger

    One-time account-activation fee in SUN, included in the totals. Non-zero only when you pass a receiver_address that is not yet activated on TRON.

  • activation_fee_trxstring

    The activation fee in TRX (decimal string); "0" when there is none.

  • min_amountintegernullable

    Smallest resource_amount POST /buy accepts; null = no lower bound. Outside the bounds POST /buy returns 400.

  • max_amountintegernullable

    Largest resource_amount POST /buy accepts; null = no upper bound. Outside the bounds POST /buy returns 400.

  • energy_pass_energyinteger

    Energy units your Energy Pass would cover right now; the totals are what your balance pays for the rest. 0 without an active Energy Pass.

Status codes

200400401403422429503
200 Status

OK

400 Status

unsupported_resource or invalid_duration — an unknown resource_type, or a duration other than 1h.

401 Status

The X-API-Key header is missing, invalid or revoked. detail is a plain string: API key required, Invalid API key or User not found.

403 Status

The account is blocked (plain-string detail: Account is blocked), or ip_not_allowed — the request's source IP is outside this key's IP allowlist.

422 Status

Request validation failed (e.g. resource_amount missing or not above 0) — detail is an array of field errors.

429 Status

Rate limit exceeded — more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions). detail is a plain string; wait the number of seconds in Retry-After, then retry.

503 Status

service_unavailable — purchasing is temporarily unavailable.

curl -s -G https://tronagg.ai/api/v1/estimate \
  -d resource_amount=65000 \
  -d receiver_address=TYourReceiverAddress \
  -H "X-API-Key: $TRONAGG_API_KEY"
const params = new URLSearchParams({
  resource_amount: "65000",
  receiver_address: "TYourReceiverAddress",
});
const res = await fetch(`https://tronagg.ai/api/v1/estimate?${params}`, {
  headers: { "X-API-Key": process.env.TRONAGG_API_KEY },
});
console.log(res.status, await res.json());
import os

import requests

res = requests.get(
    "https://tronagg.ai/api/v1/estimate",
    headers={"X-API-Key": os.environ["TRONAGG_API_KEY"]},
    params={
        "resource_amount": 65000,
        "receiver_address": "TYourReceiverAddress",
    },
)
print(res.status_code, res.json())
200OK
{
  "duration": "<string>",
  "unit_price_sun": "<string>",
  "total_price_sun": <integer>,
  "total_price_trx": "<string>",
  "activation_fee_sun": <integer>,
  "activation_fee_trx": "<string>",
  "min_amount": <integer> | null,
  "max_amount": <integer> | null,
  "energy_pass_energy": <integer>
}

POST /buy

Buy Energy

API keyDocs page POST /buy

Purchase Energy for a receiver address. The cost is deducted from your account balance immediately — including a one-time account-activation fee (activation_fee_sun) when the receiver is not yet activated on TRON. The order starts as PENDING; Energy is typically delegated within seconds. Use the Get Order endpoint to poll for completion.

If your TRX balance is short and usdt_cover_shortfall is on (see GET /account), just enough of your USDT balance converts to TRX first (1% fee) and the purchase goes through. If the USDT can't cover the whole shortfall, nothing converts and the purchase is refused with insufficient_balance.

receiver_address is checked before anything is charged: an invalid address returns 400 invalid_address.

Send an Idempotency-Key header so that a retry after a timeout returns the original order instead of placing a second one — see Idempotency.

Parameters

  • Idempotency-Keystringheaderoptionalmax 128 characters

    Any unique string of up to 128 characters (a UUID works well). A retry with the same key within 24 hours returns the original order's response instead of placing a new order.

Request body · application/json

  • receiver_addressstringrequired

    TRON address that will receive the Energy delegation (base58, starts with T, 34 characters). Checked before anything is charged.

  • resource_amountintegerrequired> 0

    Amount of Energy to buy, within min_amount / max_amount from GET /estimate.

  • resource_type"ENERGY" | "BANDWIDTH"optionaldefault ENERGY

    Resource to buy: ENERGY (default) or BANDWIDTH. Any other value returns 400 unsupported_resource.

Response 201

  • order_idstring (uuid)

    Order UUID — pass it to GET /order/{order_id}.

  • statusstring

    Order status — PENDING for a newly placed order.

  • total_price_suninteger

    Total deducted from your balance, in SUN — includes activation_fee_sun.

  • total_price_trxstring

    Total deducted from your balance, in TRX (decimal string).

  • activation_fee_suninteger

    One-time account-activation fee in SUN, included in the total. Non-zero only when the receiver was not yet activated on TRON.

  • balance_after_suninteger

    Account balance after purchase in SUN

  • energy_pass_energyinteger

    Energy units of this order paid by your Energy Pass; total_price_sun covers the rest. If the order fails, these units return to your Energy Pass allowance rather than to your balance. 0 without an Energy Pass.

Status codes

201400401403409422429500503
201 Status

Created

400 Status

Purchase rejected; nothing was charged:

  • insufficient_balance — your TRX balance is below the order total and your USDT balance could not cover the shortfall — usdt_cover_shortfall is off, there isn't enough USDT, or conversion is unavailable at the moment (no message; carries current_balance and required_amount in SUN)
  • order_amount_below_minimum / order_amount_above_maximum — keyed by code, with min / max
  • invalid_address — receiver_address is not a valid TRON address
  • invalid_idempotency_key — Idempotency-Key longer than 128 characters
  • unsupported_resource — an unknown resource_type, or one your account cannot buy
401 Status

The X-API-Key header is missing, invalid or revoked. detail is a plain string: API key required, Invalid API key or User not found.

403 Status

The account is blocked (plain-string detail: Account is blocked), or ip_not_allowed — the request's source IP is outside this key's IP allowlist. Or reseller_suspended (no message) — purchasing is suspended for your account; contact support.

409 Status

duplicate_request — a request with the same Idempotency-Key is still being processed. Retry with the same key after a few seconds. If it keeps returning 409, check GET /orders before retrying with a new key.

422 Status

Request body validation failed (e.g. a missing field, resource_amount not above 0, or a duration other than 1h) — detail is an array of field errors.

429 Status

Rate limit exceeded — more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions). detail is a plain string; wait the number of seconds in Retry-After, then retry.

500 Status

internal_error — unexpected error; the order was not placed. Retry later.

503 Status

service_unavailable — purchasing is temporarily unavailable; or reseller_activation_balance_low (no message) — purchasing is temporarily unavailable for your account. Retry later.

curl -s -X POST https://tronagg.ai/api/v1/buy \
  -H "X-API-Key: $TRONAGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "receiver_address": "TYourReceiverAddress",
    "resource_amount": 65000
  }'
import { randomUUID } from "node:crypto";

const res = await fetch("https://tronagg.ai/api/v1/buy", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.TRONAGG_API_KEY,
    "Content-Type": "application/json",
    "Idempotency-Key": randomUUID(),
  },
  body: JSON.stringify({
    receiver_address: "TYourReceiverAddress",
    resource_amount: 65000,
  }),
});
console.log(res.status, await res.json());
import os
import uuid

import requests

res = requests.post(
    "https://tronagg.ai/api/v1/buy",
    headers={
        "X-API-Key": os.environ["TRONAGG_API_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "receiver_address": "TYourReceiverAddress",
        "resource_amount": 65000,
    },
)
print(res.status_code, res.json())
201Created
{
  "order_id": "<uuid>",
  "status": "<string>",
  "total_price_sun": <integer>,
  "total_price_trx": "<string>",
  "activation_fee_sun": <integer>,
  "balance_after_sun": <integer>,
  "energy_pass_energy": <integer>
}

GET /order/{order_id}

Retrieve details for a specific order by its UUID. Use this to track order progress after creating a purchase.

Order statuses (always upper-case):

  • PENDING — order placed and paid; Energy delegation in progress
  • COMPLETED — Energy delegated (delegation_txids usually lists the on-chain delegation transaction IDs)
  • FAILED — the order could not be fulfilled and was refunded automatically (see error_message)

Orders placed through the API go PENDING → COMPLETED or FAILED. Orders paid directly from a wallet may also show AWAITING_PAYMENT or PROCESSING.

Parameters

  • order_idstring (uuid)pathrequired

    Order UUID: the order_id that POST /buy returned.

Response 200

  • idstring (uuid)

    Order UUID.

  • statusstring

    Order status, upper-case: PENDING, COMPLETED or FAILED for orders placed through the API; orders paid directly from a wallet may also show AWAITING_PAYMENT or PROCESSING.

  • resource_typestring

    ENERGY or BANDWIDTH.

  • resource_amountinteger

    Amount ordered, in units of resource_type.

  • duration_secinteger

    Delegation duration in seconds (3600 = 1 hour).

  • total_price_suninteger

    Total charged in SUN, including activation_fee_sun.

  • total_price_trxstring

    Total charged in TRX (decimal string).

  • activation_fee_suninteger

    One-time account-activation fee in SUN included in the total; 0 when the receiver was already activated.

  • receiver_addressstring

    Address the Energy is delegated to.

  • provider_namestring

    Always TRONAgg. Kept for backward compatibility.

  • provider_slugstring

    Always tronagg. Kept for backward compatibility.

  • created_atstring (date-time)

    When the order was placed (ISO 8601, UTC).

  • completed_atstring (date-time)nullable

    When the order reached a final status, COMPLETED or FAILED (ISO 8601, UTC); null until then.

  • error_messagestringnullable

    Why the order failed — set only when status is FAILED.

  • delegation_txidsarray of string

    On-chain delegation transaction IDs. Usually filled once the order is COMPLETED, but may be empty for some deliveries.

Status codes

200401403404422429
200 Status

OK

401 Status

The X-API-Key header is missing, invalid or revoked. detail is a plain string: API key required, Invalid API key or User not found.

403 Status

The account is blocked (plain-string detail: Account is blocked), or ip_not_allowed — the request's source IP is outside this key's IP allowlist.

404 Status

Order not found — no such order, or it is not yours. detail is a plain string.

422 Status

order_id is not a valid UUID — detail is an array of field errors.

429 Status

Rate limit exceeded — more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions). detail is a plain string; wait the number of seconds in Retry-After, then retry.

curl -s "https://tronagg.ai/api/v1/order/$ORDER_ID" \
  -H "X-API-Key: $TRONAGG_API_KEY"
const res = await fetch(`https://tronagg.ai/api/v1/order/${process.env.ORDER_ID}`, {
  headers: { "X-API-Key": process.env.TRONAGG_API_KEY },
});
console.log(res.status, await res.json());
import os

import requests

res = requests.get(
    f"https://tronagg.ai/api/v1/order/{os.environ['ORDER_ID']}",
    headers={"X-API-Key": os.environ["TRONAGG_API_KEY"]},
)
print(res.status_code, res.json())
200OK
{
  "id": "<uuid>",
  "status": "<string>",
  "resource_type": "<string>",
  "resource_amount": <integer>,
  "duration_sec": <integer>,
  "total_price_sun": <integer>,
  "total_price_trx": "<string>",
  "activation_fee_sun": <integer>,
  "receiver_address": "<string>",
  "provider_name": "<string>",
  "provider_slug": "<string>",
  "created_at": "<date-time>",
  "completed_at": "<date-time>" | null,
  "error_message": "<string>" | null,
  "delegation_txids": ["<string>"]
}

GET /account

Get Account

API keyDocs page GET /account

Returns your account information: your TRX balance, the deposit address for topping up (it accepts TRX and USDT TRC-20), your linked login wallet address (an empty string if no wallet is linked), and your separate USDT balance with its two conversion settings.

USDT is credited to usdt_balance and converts to TRX automatically by default (1% fee, rate fixed at the moment it converts). The API key can read the USDT balance and settings. An API key cannot convert USDT or change the USDT settings — use Workspace → Deposit; purchases made with it cover a TRX shortfall from USDT when the account's setting is on.

Response 200

  • balance_trxstring

    Your TRX balance, in TRX. Every purchase is paid from it.

  • deposit_addressstring

    Your TRON deposit address. Send TRX or USDT (TRC-20) to it. Only the official USDT contract counts — other tokens sent here are not credited.

  • wallet_addressstring

    Your linked TRON login wallet address; an empty string if no wallet is linked. Not a deposit target — send TRX or USDT to deposit_address.

  • usdt_balancestring

    Your separate USDT balance: a decimal string with 6 decimal places. USDT is never spent directly — it becomes TRX through a conversion (1% fee, rate fixed at the moment it converts). Negative only if a credited USDT deposit was later dropped from the chain.

  • usdt_auto_convertboolean

    true (the default): each USDT deposit converts to TRX as soon as it is credited. Read-only here — change it in the workspace.

  • usdt_cover_shortfallboolean

    true (the default): when your TRX balance can't cover a purchase or another charge, just enough USDT converts to TRX first — all or nothing. Read-only here — change it in the workspace.

Status codes

200401403429
200 Status

OK

401 Status

The X-API-Key header is missing, invalid or revoked. detail is a plain string: API key required, Invalid API key or User not found.

403 Status

The account is blocked (plain-string detail: Account is blocked), or ip_not_allowed — the request's source IP is outside this key's IP allowlist.

429 Status

Rate limit exceeded — more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions). detail is a plain string; wait the number of seconds in Retry-After, then retry.

curl -s https://tronagg.ai/api/v1/account \
  -H "X-API-Key: $TRONAGG_API_KEY"
const res = await fetch("https://tronagg.ai/api/v1/account", {
  headers: { "X-API-Key": process.env.TRONAGG_API_KEY },
});
console.log(res.status, await res.json());
import os

import requests

res = requests.get(
    "https://tronagg.ai/api/v1/account",
    headers={"X-API-Key": os.environ["TRONAGG_API_KEY"]},
)
print(res.status_code, res.json())
200OK
{
  "balance_trx": "<string>",
  "deposit_address": "<string>",
  "wallet_address": "<string>",
  "usdt_balance": "<string>",
  "usdt_auto_convert": <boolean>,
  "usdt_cover_shortfall": <boolean>
}

GET /pricing

Current Energy Price

PublicDocs page GET /pricing

Our live Energy price — the same numbers the tronagg.ai/pricing page shows, as JSON. No API key required.

The snapshot carries our current price per Energy unit (in SUN), the anonymous market average across the public providers we track, how far below that average we sit, and the cost of the standard reference orders (65k Energy = 1 USDT transfer, 131k = 2) in TRX and ≈ USD.

Good to know

  • Prices refresh about every minute; responses are cached server-side for ~60s
  • below_market_percent is null whenever we are not actually below the market average — the field never asserts a false claim
  • The market average is an anonymous aggregate — individual provider prices are never exposed

Response 200

  • updated_atstring (date-time)

    When our price was last updated (UTC).

  • currencyobject

    Currency conversion context for the USD figures.

    Show child attributesHide child attributes
    • trx_usdstringoptionalnullable

      Current TRX/USD rate, or null when unavailable.

  • energyobject

    Our current Energy price and how it sits against the market average.

    Show child attributesHide child attributes
    • price_sunstring

      Our current price per Energy unit, in SUN (1 TRX = 1,000,000 SUN).

    • market_avg_price_sunstringoptionalnullable

      Market average price per Energy unit, in SUN — an anonymous mean across the public providers we track, never an individual provider's price. null when no market data is available.

    • below_market_percentstringoptionalnullable

      How far below the market average our price sits, in percent. null whenever we are not below the market average.

    • market_provider_countinteger

      How many public providers we track for the market average. Providers without a current price are left out of the average itself.

    • reference_ordersarray of object

      Cost of the standard reference orders (65k Energy = 1 USDT transfer, 131k = 2) at our current price.

      Show child attributesHide child attributes
      • energyinteger

        Energy amount of the reference order.

      • usdt_transfersinteger

        How many typical USDT transfers that Energy covers.

      • trxstring

        Cost at our current price, in TRX.

      • usdstringoptionalnullable

        Approximate cost in USD, or null when the TRX/USD rate is unavailable.

Status codes

200
200 Status

Current pricing snapshot

curl -s https://tronagg.ai/api/v1/pricing
const res = await fetch("https://tronagg.ai/api/v1/pricing");
console.log(res.status, await res.json());
import requests

res = requests.get("https://tronagg.ai/api/v1/pricing")
print(res.status_code, res.json())
200Current pricing snapshot
{
  "updated_at": "<date-time>",
  "currency": {
    "trx_usd": "<string>" | null
  },
  "energy": {
    "price_sun": "<string>",
    "market_avg_price_sun": "<string>" | null,
    "below_market_percent": "<string>" | null,
    "market_provider_count": <integer>,
    "reference_orders": [
      {
        "energy": <integer>,
        "usdt_transfers": <integer>,
        "trx": "<string>",
        "usd": "<string>" | null
      }
    ]
  }
}

GET /pricing/history

Energy Price History

PublicDocs page GET /pricing/history

Our Energy price vs the anonymous market average over time. No API key required.

Pass hours for an hourly series (up to 168h / 7 days) or days for a daily series (up to 365). With neither, the series defaults to the last 24 hours, hourly. hours wins when both are given.

Each point carries our price (SUN), the market average (SUN), and our price for a 65,000-Energy order — one USDT transfer — in TRX.

How buckets work

  • Buckets are UTC-aligned. The series covers the last N hours or days and may include the current, partial bucket, so it can hold up to N+1 points
  • Each point is the last price recorded in its bucket (for days, the day's closing hourly rate), not an average over the bucket
  • Buckets without a recorded price of ours are left out

Good to know

  • Responses are cached server-side for ~60s
  • Buckets with no recorded market data have market_avg_price_sun: null

Parameters

  • hoursintegerqueryoptional1 to 168

    Hourly window, up to 168h (7d). Takes precedence over days.

  • daysintegerqueryoptional1 to 365

    Daily window, up to 365d. Ignored if hours is set.

Response 200

  • granularity"hourly" | "daily"

    Bucket size of the series: hourly (via hours) or daily (via days).

  • durationstring

    Rental duration the series is priced at (currently always 1h).

  • historyarray of object

    Series points, oldest first.

    Show child attributesHide child attributes
    • timestampstring (date-time)

      Bucket start (UTC).

    • our_price_sunstring

      Our price per Energy unit in SUN — the last price recorded in this bucket.

    • market_avg_price_sunstringoptionalnullable

      Anonymous market average in SUN: the mean of each tracked public provider's last price recorded in this bucket. null when no market data was recorded.

    • trx_65kstring

      Our price for a 65,000-Energy order (one USDT transfer) at our_price_sun, in TRX.

Status codes

200422
200 Status

Price history series

422 Status

Validation error — hours or days out of range

curl -s -G https://tronagg.ai/api/v1/pricing/history \
  -d hours=24
const params = new URLSearchParams({
  hours: "24",
});
const res = await fetch(`https://tronagg.ai/api/v1/pricing/history?${params}`);
console.log(res.status, await res.json());
import requests

res = requests.get(
    "https://tronagg.ai/api/v1/pricing/history",
    params={"hours": 24},
)
print(res.status_code, res.json())
200Price history series
{
  "granularity": "hourly" | "daily",
  "duration": "<string>",
  "history": [
    {
      "timestamp": "<date-time>",
      "our_price_sun": "<string>",
      "market_avg_price_sun": "<string>" | null,
      "trx_65k": "<string>"
    }
  ]
}

GET /pricing/auto-energy

AutoEnergy Plan Pricing (Public)

PublicDocs page GET /pricing/auto-energy

Public pricing for the default AutoEnergy plan — the activation fee, daily subscription fee, per-transfer charges, and minimum-usage fee, each in both SUN and TRX. No API key required.

Same shape as GET /autoenergy/pricing, but always shows the default plan, which may differ from a tariff assigned to your account. Responses are cached server-side for ~60s.

Response 200

  • idstring (uuid)

    Plan UUID.

  • namestring

    Plan name, e.g. Basic.

  • activation_fee_suninteger

    One-time activation fee, in SUN.

  • activation_fee_trxstring

    One-time activation fee, in TRX.

  • daily_sub_suninteger

    Daily subscription fee, in SUN. Charged every 24h, first 24h after activation.

  • daily_sub_trxstring

    Daily subscription fee, in TRX. Charged every 24h, first 24h after activation.

  • unit_price_65k_suninteger

    Per 65k-Energy transfer, in SUN.

  • unit_price_65k_trxstring

    Per 65k-Energy transfer, in TRX.

  • unit_price_131k_suninteger

    Per 131k-Energy transfer, in SUN.

  • unit_price_131k_trxstring

    Per 131k-Energy transfer, in TRX.

  • min_daily_txintegernullable

    Minimum transfers per 24-hour billing cycle; fewer triggers the minimum-usage fee. Null when the plan has no minimum.

  • penalty_suninteger

    Minimum-usage fee, in SUN, charged once per completed 24h cycle with fewer than min_daily_tx transfers (0 when none).

  • penalty_trxstring

    Minimum-usage fee, in TRX, charged once per completed 24h cycle with fewer than min_daily_tx transfers ("0" when none).

Status codes

200
200 Status

Default AutoEnergy plan pricing

curl -s https://tronagg.ai/api/v1/pricing/auto-energy
const res = await fetch("https://tronagg.ai/api/v1/pricing/auto-energy");
console.log(res.status, await res.json());
import requests

res = requests.get("https://tronagg.ai/api/v1/pricing/auto-energy")
print(res.status_code, res.json())
200Default AutoEnergy plan pricing
{
  "id": "<uuid>",
  "name": "<string>",
  "activation_fee_sun": <integer>,
  "activation_fee_trx": "<string>",
  "daily_sub_sun": <integer>,
  "daily_sub_trx": "<string>",
  "unit_price_65k_sun": <integer>,
  "unit_price_65k_trx": "<string>",
  "unit_price_131k_sun": <integer>,
  "unit_price_131k_trx": "<string>",
  "min_daily_tx": <integer> | null,
  "penalty_sun": <integer>,
  "penalty_trx": "<string>"
}

GET /calculator/estimate-energy

Find out exactly how much energy a TRC20 transfer will consume before you buy a rental — no guessing, no overpaying. TRONAgg simulates the transfer(address,uint256) call on-chain against live network state and returns the precise energy the transaction would burn, plus the equivalent TRX cost at the current getEnergyFee rate.

Defaults to USDT; pass contract_address to estimate any other TRC20 token.

Why use it

  • Size your energy rental precisely instead of relying on rough averages
  • Compare energy cost across different TRC20 tokens
  • Detect first-time receivers (a brand-new recipient costs ~2x more energy)

Good to know

  • Energy prices move in real time — round the returned value up when placing an order
  • Rate limits: 10 req/min per IP, shared by both estimator endpoints (429), and 60 req/min shared to the TRON node (503)

For a quick USDT-only check, see the USDT shortcut which takes the two addresses straight in the URL.

Parameters

  • from_addressstringqueryrequired

    Sender TRON address (T..., 34 chars)

  • to_addressstringqueryrequired

    Receiver TRON address (T..., 34 chars)

  • contract_addressstringqueryoptionaldefault TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

    TRC20 contract address. Defaults to USDT.

Response 200

  • from_addressstring

    Sender TRON address

  • contract_addressstring

    TRC20 contract address (USDT unless overridden)

  • to_addressstring

    Receiver TRON address

  • energy_usedinteger

    Exact energy units the transfer would consume

  • feenumber

    TRX burned at the current network rate (energy_used x energy_fee / 1,000,000)

Status codes

200422429502503
200 Status

OK

422 Status

Invalid TRON address — detail is a string, e.g. Invalid TRON address format: …. A missing required parameter returns a detail array of field errors instead.

429 Status

Rate limit exceeded — more than 10 requests/min from your IP, counted across both estimator endpoints

502 Status

The TRON node could not simulate the transfer (contract error, invalid transaction, etc.)

503 Status

The global outbound rate limit to the TRON node is exhausted — retry shortly

curl -s -G https://tronagg.ai/api/v1/calculator/estimate-energy \
  -d from_address=TYourSenderAddress \
  -d to_address=TYourReceiverAddress
const params = new URLSearchParams({
  from_address: "TYourSenderAddress",
  to_address: "TYourReceiverAddress",
});
const res = await fetch(`https://tronagg.ai/api/v1/calculator/estimate-energy?${params}`);
console.log(res.status, await res.json());
import requests

res = requests.get(
    "https://tronagg.ai/api/v1/calculator/estimate-energy",
    params={
        "from_address": "TYourSenderAddress",
        "to_address": "TYourReceiverAddress",
    },
)
print(res.status_code, res.json())
200OK
{
  "from_address": "<string>",
  "contract_address": "<string>",
  "to_address": "<string>",
  "energy_used": <integer>,
  "fee": <number>
}

Order statuses

Statuses are always UPPERCASE. An order placed through the API goes from PENDING to COMPLETED or FAILED.

PENDINGCOMPLETEDfinalFAILEDfinal
PENDING
Paid from your balance and accepted; the delegation is in progress.
COMPLETED
The Energy is delegated to the receiver. delegation_txids usually lists the on-chain transaction IDs.
FAILED
The order could not be filled and the charge was refunded to your balance automatically. error_message says why.

Poll GET /order/{id} every 2 to 3 seconds, or register a webhook and receive an order.status_changed event instead. Orders paid directly from a wallet can also show AWAITING_PAYMENT or PROCESSING.

Current limits

  • Energy by default. Orders rent TRON Energy. Bandwidth can be rented the same way with resource_type=BANDWIDTH on GET /estimate and POST /buy.
  • 1-hour delegation. The Energy stays delegated to the receiver for one hour: duration is always 1h.
  • Order size. GET /estimate returns min_amount and max_amount. Outside those bounds POST /buy answers 400 and charges nothing.
  • Prepaid balance. Orders are paid from your TRX balance; top it up by sending TRX or USDT (TRC-20) to the deposit_address from GET /account. USDT lands on a separate USDT balance (minimum deposit 5 USDT) and converts to TRX automatically by default, with a 1% fee at the rate fixed when it converts; a purchase your TRX can't cover converts just enough USDT first unless you turn that off in the workspace. A short balance gets 400 insufficient_balance and no charge.
  • New addresses. A receiver that is not yet activated on TRON adds a one-time activation fee, included in the totals. Pass receiver_address to GET /estimate to see it before you buy.
  • Rate limit. 1,000 requests per minute per account, shared by all of its keys; past that the API answers 429 with a Retry-After header. The Energy estimator is limited to 10 requests per minute per IP.

MCP connector for AI assistants

The same operations are available as a remote MCP server. Add the connector URL to Claude, ChatGPT, Cursor or any MCP client: price, quote and Energy estimate tools work without a key, while buying needs your API key in an X-API-Key header and an explicit confirmation of the amount, receiver and cost.

Connector URLhttps://mcp.tronagg.ai/mcp
Setup guide for each assistant

Prefer docs to tools?

Give your agent one Markdown file with every endpoint, field and error of this API, and the rules it must follow before it spends.

https://tronagg.ai/tron-energy-api/llms.txtDocs for your AI agent

Full reference and OpenAPI spec

The API reference documents every endpoint, error code and webhook. The OpenAPI 3.1 spec is published at https://tronagg.ai/openapi.json: import it into Postman or Insomnia, or generate a typed client from it.

TRON Energy API FAQ

Is there an API to rent TRON Energy?
Yes. The TRONAgg REST API at https://tronagg.ai/api/v1 rents TRON Energy to any TRON address: GET /estimate quotes the price, POST /buy places the order from your prepaid balance, and GET /order/{id} reports when the Energy is delegated. Delegation lasts 1 hour and usually completes within seconds.
How much does TRON Energy cost through the API?
Right now 65,000 Energy, enough for one standard USDT transfer, costs 1.755 TRX for 1 hour (27 SUN per unit, checked on 2026-11-09). Before you buy, GET /estimate returns what your order would cost; pass the receiver address to include the one-time activation fee for a new address.
How do I authenticate with the TRONAgg API?
Create an API key in the TRONAgg workspace under API Keys and send it in the X-API-Key header with every account request. Keys start with ta_. The pricing endpoints and the Energy estimator are public and need no key.
What if a purchase request times out?
Retry POST /buy with the same Idempotency-Key. Within 24 hours the API returns the original order instead of placing a second one; while the first request is still processing it answers 409 duplicate_request.
How fast is Energy delivered, and what if an order fails?
Orders start as PENDING and the Energy is usually delegated within seconds. A COMPLETED order lists the delegation transaction IDs; a FAILED order is refunded to your balance automatically.
Can AI agents buy TRON Energy through TRONAgg?
Yes. Connect any MCP client to https://mcp.tronagg.ai/mcp. Price and quote tools need no key; buying needs your API key in an X-API-Key header and an explicit confirmation of the amount, receiver and cost.
Does the API offer longer rentals?
No. Every order is delegated for 1 hour: duration is always 1h.