Home/Buy via API

Rent TRON Energy via API

View documentation

Energy is the resource the TRON network consumes when a transaction runs a smart contract — most commonly a USDT (TRC-20) transfer. Call one endpoint with a target address and a volume, and we delegate Energy to it directly.

import requests resp = requests.post( "https://trongas.ai/api/v1/orders", headers={ "X-Api-Key": "tgk_4f9a1c8e2b7d...", "Idempotency-Key": "5c1e2b6a-9e21-4b7a-8f3d-1a2b3c4d5e6f", }, json={ "resource": "energy", "targetAddress": "TXYZ...4f9a", "volume": 65000, "duration": "1h", }, ) print(resp.json())

Request format

Request body
resourcestring

"energy" or "bandwidth". Defaults to energy if omitted.

targetAddressstring

TRON address that receives the delegated resource.

volumeinteger

Amount to delegate. Energy: 65,000–1,000,000. Bandwidth: 350–300,000.

durationstring

"15m", "1h" or "1d".

Headers
X-Api-Key

Your API key.

Idempotency-Key

A UUID you generate. Retrying with the same key returns the original order instead of charging twice.

Response body
id

Order id.

status

"Created" at first, then "Filled" once delegated (or "Failed"). Subscribe to the order.filled webhook to know the moment it lands.

priceTrx / activationTrx / totalTrx

Charge in TRX. activationTrx is only non-zero when the target address is receiving TRX for the first time.

txId

Delegation transaction hash, populated once the order is filled.

From zero to your first request

01
Sign up
Create a free TronGasAi account.
02
Get your API key
Issue a scoped key from the dashboard.
03
Send a test request
Call POST /orders with your key.
04
Connect it to your project
Wire the same call into your app or service.

Frequently asked questions