Energy rental · Quick start
These paths are independent. Sending TRX can start with a public quote — no signup, no API Key. Credits checkout needs a key and does not send TRX.
Buy by sending TRX
Use this from a wallet or your own transfer. After native TRX arrives, energy is delegated to the paying address.
1. Quote: how much TRX to send
Public endpoint. Do not send X-API-Key. Pass the energy you need; get the TRX to send and the pay-to address. The quote does not transfer TRX and does not charge credits.
curl "https://gateway.gelabs.org/energy-rental/trx-quote?energyAmount=80000"
From a server you can POST:
curl -X POST \
-H "Content-Type: application/json" \
https://gateway.gelabs.org/energy-rental/trx-quote \
-d '{"energyAmount":80000}'
Success is code 0:
{
"code": 0,
"message": "success",
"data": {
"energyAmount": 80000,
"trxAmount": 8,
"energyGranted": 131000,
"payAddress": "TEtK5Gfm24Bp3yc6LomkZGqr1wQrTE7Gx2",
"durationHours": 1
}
}
| Field | Use it for |
|---|---|
trxAmount | Send this many native TRX |
energyGranted | Energy that will actually arrive (may be more than you asked) |
payAddress | Send TRX here |
energyAmount must be greater than 0. Bad input returns HTTP 400 / code=10001. Full fields: API reference.
Received TRX rounds down. When you estimate yourself, round up:
| TRX sent | Energy | Notes |
|---|---|---|
| Under 4 | No rent; TRX is kept | — |
| 4 | 65,000 | |
| 8 | 131,000 | Special case, not 130,000 |
4n (n ≥ 3) | 65000 × n | 12 → 195,000; 16 → 260,000 |
2. Send native TRX
Open TronLink or any TRON wallet. Send native TRX (not USDT / TRC-20):
- Amount:
trxAmountfrom the quote (8in the example) - To:
payAddressfrom the quote
TEtK5Gfm24Bp3yc6LomkZGqr1wQrTE7Gx2
3. Confirm
Energy usually arrives in a few seconds. There is no order id and no lookup API. Open the paying address (whoever sent the TRX) on TronScan and check Energy. Duration is 1 hour. Confirmed energy is not refundable.
Buy with credits API
Use this to rent energy from your own service.
Before you start
-
Create an App in Console.
-
Enable energy rental for that App.
-
Copy the API Key and keep it on the server:
export API_KEY="your-api-key" -
Make sure the App has enough credits / USDT. If not, quote returns
sufficient: false.
Base URL and auth
https://gateway.gelabs.org
Every request:
X-API-Key: your-api-key
Content-Type: application/json
JSON is camelCase. Success is envelope code === 0.
1. Credits quote (no charge)
Minimum energy is 65000. If data.sufficient is false, top up before creating an order.
curl -X POST \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
https://gateway.gelabs.org/energy-rental/quote \
-d '{"energyAmount":65000,"receiverAddress":"TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf"}'
2. Create an order
receiverAddress is the TRON address that receives energy (Base58, starts with T). Generate Idempotency-Key yourself; reuse it if the same request times out.
IDEMPOTENCY_KEY=$(uuidgen)
curl -X POST \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
https://gateway.gelabs.org/energy-rental/orders \
-d '{"energyAmount":65000,"receiverAddress":"TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf"}'
Same key, same address and energy: original order, no second charge.
Same key, different address or energy: conflict.
Rent again: new Idempotency-Key.
3. Poll until it finishes
Use orderNo from create, not gatewayOrderNo.
curl -H "X-API-Key: $API_KEY" \
https://gateway.gelabs.org/energy-rental/orders/ER_20260915120000_123456
status | Meaning | What you do |
|---|---|---|
PROCESSING | In flight; credits reserved, not charged yet | Poll again in a few seconds |
SUCCESS | Energy delegated to receiverAddress | Broadcast the on-chain tx |
FAILED | Failed; reserve released | Read failReason; create again with a new key if needed |
On SUCCESS you can also check Energy for the receiver on TronScan.
Fields, errors, and full payloads: API reference.