trongetAPI

tronget API

Аренда энергии и bandwidth в сети TRON и активация адресов из вашего кода. Заказы оплачиваются с баланса аккаунта, результат приходит за секунды — в ответе на запрос статуса или callback-ом.Rent TRON energy and bandwidth and activate addresses from your code. Orders are paid from your account balance and complete in seconds — check the status or receive a callback.

Base URL https://tronget.com POST · JSON HMAC-SHA256 300 запросов/минrequests/min

Быстрый стартQuick start

  1. Получите ключ. Зарегистрируйтесь и в личном кабинете → API нажмите «Создать ключ» — получите API_ID и API_KEY.Get a key. Sign up and in Dashboard → API click “Create key” to get your API_ID and API_KEY.
  2. Пополните баланс в TRX или USDT (TRC-20) — в кабинете или в боте @trongetbot.Top up your balance with TRX or USDT (TRC-20) — in the dashboard or the bot @trongetbot.
  3. Проверьте доступ — /api/account вернёт баланс.Check access — /api/account returns your balance.
  4. Сделайте заказ — /api/energy/order, затем отслеживайте статус через /api/order или callback.Place an order — /api/energy/order, then track it with /api/order or a callback.

Готовый клиент — функция call() с подписью. Примеры ниже используют её.A ready-made client — the signed call() function. The examples below use it.

API_ID=YOUR_API_ID
API_KEY=YOUR_API_KEY

# SIGNATURE = hex(HMAC-SHA256(API_KEY, "POST\n" + path + "\n" + body))
call() {  # call /api/method '{"json":"body"}'
  SIG=$(printf 'POST\n%s\n%s' "$1" "$2" | openssl dgst -sha256 -hmac "$API_KEY" | sed 's/^.* //')
  curl -s -X POST "https://tronget.com$1" \
    -H "Content-Type: application/json" -H "X-API-ID: $API_ID" -H "SIGNATURE: $SIG" -d "$2"
}

call /api/account '{}'
call /api/energy/order '{"quantity":65000,"receiver":"TXYZ...","outter_id":"inv-1001"}'
import hmac, hashlib, json, requests

API_ID  = "YOUR_API_ID"
API_KEY = "YOUR_API_KEY"
BASE    = "https://tronget.com"

def call(path, params=None):
    body = json.dumps(params or {}, separators=(",", ":"))
    msg  = "POST\n" + path + "\n" + body
    sig  = hmac.new(API_KEY.encode(), msg.encode(), hashlib.sha256).hexdigest()
    r = requests.post(BASE + path, data=body, headers={
        "Content-Type": "application/json", "X-API-ID": API_ID, "SIGNATURE": sig})
    return r.json()

print(call("/api/account"))
order = call("/api/energy/order", {"quantity": 65000, "receiver": "TXYZ...", "outter_id": "inv-1001"})
print(order["order"]["id"], order["order"]["status"])
<?php
$apiId  = 'YOUR_API_ID';
$apiKey = 'YOUR_API_KEY';
$base   = 'https://tronget.com';

function call(string $path, array $params = []): array {
    global $apiId, $apiKey, $base;
    $body = json_encode($params ?: new stdClass(), JSON_UNESCAPED_SLASHES);
    $sig  = hash_hmac('sha256', "POST\n" . $path . "\n" . $body, $apiKey);
    $ch = curl_init($base . $path);
    curl_setopt_array($ch, [
        CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body, CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => ['Content-Type: application/json', "X-API-ID: $apiId", "SIGNATURE: $sig"],
    ]);
    return json_decode(curl_exec($ch), true);
}

print_r(call('/api/account'));
$order = call('/api/energy/order', ['quantity' => 65000, 'receiver' => 'TXYZ...', 'outter_id' => 'inv-1001']);
echo $order['order']['id'], ' ', $order['order']['status'];
const crypto = require('crypto');

const API_ID = 'YOUR_API_ID', API_KEY = 'YOUR_API_KEY', BASE = 'https://tronget.com';

async function call(path, params = {}) {
  const body = JSON.stringify(params);
  const sig  = crypto.createHmac('sha256', API_KEY).update('POST\n' + path + '\n' + body).digest('hex');
  const r = await fetch(BASE + path, { method: 'POST', body,
    headers: { 'Content-Type': 'application/json', 'X-API-ID': API_ID, 'SIGNATURE': sig } });
  return r.json();
}

