Energy API — Documentation

Energy API — Documentation

Interactive Python examples • Auth via X-API-Key • Issued in Telegram: @saving_trx_bot

✅
Start in 30 seconds: set X-API-Key, use https://YOUR_API_URL, run the Python snippets below.
Base URL
https://YOUR_API_URL
All requests require header X-API-Key: <YOUR_KEY>. Use Idempotency-Key for POSTs.

GET /v1/me/balance

Get current balance in SUN and TRX.

Python
import requests

BASE_URL = "https://YOUR_API_URL"
API_KEY = "YOUR_API_KEY"

r = requests.get(
    f"{BASE_URL}/v1/me/balance",
    headers={"X-API-Key": API_KEY},
    timeout=15
)
print(r.status_code)
print(r.json())
Response schema
{
  "balance_sun": 123456789,
  "balance_trx": 123.456789
}

GET /v1/me/transactions

List recent transactions (top-ups, energy orders, etc.).

Python
import requests

BASE_URL = "https://YOUR_API_URL"
API_KEY = "YOUR_API_KEY"

params = {"limit": 50}  # 1..500, default 50
r = requests.get(
    f"{BASE_URL}/v1/me/transactions",
    headers={"X-API-Key": API_KEY},
    params=params,
    timeout=20
)
print(r.status_code)
for item in r.json():
    print(item["id"], item["kind"], item["status"], item.get("energy"))
Response example
[
  {
    "id": 1,
    "kind": "ORDER",
    "amount": 65000,
    "wallet": "TX...",
    "energy": 65000,
    "status": "DONE",
    "balance_before": 123456,
    "balance_after": 58456,
    "created_at": "2025-01-01T12:00:00Z"
  }
]

POST /v1/order

Create energy order for a TRON wallet.

⚠️ Use Idempotency-Key to avoid duplicate orders on retries.
Python
import requests
import uuid

BASE_URL = "https://YOUR_API_URL"
API_KEY = "YOUR_API_KEY"

payload = {
    "wallet": "TX12345678901234567890123456789012",  # 34 chars, starts with 'T'
    "energy": 65000  # or 130000
}

headers = {
    "X-API-Key": API_KEY,
    "Idempotency-Key": str(uuid.uuid4()),  # optional but recommended
    "Content-Type": "application/json"
}

r = requests.post(
    f"{BASE_URL}/v1/order",
    headers=headers,
    json=payload,
    timeout=20
)
print(r.status_code)
print(r.json())
200 Response
{
  "ok": true,
  "balance_sun_after": 999999,
  "balance_trx_after": 999.999,
  "price_trx": 2.9,
  "price_currency": "TRX",
  "external_status_code": 200,
  "external_order_id": null,
  "external_body": null,
  "tx_id": 12345
}

GET /v1/me/profile

Get client profile and balances.

Python
import requests

BASE_URL = "https://YOUR_API_URL"
API_KEY = "YOUR_API_KEY"

r = requests.get(
    f"{BASE_URL}/v1/me/profile",
    headers={"X-API-Key": API_KEY},
    timeout=15
)
print(r.json())
200 Response
{
  "api_key": "...",
  "name": "Partner A",
  "description": "OTC desk",
  "balance_sun": 123456789,
  "balance_trx": 123.456789,
  "deposit_address": "TX..."
}

GET /v1/me/tariffs

Get current tariffs for energy packages.

Python
import requests

BASE_URL = "https://YOUR_API_URL"
API_KEY = "YOUR_API_KEY"

r = requests.get(
    f"{BASE_URL}/v1/me/tariffs",
    headers={"X-API-Key": API_KEY},
    timeout=15
)
print(r.json())
200 Response
{
  "65000": 2.9,
  "130000": 5.8
}
© 2025 Energy API • Access & keys issued via Telegram: @saving_trx_bot