TRONENS API
Complete TRONENS API v1 contract: pricing, Energy estimation, order creation, status, balance and webhooks.
Response format
A real API response always contains success and, on success, data. Errors contain a machine-readable error code. The diagnostic test file also shows method, url, http_code, duration_ms, request, response and curl_error; those fields are not part of the public API. The actual TRONENS response is the value inside response.
{
"success": true,
"data": { ... }
}{
"success": false,
"error": "ERROR_CODE"
}Authentication
Authorization: Bearer te_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/jsonSend the Bearer token in the Authorization header. The key is created in the account and shown in full only once.
| Scope | Access |
|---|---|
quote | Quote + Energy estimate |
orders:create | Create order + Bulk API |
orders:read | Order status |
balance | Balance |
Each key can have an IP whitelist, per-minute rate limit and expiration. Responses include X-RateLimit-Limit and X-RateLimit-Remaining; HTTP 429 also includes Retry-After.
/api/v1/quote/Quote
Returns the customer price including the account discount.
GET /api/v1/quote/?package_id=1&duration_minutes=15
GET /api/v1/quote/?energy_amount=65000&duration_minutes=60| Field | Meaning |
|---|---|
type | Quote type: package or custom. |
package_id | Package ID; package quotes only. |
name | Package name; package quotes only. |
energy_amount | Amount of Energy the customer buys. |
duration_minutes | Rental duration in minutes. |
base_price_trx | Price before the account discount. |
discount_percent | Discount actually applied, in percent. |
discount_trx | Discount amount in TRX. |
price_trx | Final amount charged to the customer. |
Example response
{
"success": true,
"data": {
"type": "custom",
"energy_amount": 65000,
"duration_minutes": 60,
"base_price_trx": 1.961,
"discount_percent": 0,
"discount_trx": 0,
"price_trx": 2.05
}
}/api/v1/estimate/Energy estimate
Estimates the Energy requirement for a recipient TRON address.
{
"recipient_address": "T...",
"has_usdt": true
}| Field | Meaning |
|---|---|
recipient_address | Recipient TRON address. |
has_usdt | Optional boolean: whether a USDT TRC20 operation is planned. |
| Field | Meaning |
|---|---|
estimated_energy | Estimated required Energy amount. |
recommended_package | Matching active package or null when none fits. |
Example response
{
"success": true,
"data": {
"estimated_energy": 65000,
"recommended_package": {
"id": 1,
"name": "65 000 Energy",
"energy_amount": 65000,
"duration_minutes": 15
}
}
}/api/v1/order/Create order
Creates a real order and debits the calculated amount from the account TRX balance. The recipient TRON address must already be activated before the order is created. New API orders are accepted asynchronously with HTTP 202. Always use external_id when possible: repeating it returns the existing order without a second debit.
{
"external_id": "merchant_93481",
"package_id": 1,
"duration_minutes": 15,
"address": "T..."
}| Field | Meaning |
|---|---|
external_id | Your unique ID (max 128 chars: A-Z, a-z, 0-9, . _ : -). |
package_id | Package ID. Use package_id OR energy_amount. |
energy_amount | Custom Energy amount. Custom uses the available duration, currently 60 min. |
duration_minutes | Rental duration. |
address | Recipient TRON address. |
| Field | Meaning |
|---|---|
order_id | TRONENS order ID. |
external_id | Your order ID. Used for idempotency and status lookup. |
status | Current public order status. |
idempotent | true means this external_id already existed and no new order was created. |
Example response
HTTP 202
{
"success": true,
"data": {
"order_id": 123,
"external_id": "merchant_93481",
"status": "processing",
"idempotent": false
}
}Bulk API
/api/v1/orders/bulk/Creates up to 50 orders in one request. Every item has its own external_id and accepted/failed result. Requires orders:create. Accepted orders use the normal status and webhook flow.
Request fields
{
"orders": [
{"external_id":"bulk-001","package_id":1,"duration_minutes":15,"address":"T..."},
{"external_id":"bulk-002","energy_amount":65000,"duration_minutes":60,"address":"T..."}
]
}1–50 orders · permission: orders:create · HTTP 202 / 207
Example response
{
"success": true,
"data": {
"accepted": 1,
"failed": 1,
"results": [
{"index":0,"external_id":"bulk-001","status":"accepted","order":{"id":123}},
{"index":1,"external_id":"bulk-002","status":"failed","error":"INVALID_TRON_ADDRESS"}
]
}
}/api/v1/status/Order status
Returns the current order data and status.
GET /api/v1/status/?id=123
GET /api/v1/status/?external_id=merchant_93481| Field | Meaning |
|---|---|
id | TRONENS order ID. |
external_id | Your external ID or null. |
address | Recipient TRON address. |
energy_amount | Ordered Energy amount. |
duration_minutes | Rental duration in minutes. |
price_trx | TRX amount charged for the order. |
status | Current status. |
txid | Delegation TXID when available; otherwise null. |
refunded | true when the order amount has already been refunded to the account balance. |
error_code | Safe public code: ORDER_REVIEW, ORDER_FAILED or null. |
created_at | Order creation time. |
delivered_at | Confirmed Energy delivery time or null. |
completed_at | Full rental completion time or null. |
updated_at | Last order update time. |
Time fields use YYYY-MM-DD HH:MM:SS in the TRONENS server timezone.
Example response
{
"success": true,
"data": {
"id": 123,
"external_id": "merchant_93481",
"address": "T...",
"energy_amount": 65000,
"duration_minutes": 15,
"price_trx": 1.14,
"status": "delegated",
"txid": "...",
"refunded": false,
"error_code": null,
"created_at": "2026-10-03 18:01:00",
"delivered_at": "2026-10-03 18:01:12",
"completed_at": null,
"updated_at": "2026-10-03 18:01:12"
}
}Status
| Status | Meaning |
|---|---|
processing | Accepted and being processed. |
delegating | Delegation is being sent or awaiting confirmation. |
delegated | Energy delivered; rental is active. |
undelegating | Rental period ended; resource is being reclaimed. |
completed | Rental lifecycle fully completed. |
review | Additional verification is required. Do not create a duplicate order. |
failed | Confirmed failure. refunded tells whether the balance was already returned. |
/api/v1/balance/Balance
Current available TRX balance of the account.
| Field | Meaning |
|---|---|
balance_trx | Available customer balance in TRX. |
{"success":true,"data":{"balance_trx":125.5}}Webhook
Webhooks deliver order data when its status changes. Verify the signature against the raw JSON body and webhook secret.
X-Webhook-Event: order.delegated
X-Webhook-Id: order-123-order.delegated-...
X-Webhook-Signature: sha256=<hex_hmac>
expected = HMAC_SHA256(raw_json_body, webhook_secret){
"event": "order.delegated",
"event_id": "order-123-order.delegated-...",
"created_at": "2026-10-03T15:01:12Z",
"data": {
"order_id": 123,
"external_id": "merchant_93481",
"address": "T...",
"energy_amount": 65000,
"duration_minutes": 15,
"price_trx": 1.14,
"status": "delegated",
"txid": "...",
"refunded": false,
"error_code": null,
"created_at": "2026-10-03 18:01:00",
"delivered_at": "2026-10-03 18:01:12",
"completed_at": null,
"updated_at": "2026-10-03 18:01:12"
}
}Events: order.processing, order.delegating, order.delegated, order.undelegating, order.completed, order.review, order.failed. HTTP 2xx marks delivery successful; temporary failures are retried up to 8 times with backoff. Deduplicate by event_id.
Errors
error codes are intended for programmatic handling. Use the HTTP status and the error field.
| HTTP | error | Meaning |
|---|---|---|
| 401 | UNAUTHORIZED / TOKEN_EXPIRED | Invalid or expired API key. |
| 403 | SCOPE_FORBIDDEN / IP_NOT_ALLOWED | Required scope is missing or the IP is not allowed. |
| 402 | INSUFFICIENT_BALANCE | Insufficient TRX balance. |
| 400 | INVALID_JSON | Invalid JSON body. |
| 413 | REQUEST_TOO_LARGE | JSON body is too large. |
| 400 | ID_REQUIRED | status requires id or external_id. |
| 404 | NOT_FOUND / PACKAGE_NOT_FOUND | Order or package not found. |
| 422 | EXTERNAL_ID_INVALID | external_id is invalid. |
| 422 | INVALID_TRON_ADDRESS | Invalid TRON address. |
| 422 | ADDRESS_NOT_ACTIVE | The TRON address is not activated yet. Activate it before creating an order. |
| 422 | PRODUCT_REQUIRED / PRODUCT_SELECTOR_CONFLICT | Provide exactly one of package_id or energy_amount. |
| 422 | CUSTOM_ENERGY_DISABLED | Custom Energy ordering is currently disabled. |
| 422 | CUSTOM_ENERGY_OUT_OF_RANGE | Custom Energy amount is outside current limits. |
| 422 | CUSTOM_ENERGY_INVALID_STEP | Custom Energy amount does not match the configured step. |
| 422 | RENTAL_DURATION_UNAVAILABLE / CUSTOM_DURATION_UNAVAILABLE / DURATION_PRICE_UNAVAILABLE | Requested rental duration is unavailable. |
| 503 | SERVICE_UNAVAILABLE | Service temporarily unavailable; retry later. |
| 429 | RATE_LIMITED | API key request limit exceeded. |
| 405 | METHOD_NOT_ALLOWED | Wrong HTTP method. Use the method documented for the endpoint. |