console.log(await call('/api/account'));
const { order } = await call('/api/energy/order', { quantity: 65000, receiver: 'TXYZ...', outter_id: 'inv-1001' });
console.log(order.id, order.status);

АутентификацияAuthentication

Все методы — POST с JSON-телом на https://tronget.com/api/…. В каждом запросе два заголовка:All methods are POST with a JSON body to https://tronget.com/api/…. Every request carries two headers:

ЗаголовокHeaderОписаниеDescription
X-API-IDВаш API_IDYour API_ID
SIGNATUREHMAC-SHA256 на ключе API_KEY в hex (строчными) от строки "POST\n" + path + "\n" + body. path — путь метода, например /api/energy/order; body — ровно те байты, что вы отправляете (для методов без параметров — {}).Lowercase hex HMAC-SHA256 keyed with API_KEY over "POST\n" + path + "\n" + body. path is the method path, e.g. /api/energy/order; body is exactly the bytes you send ({} for methods without parameters).
Подпись привязана к пути — запрос нельзя повторить на другом методе. Подписывайте строку тела, которую реально отправляете: повторная сериализация JSON может поменять пробелы и порядок ключей. API_KEY — секрет: не храните его во фронтенде и в публичных репозиториях. При перевыпуске старый ключ сразу перестаёт работать.The signature is bound to the path, so a request can't be replayed against another method. Sign the exact body string you send — re-serializing JSON may change whitespace or key order. API_KEY is a secret: never ship it to a browser or a public repo. Regenerating the key revokes the old one immediately.
УспехSuccess
{ "status": "success", "…": "…" }
ОшибкаError
{ "status": "error", "code": "auth_failed",
  "message": "Invalid API_ID or SIGNATURE" }

Лимит — 300 запросов в минуту на API_ID (429 rate_limited). Тело может быть и в формате application/x-www-form-urlencoded — подписывается так же.Rate limit: 300 requests per minute per API_ID (429 rate_limited). application/x-www-form-urlencoded bodies are also accepted and signed the same way.

МетодыMethods

POST/api/account

Проверка ключа и баланс аккаунта. Без параметров — тело {}.Checks the key and returns the account balance. No parameters — body {}.

ЗапросRequest
call("/api/account")
ОтветResponse
{
  "status": "success",
  "account": { "api_id": "123", "balance": 1500.75, "currency": "TRX" }
}

POST/api/prices

Актуальные тарифы вашего аккаунта. Цена энергии: floor(quantity / 131000) · price_131000 + (остаток ? price_65000 : 0); точные значения для стандартных объёмов — в table.Current prices for your account. Energy price: floor(quantity / 131000) · price_131000 + (remainder ? price_65000 : 0); exact values for standard volumes are in table.

ЗапросRequest
call("/api/prices")
ОтветResponse
{
  "status": "success",
  "prices": {
    "currency": "TRX", "period": "1h",
    "energy": { "min": 65000, "max": 2000000, "step": 1000,
                "price_65000": 3, "price_131000": 6,
                "table": { "65000": 3, "131000": 6, "262000": 12, "…": "…" } },
    "bandwidth": { "min": 1000, "max": 100000, "step": 100, "price_per_1000": 1 },
    "activation": { "price": 1.5 }
  }
}

POST/api/address

Активирован ли адрес в сети TRON. На неактивированный адрес нельзя делегировать ресурсы — сначала активация.Whether an address is activated on TRON. Resources can't be delegated to an inactive address — activate it first.

ПараметрParameterОбяз.Req.ОписаниеDescription
addressдаyesTRON-адрес (T…)TRON address (T…)
ЗапросRequest
{ "address": "TXYZ..." }
ОтветResponse
{ "status": "success", "address": "TXYZ...", "activated": true }

POST/api/energy/order

Аренда энергии на 1 час. Стоимость списывается с баланса при создании заказа; если доставить не удалось — сумма автоматически возвращается на баланс, заказ получает статус failed.Rents energy for 1 hour. The price is charged when the order is created; if delivery fails the amount is automatically returned to your balance and the order becomes failed.

