Skip to main content

Energy rental · API reference

Two HTTP surfaces:

  • TRX-tier quote GET|POST /energy-rental/trx-quote: no API Key. Pass the energy you need, get the TRX to send.
  • Credits checkout /energy-rental/quote and /energy-rental/orders: requires X-API-Key.

Sending native TRX to the platform address is not itself HTTP; the quote only tells you how much to send. Duration is always 1 hour. Confirmed energy is not refundable.

Base URL​

https://gateway.gelabs.org

Authentication​

/energy-rental/trx-quote does not take an API Key.

Credits checkout requests:

X-API-Key: your-api-key
Content-Type: application/json

Create the key on the App page in Console. Energy rental must be enabled for that App. Omit appId and durationHours on the credits endpoints.

Response format​

Same as Get started:

{
"code": 0,
"message": "success",
"data": {}
}

code 0 is success. JSON is camelCase.

Endpoints​

MethodPathPurposeAuth
GET / POST/energy-rental/trx-quoteEnergy → TRX to sendNone
POST/energy-rental/quoteCredits quote; no chargeX-API-Key
POST/energy-rental/ordersCreateX-API-Key
GET/energy-rental/ordersListX-API-Key
GET/energy-rental/orders/:orderNoDetailX-API-Key

After a credits order, poll detail until status is SUCCESS or FAILED.


GET / POST /energy-rental/trx-quote​

Maps required energy up to the TRX-transfer tier. No API Key. Does not charge credits and does not send TRX.

How to use it:

  1. Call this endpoint with energyAmount.
  2. Check envelope code === 0.
  3. Send data.trxAmount native TRX to data.payAddress.
  4. Energy lands on the paying address. The amount is data.energyGranted, for data.durationHours hours. Confirm in an explorer; there is no order id.

This is not POST /energy-rental/quote, which prices in credits / USDT and requires a key.

Request​

GET uses the query string; POST uses a JSON body.

FieldTypeRequiredDescription
energyAmountintegeryesEnergy you need; must be > 0

Examples​

curl "https://gateway.gelabs.org/energy-rental/trx-quote?energyAmount=80000"

curl -X POST \
-H "Content-Type: application/json" \
https://gateway.gelabs.org/energy-rental/trx-quote \
-d '{"energyAmount":80000}'

Response data​

FieldTypeDescription
energyAmountintegerThe energy you asked for
trxAmountintegerNative TRX to send
energyGrantedintegerEnergy actually delegated after sending trxAmount (≥ requested)
payAddressstringPay-to address, currently TEtK5Gfm24Bp3yc6LomkZGqr1wQrTE7Gx2
durationHoursintegerDuration, always 1
{
"code": 0,
"message": "success",
"data": {
"energyAmount": 80000,
"trxAmount": 8,
"energyGranted": 131000,
"payAddress": "TEtK5Gfm24Bp3yc6LomkZGqr1wQrTE7Gx2",
"durationHours": 1
}
}

energyAmount ≤ 0 or unparseable returns HTTP 400 / code=10001.


POST /energy-rental/quote​

Returns the credits / USDT that would be charged and whether the balance covers it. No charge.

Quote first. Do not create an order when data.sufficient is false.

Headers​

FieldRequiredPurpose
X-API-KeyyesKey from Console
Content-Typeyesapplication/json

Body​

FieldTypeRequiredPurpose
energyAmountintegeryesEnergy to rent, ≥ 65000
receiverAddressstringnoTRON Base58 starting with T. Validated if sent. Required on create
durationHoursintegernoMust be 1 or omitted

Example request​

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"}'

Response data​

FieldTypePurpose
energyAmountintegerEnergy in this quote
durationHoursintegerDuration, always 1
creditsRequiredintegerCredits from the energy formula
planCodestringCurrent plan code
creditsPerUsdtintegerCredits per 1 USDT
creditsToDeductintegerCredits that will be deducted
usdtToDeductMicrointegerUSDT to deduct if credits are short; micro, 1 USDT = 1_000_000
availableCreditsintegerCredits available now
availableUsdtMicrointegerUSDT available now, micro
sufficientbooleanWhether the balance covers the charge
pricingBaseEnergyintegerPricing base energy, currently 65000
pricingBaseCreditsintegerCredits for the base, currently 90000
creditsPerEnergyDisplaystringCredits per extra energy unit, currently "1.3846"
equivalentTrxstringCredits required, priced with creditsPerUsdt, then converted to TRX at the quote-time USD price. Decimal string, rounded up to 1 sun (1 TRX = 1_000_000 sun). This call returns 503 when the price is unavailable
{
"code": 0,
"message": "success",
"data": {
"energyAmount": 65000,
"durationHours": 1,
"creditsRequired": 90000,
"planCode": "basic",
"creditsPerUsdt": 61224,
"creditsToDeduct": 90000,
"usdtToDeductMicro": 0,
"availableCredits": 500000,
"availableUsdtMicro": 0,
"sufficient": true,
"pricingBaseEnergy": 65000,
"pricingBaseCredits": 90000,
"creditsPerEnergyDisplay": "1.3846",
"equivalentTrx": "5.880048"
}
}

`"5.880048"` in the sample is what `0.25` USD per TRX produces. The number moves when the TRX price moves.

POST /energy-rental/orders​

Creates a rental: reserve credits, then delegate energy to receiverAddress.

Headers​

