How to Buy TRON Energy via API in 2026 — Guide for Vibe Coders & Developers

Alex Goldsmith
Author & Researcher
10 articles
Paste this into your AI assistant

Automate TRON energy purchases via API.

Copy this prompt into Claude Code, Cursor, or any AI tool — you'll get a working integration in minutes.

Even easier: MCP — no code at all

npx -y @tronrental-com/mcp-server

The MCP server gives your AI assistant direct access to TronRental. You don't even need to register on the website — the assistant will create an account, generate an API key, show the deposit address, and buy energy automatically. All through plain text: "Buy 65,000 energy for address T...".

Learn more about MCP →

Below — for those who want to understand the details and build the integration manually.

Why rent energy?

Every USDT (TRC-20) transfer on TRON requires energy. Without it, the network burns your TRX:

  • 65,000 energy × 100 SUN = 6.43 TRX (~$1.60) — recipient has USDT
  • 131,000 energy × 100 SUN = 13.28 TRX (~$3.30) — recipient has no USDT

Renting energy via API costs ~1.80 TRX for 65K and ~3.60 TRX for 131K. That's 72% cheaper.

At 50 transfers per day, you save ~230 TRX daily — roughly $1,700/month. Hard to argue with the math.

What you'll need

  • Account at tronrental.com
  • API key (Dashboard → API → Create Key)
  • TRX on your balance (Dashboard → Deposit)
  • 5 minutes

Quick start: first purchase in 3 steps

Step 1 — Check the price

curl https://api.tronrental.com/v1/prices
{
  "energy_price_sun": 33,
  "energy_price_trx_per_65k": "2.12",
  "energy_price_trx_per_131k": "4.24",
  "burn_cost_trx": "6.43",
  "savings_percent": "67.0"
}

Prices are dynamic, updated every 60 seconds. energy_price_sun is the price per unit of energy. Other fields are pre-calculated for convenience.

Step 2 — Buy energy

curl -X POST https://api.tronrental.com/v1/energy/buy \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target_address": "TRecipient...", "energy_amount": 65000, "duration": "1h"}'
{
  "order_id": 1842,
  "status": "pending",
  "energy_amount": 65000,
  "price_trx": "2.12",
  "target_address": "TRecipient..."
}

Energy is delegated to target_address — this can be your own address or someone else's.

Step 3 — Confirm the order

curl https://api.tronrental.com/v1/orders/1842 \
  -H "X-API-Key: YOUR_API_KEY"
{
  "order_id": 1842,
  "status": "filled",
  "energy_amount": 65000,
  "tx_hash": "a1b2c3..."
}

When status becomes "filled" — energy has been delegated. You can now send your USDT transfer.

Same thing in Python

import httpx

API_KEY = "your_api_key"
BASE = "https://api.tronrental.com/v1"
HEADERS = {"X-API-Key": API_KEY}

async def buy_energy(target_address: str, amount: int = 65_000) -> dict:
    async with httpx.AsyncClient() as client:
        resp = await client.post(
            f"{BASE}/energy/buy",
            headers=HEADERS,
            json={"target_address": target_address, "energy_amount": amount, "duration": "1h"},
        )
        resp.raise_for_status()
        return resp.json()

Same thing in JavaScript

const API_KEY = "your_api_key";
const BASE = "https://api.tronrental.com/v1";

async function buyEnergy(targetAddress, amount = 65000) {
  const resp = await fetch(`${BASE}/energy/buy`, {
    method: "POST",
    headers: {
      "X-API-Key": API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      target_address: targetAddress,
      energy_amount: amount,
      duration: "1h",
    }),
  });
  if (!resp.ok) throw new Error(`API error: ${resp.status}`);
  return resp.json();
}

How much energy to buy?

ScenarioEnergyWhy
Recipient has USDT65,000Standard transfer
Recipient has no USDT131,000First transfer to this address costs 2x

Not sure? Check before buying:

curl "https://api.tronrental.com/v1/tools/check-energy?address=TRecipient..."
{
  "has_usdt": true,
  "energy_needed": 64285,
  "rental_cost_trx": "2.12"
}

Limits: minimum 32,000 energy per order, maximum 5,000,000.

Renting bandwidth

In addition to energy, TRON uses bandwidth for all transactions. Every activated address gets 600 free bandwidth per day — enough for 1 USDT transfer. From the second transfer, the network burns TRX for bandwidth (~0.35 TRX).

If your service makes multiple transfers per day from one address — renting bandwidth is cheaper.

Prices

curl https://api.tronrental.com/v1/bandwidth/prices
{
  "price_per_day_trx": "9.6",
  "min_volume": 350,
  "max_volume": 100000,
  "fixed_fee_trx": "0.2"
}

Formula: (volume / 1000) × 0.4 TRX + 0.2 TRX fixed fee.

Purchase

curl -X POST https://api.tronrental.com/v1/bandwidth/buy \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target_address": "TRecipient...", "volume": 350, "duration": "1h"}'

350 bandwidth = 1 USDT transfer. Minimum 350, maximum 100,000.

Full example: buy energy → send USDT

Real-world pattern — buy energy for the sender address, wait for delegation, then send USDT:

import asyncio
import httpx

API_KEY = "your_api_key"
BASE = "https://api.tronrental.com/v1"
HEADERS = {"X-API-Key": API_KEY}


async def buy_energy_and_wait(target: str, amount: int = 65_000) -> str:
    async with httpx.AsyncClient() as client:
        resp = await client.post(
            f"{BASE}/energy/buy",
            headers=HEADERS,
            json={"target_address": target, "energy_amount": amount, "duration": "1h"},
        )
        data = resp.json()

        if resp.status_code == 400:
            raise Exception(f"Purchase failed: {data.get('detail', data)}")
        resp.raise_for_status()

        order_id = data["order_id"]

        for _ in range(10):
            await asyncio.sleep(3)
            check = await client.get(f"{BASE}/orders/{order_id}", headers=HEADERS)
            order = check.json()
            if order["status"] == "filled":
                return order["tx_hash"]

        raise TimeoutError(f"Order {order_id} not filled after 30s")


async def send_usdt_with_energy(sender: str, recipient: str, amount_usdt: float):
    tx_hash = await buy_energy_and_wait(sender, amount=65_000)
    print(f"Energy delegated: {tx_hash}")
    # ... your USDT transfer logic here (tronpy, tronweb, etc.)

Error handling

HTTP statusWhat it meansWhat to do
400Bad request (invalid address, insufficient balance)Read the error message, fix and retry
429Rate limit exceeded (100 req/min)Wait and retry with backoff
5xxServer errorRetry with exponential backoff

FAQ

How fast is energy delegated?

Usually 3–5 seconds. Energy is delegated on-chain in the next block.

What if I buy energy but don't make a transfer?

Energy expires after 1 hour. The rental cost is not refunded — you're paying for the delegation, not the usage.

Is there a rate limit?

100 requests per minute per API key. More than enough for most use cases.

Can I buy energy for someone else's address?

Yes. Set target_address to any valid TRON address. You don't need to own it.

Where are the full docs?

docs.tronrental.com — all endpoints, request/response schemas, webhook setup, and more.

Was this helpful?