ПараметрParameterОбяз.Req.ОписаниеDescription
quantityдаyesЭнергия: 65 000 – 2 000 000, кратно 1 000Energy: 65,000 – 2,000,000, multiple of 1,000
receiverдаyesАдрес получателя (должен быть активирован)Recipient address (must be activated)
callback_urlнетnohttp(s)-URL для уведомления о результатеhttp(s) URL to notify about the result
outter_idнетnoВаш идентификатор, до 64 символов. Возвращается в ответе и callback. Повторный запрос с тем же outter_id вернёт уже созданный заказ с "duplicate": true — ретраи безопасны.Your own ID, up to 64 characters. Echoed in responses and callbacks. A repeated request with the same outter_id returns the existing order with "duplicate": true — retries are safe.
ЗапросRequest
{
  "quantity": 131000,
  "receiver": "TXYZ...",
  "callback_url": "https://example.com/hook",
  "outter_id": "inv-1001"
}
ОтветResponse
{
  "status": "success",
  "order": {
    "id": "a60efbea-1161-46d5-bcd1-c54fc80908f3",
    "service": "energy", "receiver": "TXYZ...", "quantity": 131000,
    "price": 6, "currency": "TRX", "status": "pending",
    "tx_hash": "", "outter_id": "inv-1001",
    "created_at": "2026-10-20T12:00:00Z", "done_at": null, "expires_at": null
  }
}

POST/api/bandwidth/order

Аренда bandwidth на 1 час. Параметры как у энергии.Rents bandwidth for 1 hour. Same parameters as energy.

ПараметрParameterОбяз.Req.ОписаниеDescription
quantityдаyesBandwidth: 1 000 – 100 000, кратно 100Bandwidth: 1,000 – 100,000, multiple of 100
receiverдаyesАдрес получателя (должен быть активирован)Recipient address (must be activated)
callback_urlнетnoURL для уведомленияNotification URL
outter_idнетnoВаш идентификатор (идемпотентность)Your ID (idempotency)
ЗапросRequest
{ "quantity": 1000, "receiver": "TXYZ...", "outter_id": "bw-42" }
ОтветResponse
{ "status": "success",
  "order": { "id": "…", "service": "bandwidth", "quantity": 1000,
             "price": 1, "status": "pending", "…": "…" } }

POST/api/activation/order

Активация нового адреса: на него отправляется небольшая сумма TRX. Разовая операция.Activates a new address by sending it a small amount of TRX. One-time operation.

ПараметрParameterОбяз.Req.ОписаниеDescription
receiverдаyesАдрес для активации (ещё не активирован)Address to activate (not yet activated)
callback_urlнетnoURL для уведомленияNotification URL
outter_idнетnoВаш идентификатор (идемпотентность)Your ID (idempotency)
ЗапросRequest
{ "receiver": "TXYZ...", "callback_url": "https://example.com/hook" }
ОтветResponse
{ "status": "success",
  "order": { "id": "…", "service": "activation", "price": 1.5,
             "status": "pending", "…": "…" } }

POST/api/order

Статус заказа любой услуги по его UUID (тип — в поле service).Order status for any service by UUID (type is in the service field).

ПараметрParameterОбяз.Req.ОписаниеDescription
idдаyesUUID заказаOrder UUID
ЗапросRequest
{ "id": "a60efbea-1161-46d5-bcd1-c54fc80908f3" }
ОтветResponse
{
  "status": "success",
  "order": {
    "id": "a60efbea-…", "service": "energy", "status": "success",
    "tx_hash": "50c96029…", "price": 6,
    "done_at": "2026-10-20T12:00:05Z",
    "expires_at": "2026-10-20T13:00:05Z", "…": "…"
  }
}

POST/api/order/list

История заказов, новые первыми.Order history, newest first.

ПараметрParameterОбяз.Req.ОписаниеDescription
limitнетno1–200, по умолчанию 501–200, default 50
offsetнетnoСмещение для пагинацииPagination offset
serviceнетnoenergy | bandwidth | activation
ЗапросRequest
{ "limit": 20, "offset": 0, "service": "energy" }
ОтветResponse
{ "status": "success", "orders": [ { "…": "…" } ],
  "limit": 20, "offset": 0 }

Статусы и callbackStatuses & callbacks

СтатусStatusЗначениеMeaning
pendingВ обработке, обычно до 10 секундProcessing, usually under 10 seconds
successВыполнен: транзакция в tx_hash; для аренды expires_at = done_at + 1 часDone: transaction in tx_hash; for rentals expires_at = done_at + 1 hour
failedНе выполнен: сумма возвращена на баланс, price = 0Not fulfilled: amount returned to balance, price = 0

