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.
Быстрый стартQuick start
- Получите ключ. Зарегистрируйтесь и в личном кабинете → API нажмите «Создать ключ» — получите
API_IDиAPI_KEY.Get a key. Sign up and in Dashboard → API click “Create key” to get yourAPI_IDandAPI_KEY. - Пополните баланс в TRX или USDT (TRC-20) — в кабинете или в боте @trongetbot.Top up your balance with TRX or USDT (TRC-20) — in the dashboard or the bot @trongetbot.
- Проверьте доступ —
/api/accountвернёт баланс.Check access —/api/accountreturns your balance. - Сделайте заказ —
/api/energy/order, затем отслеживайте статус через/api/orderили callback.Place an order —/api/energy/order, then track it with/api/orderor 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 |
SIGNATURE | HMAC-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). |
{ "status": "success", "…": "…" }{ "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 {}.
call("/api/account"){
"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.
call("/api/prices"){
"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 | даyes | TRON-адрес (T…)TRON address (T…) |
{ "address": "TXYZ..." }{ "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 | нетno | http(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. |
{
"quantity": 131000,
"receiver": "TXYZ...",
"callback_url": "https://example.com/hook",
"outter_id": "inv-1001"
}{
"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 | даyes | Bandwidth: 1 000 – 100 000, кратно 100Bandwidth: 1,000 – 100,000, multiple of 100 |
receiver | даyes | Адрес получателя (должен быть активирован)Recipient address (must be activated) |
callback_url | нетno | URL для уведомленияNotification URL |
outter_id | нетno | Ваш идентификатор (идемпотентность)Your ID (idempotency) |
{ "quantity": 1000, "receiver": "TXYZ...", "outter_id": "bw-42" }{ "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 | нетno | URL для уведомленияNotification URL |
outter_id | нетno | Ваш идентификатор (идемпотентность)Your ID (idempotency) |
{ "receiver": "TXYZ...", "callback_url": "https://example.com/hook" }{ "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 | даyes | UUID заказаOrder UUID |
{ "id": "a60efbea-1161-46d5-bcd1-c54fc80908f3" }{
"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 | нетno | 1–200, по умолчанию 501–200, default 50 |
offset | нетno | Смещение для пагинацииPagination offset |
service | нетno | energy | bandwidth | activation |
{ "limit": 20, "offset": 0, "service": "energy" }{ "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.
{
"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
}# 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.
| code | HTTP | КогдаWhen |
|---|---|---|
auth_failed | 401 | Неверный API_ID или SIGNATURE, либо нет заголовковInvalid API_ID or SIGNATURE, or headers missing |
account_blocked | 403 | Аккаунт заблокирован — обратитесь в поддержкуAccount is blocked — contact support |
rate_limited | 429 | Больше 300 запросов в минутуMore than 300 requests per minute |
method_not_allowed | 405 | Нужен POSTPOST required |
invalid_body | 400 | Тело не JSON или слишком большоеBody is not JSON or too large |
invalid_receiver | 400 | Некорректный адрес получателяInvalid recipient address |
invalid_address | 400 | Некорректный адрес в /api/addressInvalid address in /api/address |
receiver_not_activated | 400 | Адрес не активированAddress is not activated |
receiver_already_activated | 400 | Адрес уже активированAddress is already activated |
invalid_quantity | 400 | Количество вне диапазона или не кратно шагуQuantity out of range or not a multiple of the step |
invalid_callback_url | 400 | callback_url — не http(s)-URLcallback_url is not an http(s) URL |
invalid_outter_id | 400 | outter_id длиннее 64 символовoutter_id longer than 64 characters |
insufficient_balance | 402 | Недостаточно средств на балансеInsufficient balance |
too_many_pending | 429 | Слишком много заказов в обработке — подождитеToo many orders in progress — wait and retry |
invalid_order_id | 400 | id — не UUIDid is not a UUID |
order_not_found | 404 | Заказ не найденOrder not found |
internal_error | 500 | Внутренняя ошибка — повторите позже (с тем же outter_id)Internal error — retry later (with the same outter_id) |
Вопросы по интеграции — @tronget_support.Integration questions — @tronget_support.