API Documentation
Rent TRON energy for your Telegram-bot balance
Energy lives for 60 minutes after delegation.
01 — start
- Get a key in the bot: the 🔑 API button → “Create key”. A
trn_…string is shown once — copy it right away. - Sign requests with the
X-API-Key: trn_…orAuthorization: Bearer trn_…header.
Payment comes from the bot balance. Limit: 30 requests per minute per key.
02 — endpoints
POST/v1/energy/rent
Rent energy to an address.
| Field | What to send |
|---|---|
address | TRON recipient address, starts with T, 34 chars |
energy | Only 65000 · 66000 · 131000. Price: 100 / 110 / 200 RUB |
client_key | Optional. Your order tag: repeating a request with the same tag returns the already created order instead of a new charge. Safe to press “retry” |
Success — 200. Example response:
{"order_id": "7514cf6659a8ff19fe8105d63a8c994e",
"address": "T...",
"energy": 65000,
"cost": 100,
"balance": 400.0}GET/v1/balance
Bot balance bound to the key. The “is the key working?” check lives here too.
{"user_id": 123456,
"balance": 1240.5}GET/v1/orders?limit=20
Recent orders, from 1 to 100.
{"orders": [
{"order_id": "7514cf6659a8ff19fe8105d63a8c994e",
"energy": 65000,
"cost": 100,
"date": "2026-10-09T12:00:00",
"source": "api"}
]}GET/v1/prices
Plans and prices.
{"currency": "RUB",
"duration": "1h",
"prices": [
{"energy": 65000, "cost": 100},
{"energy": 66000, "cost": 110},
{"energy": 131000, "cost": 200}
]}03 — errors
| Code | What happened and what to do |
|---|---|
401 | Key missing or foreign. Check the whole header — surrounding spaces count too |
402 | Insufficient balance. The response carries need and balance — top up the difference in the bot |
403 | Key revoked, request from a foreign IP, or user banned |
422 | Unknown plan, malformed address, or address not activated on TRON |
429 | Limit hit. Wait a minute |
502 | Failed to send energy. No charge — retry later with the same client_key |
04 — console
Sends live requests to ….
05 — examples
curl — rent:
curl -X POST https://api.thenergy.xyz/v1/energy/rent -H "X-API-Key: trn_..." -H "Content-Type: application/json" -d '{"address":"T...","energy":65000,"client_key":"order-1"}'Python:
import requests
BASE = "https://api.thenergy.xyz"
HEADERS = {"X-API-Key": "trn_..."} # key from the bot: API button
# balance
print(requests.get(BASE + "/v1/balance", headers=HEADERS).json())
# rent energy
payload = {
"address": "T...",
"energy": 65000,
"client_key": "order-1", # optional field
}
r = requests.post(BASE + "/v1/energy/rent", headers=HEADERS, json=payload)
print(r.status_code, r.json())