logo
English
HOME/DOCS

Energy Pool Rental API

Welcome to the Energy Pool Rental API. Automate energy resource rental and usage on the TRON blockchain.

Basic Information

Request Headers

KeyValue
keyYour request key

Response Codes

code=99999 indicates success

CodeDescription
99999Successful call
20100Address not activated
10108Duplicate order
10107Invalid data
10100General error

Order Status

StatusDescription
0Invalid order
10Paid, pending delegation
11Expired, refunded
20Delegated, unconfirmed
21Delegated, confirmed
30Reclaimed, pending confirmation
31Reclaimed, confirmed
Note:Status 21, 30, 31 indicate energy has been sent. Check the confirmations field from order query: for speed, transfer when status is 21; for stability, wait until confirmations ≥ 3. In rare cases, successful broadcast may still fail on-chain, and the order will be re-processed. You can also query the address on-chain for energy by checking energy_limit (total energy) and energy_used (used energy) in the response.

On-Chain Energy Query

You can query address energy info via TronGrid API:

curl --request POST \
     --url https://api.trongrid.io/wallet/getaccountresource \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "address": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM",
  "visible": true
}'

How to Get Your API Key

  1. Log in to the platform
  2. Check deposit address and balance
  3. Obtain your API key
  4. Start using the API!

Test Key

curl --location '{{BASE_URL}}/gateway/api/v1/api/query' \
--header 'key: 773e36f0ee81422db7229a15ba9260d9' \
--header 'User-Agent: ua'

API Endpoints

POST

/v1/order/rent

Standard Rental

Request Parameters

{
    "resourceType": 1,                 // 类型默认写1,1=能量,0=带宽
    "receiveAddress": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM",  // 需要能量的地址
    "resourceValue": 2000000,          // 能量数量
    "leaseDurationSecond": 300         // 租用时间,单位秒
}
FieldTypeDescription
resourceTypeint1=Energy, 0=Bandwidth
receiveAddressstringTarget address
resourceValueintEnergy amount
leaseDurationSecondintLease duration (seconds)

Response

{
    "code": 99999,                     // 99999代表成功
    "msg": "请求成功",
    "data": {
        "orderNo": "8fe2a3b7-c995-40ec-9cb6-67a3c90ed998",   // 订单号
        "resourceType": 1,                                     // 资源类型
        "receiveAddress": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM", // 资源地址
        "priceInSun": 56000,                                   // 资源单价,千分之一sun
        "createTime": 1758967165521,                           // 创建时间
        "resourceValue": 65000,                                // 资源数量
        "rentTimeSecond": 300,                                 // 租赁时间
        "payTime": 1754904247617,                              // 支付时间
        "payAmount": 3.9,                                      // 租赁价格
        "status": 10                                           // 订单状态,10=已支付待代理
    }
}
POST

/v1/order/useRent

Rental with Auto-Reclaim

Request Parameters

{
    "resourceType": 1,                 // 类型默认写1
    "receiveAddress": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM",  // 需要能量的地址
    "resourceValue": 2000000,          // 能量数量
    "leaseDurationSecond": 300         // 租用时间,单位秒
}
Recommendation:Use the useRent endpoint instead of rent. It auto-reclaims when energy is used up or manually triggered, avoiding the issue where rent reclaims effective energy exactly at the 5-minute mark.

Response

{
    "code": 99999,                     // 99999代表成功
    "msg": "请求成功",
    "data": {
        "orderNo": "8fe2a3b7-c995-40ec-9cb6-67a3c90ed998",   // 订单号
        "resourceType": 1,                                     // 资源类型
        "receiveAddress": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM", // 资源地址
        "priceInSun": 56000,                                   // 资源单价,千分之一sun
        "createTime": 1758967165521,                           // 创建时间
        "resourceValue": 65000,                                // 资源数量
        "rentTimeSecond": 300,                                 // 租赁时间
        "payTime": 1754904247617,                              // 支付时间
        "payAmount": 3.9,                                      // 租赁价格
        "status": 10                                           // 订单状态,10=已支付待代理
    }
}
POST

/v1/order/countRent

Per-Transaction Rental

Note: 1 tx = 65,000 energy, 2 tx = 131,000 energy. First call is priced at 2 tx. If previous tx consumed only 1 tx & re-request within 5 minutes of reclaim, price drops to 1 tx (still delivers 2 tx). System auto-reclaims after each use or after 24h. Contact admin to configure a callback URL — the system will POST reclaim info after each recycle.