Если в заказе указан callback_url, при переходе в success или failed мы отправим на него POST с JSON. Заголовок SIGNATURE — HMAC-SHA256 тела на вашем API_KEY (hex): проверяйте его, прежде чем доверять данным. Ответьте HTTP 200 — иначе повторим до 20 раз с интервалом 5 секунд. Обработчик должен быть идемпотентным: одно событие может прийти повторно.If the order has a callback_url, we POST JSON to it when the order becomes success or failed. The SIGNATURE header is the hex HMAC-SHA256 of the body keyed with your API_KEY — verify it before trusting the data. Reply with HTTP 200, otherwise we retry up to 20 times every 5 seconds. Make your handler idempotent: the same event may arrive more than once.

Тело callbackCallback body
{
  "event": "order.success",
  "status": "success",
  "order": {
    "id": "a60efbea-…", "service": "energy", "receiver": "TXYZ...",
    "quantity": 131000, "price": 6, "currency": "TRX",
    "status": "success", "tx_hash": "50c96029…", "outter_id": "inv-1001",
    "created_at": "2026-10-20T12:00:00Z",
    "done_at": "2026-10-20T12:00:05Z", "expires_at": "2026-10-20T13:00:05Z"
  },
  "outter_id": "inv-1001",
  "timestamp": 1792497605
}
Проверка подписиVerifying the signature
# Flask
@app.post("/hook")
def hook():
    body = request.get_data()          # raw bytes!
    calc = hmac.new(API_KEY.encode(), body, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(calc, request.headers.get("SIGNATURE", "")):
        return "bad signature", 400
    data = json.loads(body)
    # data["order"]["id"], data["status"], data["outter_id"]
    return "ok", 200
<?php
$body = file_get_contents('php://input');   // raw body!
$calc = hash_hmac('sha256', $body, $apiKey);
if (!hash_equals($calc, $_SERVER['HTTP_SIGNATURE'] ?? '')) {
    http_response_code(400); exit('bad signature');
}
$data = json_decode($body, true);
// $data['order']['id'], $data['status'], $data['outter_id']
http_response_code(200); echo 'ok';
// Express: raw body required
app.post('/hook', express.raw({ type: '*/*' }), (req, res) => {
  const calc = crypto.createHmac('sha256', API_KEY).update(req.body).digest('hex');
  const sig  = req.get('SIGNATURE') || '';
  if (calc.length !== sig.length ||
      !crypto.timingSafeEqual(Buffer.from(calc), Buffer.from(sig)))
    return res.status(400).send('bad signature');
  const data = JSON.parse(req.body);
  // data.order.id, data.status, data.outter_id
  res.send('ok');
});

Коды ошибокError codes

При ошибке — "status": "error", машинный code и текст message. Обрабатывайте ошибки по code.Errors return "status": "error", a machine-readable code and a human-readable message. Handle errors by code.

codeHTTPКогдаWhen
auth_failed401Неверный API_ID или SIGNATURE, либо нет заголовковInvalid API_ID or SIGNATURE, or headers missing
account_blocked403Аккаунт заблокирован — обратитесь в поддержкуAccount is blocked — contact support
rate_limited429Больше 300 запросов в минутуMore than 300 requests per minute
method_not_allowed405Нужен POSTPOST required
invalid_body400Тело не JSON или слишком большоеBody is not JSON or too large
invalid_receiver400Некорректный адрес получателяInvalid recipient address
invalid_address400Некорректный адрес в /api/addressInvalid address in /api/address
receiver_not_activated400Адрес не активированAddress is not activated
receiver_already_activated400Адрес уже активированAddress is already activated
invalid_quantity400Количество вне диапазона или не кратно шагуQuantity out of range or not a multiple of the step
invalid_callback_url400callback_url — не http(s)-URLcallback_url is not an http(s) URL
invalid_outter_id400outter_id длиннее 64 символовoutter_id longer than 64 characters
insufficient_balance402Недостаточно средств на балансеInsufficient balance
too_many_pending429Слишком много заказов в обработке — подождитеToo many orders in progress — wait and retry
invalid_order_id400id — не UUIDid is not a UUID
order_not_found404Заказ не найденOrder not found
internal_error500Внутренняя ошибка — повторите позже (с тем же outter_id)Internal error — retry later (with the same outter_id)

Вопросы по интеграции — @tronget_support.Integration questions — @tronget_support.