FieldRequiredPurpose
X-API-KeyyesSame as quote
Content-Typeyesapplication/json
Idempotency-KeyyesIdempotency key, preferably a UUID

Body​

FieldTypeRequiredPurpose
energyAmountintegeryesSame as the quote, ≥ 65000
receiverAddressstringyesTRON address that receives energy, Base58, starts with T
durationHoursintegernoMust be 1 or omitted
gatewayOrderNostringnoDo not send. The platform mints GER_…
authorizationIdstringnoDo not send on the product API

Idempotency​

Idempotency-Key stops a timeout retry from charging twice:

CaseResult
First use of this keyNew order, credits reserved
Same key, same address and energyOriginal order, no extra charge
Same key, different address or energy409 / code=10003
Rent again (even to the same address)New key

Example request​

curl -X POST \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 7c9e6679-7425-40de-944b-e07fc1f90ae7" \
https://gateway.gelabs.org/energy-rental/orders \
-d '{"energyAmount":65000,"receiverAddress":"TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf"}'

On success data is one order (see Order fields). If the request times out, retry with the same Idempotency-Key.


GET /energy-rental/orders​

Lists orders for this App.

X-API-Key

Query​

ParamTypeRequiredPurpose
statusstringnoPROCESSING / SUCCESS / FAILED
orderNostringnoExact fulfillment id
receiverAddressstringnoExact receiver
pageintegernoDefault 1
pageSizeintegernoDefault 50

Example request​

curl -H "X-API-Key: $API_KEY" \
"https://gateway.gelabs.org/energy-rental/orders?page=1&pageSize=20"

Response data​

FieldTypePurpose
listobject[]Orders on this page
totalintegerTotal count
pageintegerCurrent page
pageSizeintegerPage size

GET /energy-rental/orders/:orderNo​

Fetch one order. Path param is orderNo from create, not gatewayOrderNo.

curl -H "X-API-Key: $API_KEY" \
https://gateway.gelabs.org/energy-rental/orders/ER_20260915120000_123456

data is the order object (no list wrapper).

Poll every 2–3 seconds until SUCCESS or FAILED.


Order fields​

Times are UTC Unix seconds, or null if not yet set.

FieldTypePurpose
orderNostringFulfillment id; use it for detail
gatewayOrderNostringPlatform-minted GER_…
appIdstringOwning App
receiverAddressstringEnergy receiver
statusstringPROCESSING / SUCCESS / FAILED
creditsReservedintegerReserved credits; not charged until confirm
usdtReservedMicrointegerReserved USDT micro
creditsChargedintegerCharged credits; 0 while processing
usdtChargedstringCharged USDT, 6 decimal places
usdtChargedMicrointegerCharged USDT micro
energyAmountintegerOrdered energy
completedEnergyAmountintegerDelegated energy; 0 before success
durationHoursintegerDuration, currently always 1
paidAtinteger / nullWhen the reserve succeeded
delegatedAtinteger / nullWhen energy was delegated
expiresAtinteger / nullWhen the lease expires
sourcestringapi or console
upstreamOrderIdstring / nullUpstream id; null before submit
createdAtintegerCreated
updatedAtintegerLast updated
failReasonstring / nullFailure reason; null while processing or on success
{
"code": 0,
"message": "success",
"data": {
"orderNo": "ER_20260915120000_123456",
"gatewayOrderNo": "GER_20260915120000_123456",
"appId": "app_xxx",
"receiverAddress": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf",
"status": "PROCESSING",
"creditsReserved": 90000,
"usdtReservedMicro": 0,
"creditsCharged": 0,
"usdtCharged": "0.000000",
"usdtChargedMicro": 0,
"energyAmount": 65000,
"completedEnergyAmount": 0,
"durationHours": 1,
"paidAt": 1757923200,
"delegatedAt": null,
"expiresAt": null,
"source": "api",
"upstreamOrderId": null,
"createdAt": 1757923200,
"updatedAt": 1757923200,
"failReason": null
}
}

Status​

statusMeaning
PROCESSINGReserved; delegation in progress
SUCCESSEnergy on receiverAddress; credits charged
FAILEDFailed; reserve released

How to confirm energy arrived​

  1. Detail status is SUCCESS and completedEnergyAmount > 0.
  2. Open receiverAddress on TronScan and check Energy.
  3. Optional, call a TRON node:
curl -X POST https://api.trongrid.io/wallet/getaccountresource \
-H "Content-Type: application/json" \
-d '{"address":"TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf","visible":true}'

Read EnergyLimit / EnergyUsed.


Errors​

Read HTTP status together with envelope code. Do not treat code !== 0 as success.

HTTPcodeWhen
40010001Bad input: energy ≤ 0 (TRX quote), energy below 65000 (credits API), address not starting with T, duration not 1
40120001Missing or invalid X-API-Key
40320002Energy rental not enabled for this App
40410002Order not found or not owned by this App
40910003Same Idempotency-Key but address / energy differs from the original
40250001Not enough credits / USDT (check quote sufficient first)
50310005Upstream temporarily unavailable

TRX tiers​

Send native TRX to TEtK5Gfm24Bp3yc6LomkZGqr1wQrTE7Gx2. Energy goes to the paying address. Received amount rounds down.

TRX receivedEnergy
Under 4No rent; TRX is kept
465,000
8131,000 (special case, not 130,000)
4n (n≥3)65000 × n

When you know the energy you need, round up or call GET|POST /energy-rental/trx-quote. 80,000 energy needs 8 TRX (you get 131,000).