Callback Example

Send to:https://www.1.com/test

{
    "date": [2026, 3, 27, 17, 51, 16, 740648425],
    "address": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM",
    "energy": 13045
}

Request Parameters

{
    "receiveAddress": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM"
}

Response

{
    "code": 99999,
    "msg": "请求成功",
    "data": {
        "orderNo": "a1cb1669-2468-4159-ba7d-e98beb345703",  // 订单号
        "resourceType": 1,                                 // 资源类型
        "receiveAddress": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM", // 资源地址
        "priceInSun": 38000,                               // 资源单价 千分之一sun
        "createTime": 1774605083836,                       // 创建时间
        "resourceValue": 131000,                           // 资源数量
        "rentTimeSecond": 86400,                           // 租赁时间
        "payTime": 1774605083836,                          // 支付时间
        "payAmount": 2.47,                                 // 支付金额
        "status": 10                                       // 订单状态,10=已支付待代理
    }
}
GET

/v1/order/query

Query Order

Request Parameters

orderNo=e8e85948-5c90-4b2f-a318-e4d16b42b70f (GET query parameter)

Response

{
    "code": 99999,
    "msg": "请求成功",
    "data": {
        "orderNo": "ec7c3d4b-36d1-476b-ac88-6a6c0b569f02",   // 订单号
        "resourceType": 1,                                     // 资源类型
        "receiveAddress": "TYbMYfdM9i8grG6vWP8ZztPsq4eBJhdziB", // 资源地址
        "priceInSun": "28000",                                 // 资源单价
        "createTime": "1759131746228",                         // 创建时间
        "rentDuration": 60,                                    // 租赁时长(分钟)
        "rentTimeUnit": "m",                                   // 单位:分钟
        "payTime": "1759131746228",                            // 支付时间
        "payAmount": "30000",                                  // 支付金额
        "status": 21,                                          // 订单状态,21=已代理已确认
        "confirmations": 200,                                  // 交易确认数量,0=未确认,数值越大越稳定
        "freezeList": [
            {
                "frozenResourceValue": "1000",                 // 冻结的资源数量
                "rentExpireTime": "1759131806499",             // 租赁过期时间
                "frozenTxId": "a4dd19b3b2ccf5f55690d2cba8316776...", // 冻结交易ID
                "freezeTime": "1759131746499"                  // 冻结时间
            }
        ]
    }
}
GET

/v1/api/query

API Data Query

Response

{
    "code": 99999,                     // 99999代表成功
    "msg": "请求成功",
    "data": {
        "name": "6pm客户第一个密钥",          // 密钥名称
        "energySurplus": 11348297,           // 剩余能量
        "bandwidthSurplus": 28870,           // 剩余带宽
        "allConsumeTrxAmount": 1211347300,   // 总消耗TRX数量
        "allEnergyValue": 22788600,          // 总能量值
        "allBandwidthValue": 0,              // 总带宽值
        "ipWhitelist": ["0.0.0.0/0"],       // 设置的API白名单
        "uaWhitelist": ["ua"],               // 设置的API请求头
        "createTime": 1745466180,            // 创建时间
        "analysisTime": 1745466180,          // 分析时间
        "trxMoney": 122277100,               // 剩余TRX余额,单位sun
        "trxAddress": "TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM", // TRX地址
        "ip": "8.212.121.88"                 // 请求的IP
    }
}
GET

/v1/api/resource

System Resource Query

Response

{
    "code": 99999,                     // 99999代表成功
    "msg": "请求成功",
    "data": {
        "energy": 13863739,            // 剩余能量数量
        "bandwidth": 48966             // 剩余带宽数量
    }
}
GET

/v1/order/directRecycle

Manual Reclaim

Request Parameters

address="TSsqPiztzsrZevPYKaHnAGxi1EGF2kH6pM" (GET query parameter)

Response

{
    "code": 99999,
    "msg": "请求成功",
    "data": true
}

FAQ

What's the difference between /v1/order/rent and /v1/order/useRent?

  • Both are similar. rent: reclaims only after 5 min. useRent: reclaims after 5 min, 65k energy consumed, or manual recycle.
  • Recommended to use useRent: rent may reclaim effective energy exactly at 5 min when next delegation arrives. useRent avoids this, auto-reclaims normally, and supports manual recycle before the next order.

What's the minimum deposit?

Minimum deposit is 10 TRX.