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.
https://tronagg.ai/api/v1Authentication
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.
curl -s https://tronagg.ai/api/v1/account \
-H "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.
| Endpoint | Auth | What it does |
|---|---|---|
| GET/account | API key | Your balance in TRX and the deposit address for topping it up. |
| GET/estimate | API key | A 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/buy | API key | Buys 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/{id} | API key | The order status, the total charged and the on-chain delegation transaction IDs, usually listed in delegation_txids once the order is COMPLETED. |
| GET/pricing | Public | The 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/history | Public | Our price against the market average over time: hourly for up to 168 hours, or daily for up to 365 days. |
| GET/pricing/auto-energy | Public | AutoEnergy plan pricing: the activation fee, the daily fee and the per-transfer charges. |
| GET/calculator/estimate-energy | Public | Simulates 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.
Code examples
Try it without a key
The live price as JSON, straight from your terminal:
curl -s https://tronagg.ai/api/v1/pricingQuote, 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"])Order statuses
Statuses are always UPPERCASE. An order placed through the API goes from PENDING to COMPLETED or FAILED.
- PENDING
- Paid from your balance and accepted; the Energy delegation is in progress.
- COMPLETED
- The Energy is delegated to the receiver.
delegation_txidsusually lists the on-chain transaction IDs. - FAILED
- The order could not be filled and the charge was refunded to your balance automatically.
error_messagesays 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 only. Every order is TRON Energy:
resource_typeis alwaysENERGY. - 1-hour delegation. The Energy stays delegated to the receiver for one hour:
durationis always1h. - Order size.
GET /estimatereturnsmin_amountandmax_amount. Outside those boundsPOST /buyanswers400and charges nothing. - Prepaid balance. Orders are paid from your TRONAgg balance; top it up by sending TRX to the
deposit_addressfromGET /account. A short balance gets400 insufficient_balanceand 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_addresstoGET /estimateto 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
429with aRetry-Afterheader. 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.
https://mcp.tronagg.ai/mcpFull 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.820 TRX for 1 hour (28 SUN per unit, checked on 2026-10-23). 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 sell Bandwidth or longer rentals?
- No. The API sells TRON Energy only, delegated for 1 hour: resource_type is always ENERGY and duration is always 1h.