API docs for AI agents
Give the TRONAgg API to your AI agent
One Markdown file describes the TRON Energy API for an AI agent: every endpoint, field and error, the order lifecycle, and the rules for spending your balance. We generate it from our OpenAPI spec, so it changes when the API does.
https://tronagg.ai/tron-energy-api/llms.txt- Format
- Markdown, UTF-8
- Last updated
- Source
- TRONAgg OpenAPI spec
- Size
- 30 KB
What the doc covers
- What the API does, the base URL, the format and the units
- Authentication, and how to keep the API key out of logs and chats
- Each endpoint: parameters, request body, response fields, status codes and a cURL example
- The order status lifecycle, idempotency and retries
- Limits: Energy only, 1-hour delegation, order size and rate limits
- A recommended flow for agents, with full examples in Python and JavaScript
Spending rules built in
The doc tells your agent to quote first, show you the receiver address, the Energy amount and the cost, and wait for your yes before it calls POST /buy. It reuses one Idempotency-Key per purchase and never logs or reveals your API key.
Add the doc to your tool
Most assistants can read the file from its URL. For a project you come back to, save it next to your code, then point your tool at the saved file.
curl -o docs/tronagg-api.md https://tronagg.ai/tron-energy-api/llms.txtCursor
Paste the file URL into your prompt, or @-mention the saved file. For guidance in every chat, reference it from a project rule in
.cursor/rules. Current versions no longer have @Docs; in older ones, choose @Docs, then Add new doc, and paste the URL.Claude
In a project, open Project knowledge and add the saved file or paste its text, so every chat in the project can use it. For a single chat, Open in Claude is enough.
ChatGPT
In a custom GPT, open Configure and upload the saved file under Knowledge. In a ChatGPT project, add it to the project files.
GitHub Copilot
In VS Code chat, add
#web/fetchand the file URL to your prompt. For standing context, reference the saved file from.github/copilot-instructions.md.Windsurf
Paste the file URL into a Cascade message, or save the file in your workspace and point a rule at it.
Claude Code, Codex and other coding agents
Paste the URL into the session, or save the file and mention it in
AGENTS.mdorCLAUDE.mdso every session reads it.
The prompt behind the buttons
Open in ChatGPT and Open in Claude start a new chat with this prompt. The assistant needs web access to read the file; without it, use Copy docs for AI and paste the text instead.
Read the TRONAgg TRON Energy API docs at https://tronagg.ai/tron-energy-api/llms.txt and use them as the reference for this conversation. Help me integrate the API. Never call POST /buy until I have confirmed the receiver address, the Energy amount and the cost.
Prefer tools to docs? Connect MCP
With the MCP connector your assistant calls TRONAgg directly instead of writing HTTP requests. Price, quote and Energy estimate tools work without a key; buying needs your API key and your confirmation.
Set up the MCP connectorhttps://mcp.tronagg.ai/mcpPreview the doc
The file as your agent reads it, rendered for people.
TRONAgg TRON Energy API
Buy TRON Energy for any TRON address from code: a REST API with JSON over HTTPS, an
X-API-Keyheader, idempotent purchases and public live pricing. TRONAgg is a TRON Energy provider. Orders are paid from a prepaid TRONAgg balance, and the Energy is delegated to the receiver for 1 hour, usually within seconds.
This file is written for AI agents and coding assistants. It is generated from the TRONAgg OpenAPI spec, so it changes when the API does.
- Last updated: 2026-10-24 (OpenAPI spec version 0.1.0)
- Base URL:
https://tronagg.ai/api/v1. All paths below are relative to it. - This file: https://tronagg.ai/tron-energy-api/llms.txt
- Page for people: https://tronagg.ai/tron-energy-api
- How to give this file to an assistant: https://tronagg.ai/tron-energy-api/ai
- OpenAPI 3.1 spec: https://tronagg.ai/openapi.json
- Full reference, webhooks and order history: https://docs.tronagg.ai/api-reference
Essentials
- Format: JSON request and response bodies over HTTPS.
- Authentication: an
X-API-Key: <key>header on every endpoint marked "API key" below. Public endpoints need no key. - Units: integer amounts are in SUN (1 TRX = 1,000,000 SUN). Fields ending in
_trx,unit_price_sunand the price fields of the public pricing endpoints are decimal strings: parse them with a decimal type, never a float. - Resource: Energy only (
resource_typeis alwaysENERGY), delegated for 1 hour (durationis always1h). - Order statuses are UPPERCASE. Timestamps are ISO 8601 in UTC.
- TRON addresses are base58, start with
Tand have 34 characters.
Authentication and key safety
- The user creates a key in the TRONAgg workspace under API Keys (https://tronagg.ai/workspace/api-keys). Keys start with
ta_. - Send the key in the
X-API-Keyheader only. Never put it in a URL, a query string or a request body. - Read the key from the environment (
TRONAGG_API_KEY) or a secret store. Never log, print, echo, commit or repeat the key, and never paste it into a chat or into code you show the user. - A key can spend the account's balance: treat it like a password.
- A key can be limited to IP addresses or CIDR ranges; a request from anywhere else gets
403withip_not_allowed. - A missing, invalid or revoked key gets
401with a plain-stringdetail.
Recommended agent flow
- Quote:
GET /estimatewithresource_amountandreceiver_address. Passing the receiver includes any one-time activation fee in the totals. The response also givesmin_amountandmax_amount(nullmeans no bound). - Confirm with the user: show the receiver address, the Energy amount,
total_price_trxandactivation_fee_trx, then wait for an explicit yes in the conversation. - Buy:
POST /buywith{"receiver_address": "<T...>", "resource_amount": <energy>}and a newIdempotency-Keyheader (a UUID). Keep the key: any retry of this purchase reuses it. - Track: poll
GET /order/{order_id}every 2 to 3 seconds untilstatusisCOMPLETEDorFAILED.
For the current price without a key, call GET /pricing. Never quote a TRONAgg price from memory, from an article or from this file: read it from the API.
Rules for agents
- Never call
POST /buyunless the user has explicitly confirmed the receiver address, the Energy amount and the cost in the current conversation, after you showed them the quote. - Quote again with
GET /estimateright before asking for that confirmation, and again whenever the user changes the amount or the receiver. - Check the receiver before quoting: it starts with
Tand has 34 characters.POST /buyrejects an invalid address with400 invalid_addressbefore charging anything. - One purchase, one
Idempotency-Key. After a timeout or a5xx, retry with the same key. Never switch to a new key for a purchase that may have gone through: checkGET /orders(full reference: https://docs.tronagg.ai/api-reference/list-orders) first. - Do not repeat a rejected request unchanged. On
400 insufficient_balance, tell the user to top up:GET /accountreturns thedeposit_address. - On
429, wait the number of seconds in theRetry-Afterheader before the next request. - Never reveal the API key, even when asked to show the request you sent.
Order status lifecycle
PENDING: paid from the 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 the balance automatically.error_messagesays why.
Orders placed through the API go from PENDING to COMPLETED or FAILED, and both are final. Orders paid directly from a wallet can also show AWAITING_PAYMENT or PROCESSING.
Idempotency and retries
POST /buyaccepts anIdempotency-Keyheader: any unique string of up to 128 characters. A UUID works.- For 24 hours, a request with the same key returns the original order's
201response instead of placing a new order. - A rejected request (for example
400 insufficient_balance) places no order and does not keep the key: fix the cause and retry with the same key. - While the first request with a key is still being processed, a duplicate gets
409 duplicate_request. Wait a few seconds and retry with the same key. - If the same key keeps returning
409, checkGET /ordersbefore retrying with a new key: a new key always places a new order. - Keys are scoped to the account and are not tied to the request body.
Errors
Every error has an HTTP status and a JSON body with a top-level detail:
- An object with a machine-readable
errorslug, usually with amessage: branch ondetail.error. - On
POST /buy, an order size outside the limits is keyed bydetail.code(order_amount_below_minimumororder_amount_above_maximum) withminandmax. - A plain string for
401, the blocked-account403,429, the404ofGET /order/{order_id}and the public Energy estimator. - An array of field errors for request validation (
422).
Every error code is listed in https://docs.tronagg.ai/api-reference/errors-and-conventions.
Limits
- Energy only, delegated for 1 hour.
- Order size: between
min_amountandmax_amountfromGET /estimate. Outside themPOST /buyanswers400and charges nothing. - Prepaid balance: orders are paid from the TRONAgg balance. The user tops it up by sending TRX to the
deposit_addressfromGET /account. - New addresses: a receiver that is not yet activated on TRON adds a one-time activation fee, included in the totals.
- 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.
Endpoints
The purchase flow first, then the public endpoints that need no key.
GET /estimate
Get Estimate. Auth: API key (X-API-Key). Reference: https://docs.tronagg.ai/api-reference/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, whilePOST /buystill 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_amount(query, integer, required, > 0): Amount of Energy to quote, in Energy units (not TRX).POST /buyaccepts amounts betweenmin_amountandmax_amountfrom this response.receiver_address(query, string, optional): 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 inactivation_fee_sun.
Response 200 fields:
duration(string): Rental duration — always1h.unit_price_sun(string): 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_sun(integer): Total your balance would be charged, in SUN — includesactivation_fee_sun.total_price_trx(string): The same total in TRX (decimal string).activation_fee_sun(integer): One-time account-activation fee in SUN, included in the totals. Non-zero only when you pass areceiver_addressthat is not yet activated on TRON.activation_fee_trx(string): The activation fee in TRX (decimal string);"0"when there is none.min_amount(integer, nullable): Smallestresource_amountPOST /buyaccepts;null= no lower bound. Outside the boundsPOST /buyreturns400.max_amount(integer, nullable): Largestresource_amountPOST /buyaccepts;null= no upper bound. Outside the boundsPOST /buyreturns400.energy_pass_energy(integer): Energy units your Energy Pass would cover right now; the totals are what your balance pays for the rest.0without an active Energy Pass.
Status codes:
200: OK400:unsupported_resourceorinvalid_duration— only Energy for a 1-hour duration is offered.401: TheX-API-Keyheader is missing, invalid or revoked.detailis a plain string:API key required,Invalid API keyorUser not found.403: The account is blocked (plain-stringdetail:Account is blocked), orip_not_allowed— the request's source IP is outside this key's IP allowlist.422: Request validation failed (e.g.resource_amountmissing or not above 0) —detailis an array of field errors.429:Rate limit exceeded— more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions).detailis a plain string; wait the number of seconds inRetry-After, then retry.503:service_unavailable— Energy purchasing is temporarily unavailable.
Example:
curl -s -G https://tronagg.ai/api/v1/estimate \
-d resource_amount=65000 \
-d receiver_address=TYourReceiverAddress \
-H "X-API-Key: $TRONAGG_API_KEY"POST /buy
Buy Energy. Auth: API key (X-API-Key). Reference: https://docs.tronagg.ai/api-reference/buy-energy
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.
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-Key(header, string, optional, max 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_address(string, required): TRON address that will receive the Energy delegation (base58, starts withT, 34 characters). Checked before anything is charged.resource_amount(integer, required, > 0): Amount of Energy to buy, withinmin_amount/max_amountfromGET /estimate.
Response 201 fields:
order_id(string (uuid)): Order UUID — pass it toGET /order/{order_id}.status(string): Order status —PENDINGfor a newly placed order.total_price_sun(integer): Total deducted from your balance, in SUN — includesactivation_fee_sun.total_price_trx(string): Total deducted from your balance, in TRX (decimal string).activation_fee_sun(integer): 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_sun(integer): Account balance after purchase in SUNenergy_pass_energy(integer): Energy units of this order paid by your Energy Pass;total_price_suncovers the rest. If the order fails, these units return to your Energy Pass allowance rather than to your balance.0without an Energy Pass.
Status codes:
201: Created400: Purchase rejected; nothing was charged:insufficient_balance— your balance is below the order total (nomessage; carriescurrent_balanceandrequired_amountin SUN)order_amount_below_minimum/order_amount_above_maximum— keyed bycode, withmin/maxinvalid_address—receiver_addressis not a valid TRON addressinvalid_idempotency_key—Idempotency-Keylonger than 128 charactersunsupported_resource— only Energy is offered
401: TheX-API-Keyheader is missing, invalid or revoked.detailis a plain string:API key required,Invalid API keyorUser not found.403: The account is blocked (plain-stringdetail:Account is blocked), orip_not_allowed— the request's source IP is outside this key's IP allowlist. Orreseller_suspended(nomessage) — purchasing is suspended for your account; contact support.409:duplicate_request— a request with the sameIdempotency-Keyis still being processed. Retry with the same key after a few seconds. If it keeps returning 409, checkGET /ordersbefore retrying with a new key.422: Request body validation failed (e.g. a missing field,resource_amountnot above 0, or adurationother than1h) —detailis an array of field errors.429:Rate limit exceeded— more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions).detailis a plain string; wait the number of seconds inRetry-After, then retry.500:internal_error— unexpected error; the order was not placed. Retry later.503:service_unavailable— Energy purchasing is temporarily unavailable; orreseller_activation_balance_low(nomessage) — purchasing is temporarily unavailable for your account. Retry later.
Example:
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
}'GET /order/{order_id}
Get Order. Auth: API key (X-API-Key). Reference: https://docs.tronagg.ai/api-reference/get-order
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 progressCOMPLETED— Energy delegated (delegation_txidsusually lists the on-chain delegation transaction IDs)FAILED— the order could not be fulfilled and was refunded automatically (seeerror_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_id(path, string (uuid), required): Order UUID: theorder_idthatPOST /buyreturned.
Response 200 fields:
id(string (uuid)): Order UUID.status(string): Order status, upper-case:PENDING,COMPLETEDorFAILEDfor orders placed through the API; orders paid directly from a wallet may also showAWAITING_PAYMENTorPROCESSING.resource_type(string): AlwaysENERGY.resource_amount(integer): Amount of Energy ordered, in Energy units.duration_sec(integer): Delegation duration in seconds (3600= 1 hour).total_price_sun(integer): Total charged in SUN, includingactivation_fee_sun.total_price_trx(string): Total charged in TRX (decimal string).activation_fee_sun(integer): One-time account-activation fee in SUN included in the total;0when the receiver was already activated.receiver_address(string): Address the Energy is delegated to.provider_name(string): AlwaysTRONAgg. Kept for backward compatibility.provider_slug(string): Alwaystronagg. Kept for backward compatibility.created_at(string (date-time)): When the order was placed (ISO 8601, UTC).completed_at(string (date-time), nullable): When the order reached a final status,COMPLETEDorFAILED(ISO 8601, UTC);nulluntil then.error_message(string, nullable): Why the order failed — set only whenstatusisFAILED.delegation_txids(array of string): On-chain delegation transaction IDs. Usually filled once the order isCOMPLETED, but may be empty for some deliveries.
Status codes:
200: OK401: TheX-API-Keyheader is missing, invalid or revoked.detailis a plain string:API key required,Invalid API keyorUser not found.403: The account is blocked (plain-stringdetail:Account is blocked), orip_not_allowed— the request's source IP is outside this key's IP allowlist.404:Order not found— no such order, or it is not yours.detailis a plain string.422:order_idis not a valid UUID —detailis an array of field errors.429:Rate limit exceeded— more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions).detailis a plain string; wait the number of seconds inRetry-After, then retry.
Example:
curl -s "https://tronagg.ai/api/v1/order/$ORDER_ID" \
-H "X-API-Key: $TRONAGG_API_KEY"GET /account
Get Account. Auth: API key (X-API-Key). Reference: https://docs.tronagg.ai/api-reference/get-account
Returns your account information: balance in TRX, the deposit address for topping up, and your linked login wallet address (an empty string if no wallet is linked).
Response 200 fields:
balance_trx(string): Account balance in TRXdeposit_address(string): TRON address to send TRX deposits towallet_address(string): Your linked TRON login wallet address; an empty string if no wallet is linked. Not a deposit target — send TRX todeposit_address.
Status codes:
200: OK401: TheX-API-Keyheader is missing, invalid or revoked.detailis a plain string:API key required,Invalid API keyorUser not found.403: The account is blocked (plain-stringdetail:Account is blocked), orip_not_allowed— the request's source IP is outside this key's IP allowlist.429:Rate limit exceeded— more than 1,000 requests per minute for your account (shared by all of its API keys and workspace sessions).detailis a plain string; wait the number of seconds inRetry-After, then retry.
Example:
curl -s https://tronagg.ai/api/v1/account \
-H "X-API-Key: $TRONAGG_API_KEY"GET /pricing
Current Energy Price. Auth: public, no key. Reference: https://docs.tronagg.ai/api-reference/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_percentisnullwhenever 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 fields:
updated_at(string (date-time)): When our price was last updated (UTC).currency(object): Currency conversion context for the USD figures.currency.trx_usd(string, optional, nullable): Current TRX/USD rate, ornullwhen unavailable.energy(object): Our current Energy price and how it sits against the market average.energy.price_sun(string): Our current price per Energy unit, in SUN (1 TRX = 1,000,000 SUN).energy.market_avg_price_sun(string, optional, nullable): Market average price per Energy unit, in SUN — an anonymous mean across the public providers we track, never an individual provider's price.nullwhen no market data is available.energy.below_market_percent(string, optional, nullable): How far below the market average our price sits, in percent.nullwhenever we are not below the market average.energy.market_provider_count(integer): How many public providers we track for the market average. Providers without a current price are left out of the average itself.energy.reference_orders(array of object): Cost of the standard reference orders (65k Energy = 1 USDT transfer, 131k = 2) at our current price.energy.reference_orders[].energy(integer): Energy amount of the reference order.energy.reference_orders[].usdt_transfers(integer): How many typical USDT transfers that Energy covers.energy.reference_orders[].trx(string): Cost at our current price, in TRX.energy.reference_orders[].usd(string, optional, nullable): Approximate cost in USD, ornullwhen the TRX/USD rate is unavailable.
Status codes:
200: Current pricing snapshot
Example:
curl -s https://tronagg.ai/api/v1/pricingGET /pricing/history
Energy Price History. Auth: public, no key. Reference: https://docs.tronagg.ai/api-reference/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:
hours(query, integer, optional, 1 to 168): Hourly window, up to 168h (7d). Takes precedence overdays.days(query, integer, optional, 1 to 365): Daily window, up to 365d. Ignored ifhoursis set.
Response 200 fields:
granularity("hourly" | "daily"): Bucket size of the series:hourly(viahours) ordaily(viadays).duration(string): Rental duration the series is priced at (currently always1h).history(array of object): Series points, oldest first.history[].timestamp(string (date-time)): Bucket start (UTC).history[].our_price_sun(string): Our price per Energy unit in SUN — the last price recorded in this bucket.history[].market_avg_price_sun(string, optional, nullable): Anonymous market average in SUN: the mean of each tracked public provider's last price recorded in this bucket.nullwhen no market data was recorded.history[].trx_65k(string): Our price for a 65,000-Energy order (one USDT transfer) atour_price_sun, in TRX.
Status codes:
200: Price history series422: Validation error —hoursordaysout of range
Example:
curl -s -G https://tronagg.ai/api/v1/pricing/history \
-d hours=24GET /pricing/auto-energy
AutoEnergy Plan Pricing (Public). Auth: public, no key. Reference: https://docs.tronagg.ai/api-reference/get-pricing-autoenergy
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 fields:
id(string (uuid)): Plan UUID.name(string): Plan name, e.g.Basic.activation_fee_sun(integer): One-time activation fee, in SUN.activation_fee_trx(string): One-time activation fee, in TRX.daily_sub_sun(integer): Daily subscription fee, in SUN. Charged every 24h, first 24h after activation.daily_sub_trx(string): Daily subscription fee, in TRX. Charged every 24h, first 24h after activation.unit_price_65k_sun(integer): Per 65k-Energy transfer, in SUN.unit_price_65k_trx(string): Per 65k-Energy transfer, in TRX.unit_price_131k_sun(integer): Per 131k-Energy transfer, in SUN.unit_price_131k_trx(string): Per 131k-Energy transfer, in TRX.min_daily_tx(integer, nullable): Minimum transfers per 24-hour billing cycle; fewer triggers the minimum-usage fee. Null when the plan has no minimum.penalty_sun(integer): Minimum-usage fee, in SUN, charged once per completed 24h cycle with fewer thanmin_daily_txtransfers (0 when none).penalty_trx(string): Minimum-usage fee, in TRX, charged once per completed 24h cycle with fewer thanmin_daily_txtransfers ("0"when none).
Status codes:
200: Default AutoEnergy plan pricing
Example:
curl -s https://tronagg.ai/api/v1/pricing/auto-energyGET /calculator/estimate-energy
Energy Estimator. Auth: public, no key. Reference: https://docs.tronagg.ai/api-reference/energy-estimator
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_address(query, string, required): Sender TRON address (T..., 34 chars)to_address(query, string, required): Receiver TRON address (T..., 34 chars)contract_address(query, string, optional, default TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t): TRC20 contract address. Defaults to USDT.
Response 200 fields:
from_address(string): Sender TRON addresscontract_address(string): TRC20 contract address (USDT unless overridden)to_address(string): Receiver TRON addressenergy_used(integer): Exact energy units the transfer would consumefee(number): TRX burned at the current network rate (energy_used x energy_fee / 1,000,000)
Status codes:
200: OK422: Invalid TRON address —detailis a string, e.g.Invalid TRON address format: …. A missing required parameter returns adetailarray of field errors instead.429: Rate limit exceeded — more than 10 requests/min from your IP, counted across both estimator endpoints502: The TRON node could not simulate the transfer (contract error, invalid transaction, etc.)503: The global outbound rate limit to the TRON node is exhausted — retry shortly
Example:
curl -s -G https://tronagg.ai/api/v1/calculator/estimate-energy \
-d from_address=TYourSenderAddress \
-d to_address=TYourReceiverAddressFull example: quote, buy, track
Python (requests):
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"])JavaScript (Node.js 18 or later):
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);The same flow in cURL, Go and PHP: https://tronagg.ai/tron-energy-api#quickstart
MCP alternative
TRONAgg also runs a remote MCP server at https://mcp.tronagg.ai/mcp. Add it to Claude, ChatGPT, Cursor or any MCP client to use TRONAgg as tools instead of writing HTTP calls. The price, quote and Energy estimate tools work without a key; buying needs the API key in an X-API-Key header on the connector and an explicit confirmation of the amount, receiver and cost. Setup for each assistant: https://tronagg.ai/agents