Rental API reference
Look up each operation below, then expand its shared response schema. All paths are relative to OPENAPI_BASE_URL, which includes /openapi/v1/rentals/. Preserve the trailing slash.
Download OpenAPI 3.1 JSON · Integration guide
The JSON describes full API paths and has no production server address. Set the service origin when importing it into Postman or another OpenAPI tool. Examples show structure only; amounts, availability and expiry must come from a fresh quote.
Conventions
| Item | Contract |
|---|---|
| Authentication | Authorization: Bearer YOUR_API_KEY; browser/admin cookies are not accepted. |
| Content-Type | POST bodies use application/json; unsupported body fields are rejected. Maximum body size: 8,192 bytes. |
| Accept-Language | Optional: en or zh-hans. Labels and messages are display text, not program states. |
| Scope | read: GET operations. rent: GET plus quote creation and order submission. |
| Money | Responses encode integer SUN as decimal strings. 1 TRX = 1,000,000 SUN. Avoid floating-point arithmetic. |
| Resources | Integer Energy/Bandwidth units, not staked TRX or transaction counts. Deployment limits still apply. |
| Time | Duration: integer seconds. Timestamps: ISO 8601 UTC (Z or +00:00). |
| Nullability | null is a value; it does not mean the field is omitted. Listed response fields are present unless stated otherwise. |
| Network | The deployment determines the network; use a matching key. No network header is required. |
Keys are created in the console. The complete key is shown once; keep it on your server. Revocation blocks new requests without cancelling accepted orders. Only use HTTPS outside loopback development.
Operations
| Method | Relative path | Scope | Success schema |
|---|---|---|---|
| GET | balance/ | read / rent | 200 · Balance |
| POST | quotes/ | rent | 201 · Quote |
| GET | quotes/{quote_id}/ | read / rent | 200 · Quote |
| POST | orders/ | rent | 202 · Order |
| GET | orders/ | read / rent | 200 · OrderPage |
| GET | orders/{order_id}/ | read / rent | 200 · Order |
GET balance/
No request body or query parameters. Returns 200 · Balance for the authenticated account.
{
"network": "mainnet",
"asset": "TRX",
"balance_sun": "5000000",
"frozen_sun": "1680000",
"available_sun": "3320000"
}
POST quotes/
Requires rent. Returns 201 · Quote.
| Body field | Type | Required | Constraints |
|---|---|---|---|
receiver_address | string | Yes | Checksum-valid TRON wallet that will use the resources. |
energy_amount | integer | Yes | 0–2^63−1. Positive values must obey deployment minimum and maximum. |
bandwidth_amount | integer | No | Default 0; 0–2^63−1. Must be positive when Energy is 0. |
duration_seconds | integer | Yes | 1–2^31−1 seconds; deployment minimum and pricing availability apply. |
{
"receiver_address": "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb",
"energy_amount": 65000,
"bandwidth_amount": 350,
"duration_seconds": 600
}
Both resources cannot be zero. Bandwidth-only is supported by this API; website checkout still requires Energy. Both components share the duration and have independent prices. Unavailable requested resources reject the quote; the service does not silently remove a component. A quote neither freezes funds nor reserves inventory.
Additional errors: 400 invalid_request; 403 permission_denied; 503 rentals_unavailable / rental_unavailable.
GET quotes//
| Path parameter | Type | Required | Meaning |
|---|---|---|---|
quote_id | string · uuid | Yes | Quote ID returned by POST quotes/. |
Returns 200 · Quote. Only the current account can read it; missing or unowned quotes return 404 not_found. Unused quotes may be removed after more than seven days past expiry. Quotes attached to orders are retained.
POST orders/
Requires rent. Returns 202 · Order, including for an unchanged idempotent replay. 202 is acceptance, not confirmed delivery.
| Header | Type | Required | Constraints |
|---|---|---|---|
Idempotency-Key | string | Yes | 1–128 characters: letters, digits, ., _, :, -. Persist before the first POST. |
| Body field | Type | Required | Constraints |
|---|---|---|---|
quote_id | string · uuid | Yes | An owned quote, valid for a new order. |
max_total_sun | string / integer | Yes | Positive SUN spending ceiling, at most 2^63−1. Decimal string recommended. |
{
"quote_id": "11111111-1111-4111-8111-111111111111",
"max_total_sun": "1680000"
}
The ceiling does not override pricing. A quote creates at most one order. Idempotency is shared across keys and browser orders in the same account/network: the same key, quote and ceiling return the original order; changing either field returns 409 order_conflict. There is no external_order_id field.
Additional errors: 400 invalid_request; 403 permission_denied; 409 insufficient_balance / order_conflict; 503 rentals_unavailable / rental_unavailable. Quote expiry and disabling new rentals do not block recovery of accepted requests.
GET orders/
| Query parameter | Type | Required | Constraints |
|---|---|---|---|
idempotency_key | string | No | Filter by your persisted request key; response is still OrderPage. |
limit | integer | No | 1–100; default 20. |
cursor | string | No | Opaque next_cursor from the preceding page, at most 4096 characters. |
Returns 200 · OrderPage. Results are newest first and include this account’s API and browser balance orders. No match returns results: [], not 404. Invalid pagination returns 400 invalid_request. Cursors are bound to account and resource.
GET orders/?idempotency_key=YOUR_PERSISTED_REQUEST_ID
GET orders//
| Path parameter | Type | Required | Meaning |
|---|---|---|---|
order_id | string · uuid | Yes | Order ID from order submission or listing. |
Returns 200 · Order. Read deliveries and fee settlement to determine the outcome. Missing or unowned orders return 404 not_found.
Response schemas
Balance
| Field | Type | Meaning |
|---|---|---|
network | string | mainnet or nile. |
asset | string | TRX |
balance_sun | string · SUN | Total account balance, including holds. |
frozen_sun | string · SUN | Currently held funds. |
available_sun | string · SUN | balance_sun − frozen_sun. |
Quote
| Field | Type | Meaning |
|---|---|---|
id | string · uuid | Quote ID for order creation. |
receiver_address | string | Resource receiver. |
energy_amount / bandwidth_amount | integer | Requested resource units. |
duration_seconds | integer | Shared rental duration in seconds. |
rental_fee_sun | string · SUN | Energy rental fee; 0 for Bandwidth-only. |
bandwidth_fee_sun | string · SUN | Complete Bandwidth rental fee; 0 when not requested. |
activation_fee_sun | string · SUN | Applicable address activation fee, or 0. |
total_sun | string · SUN | Sum of all three fee fields. |
expires_at | string · date-time | Quote expiry, not rental expiry. |
Energy and Bandwidth fees are independently rounded up to 0.01 TRX. The quote confirms all fees; do not calculate your own payable amount from this example.
{
"id": "11111111-1111-4111-8111-111111111111",
"receiver_address": "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb",
"energy_amount": 65000,
"bandwidth_amount": 350,
"duration_seconds": 600,
"rental_fee_sun": "1400000",
"bandwidth_fee_sun": "280000",
"activation_fee_sun": "0",
"total_sun": "1680000",
"expires_at": "2026-10-25T08:02:00Z"
}
Order
| Field | Type | Meaning |
|---|---|---|
id | string · uuid | Order ID. |
status | string · enum | Stable order state; see the state table below. |
status_label | string | Localized display label. |
receiver_address | string | Resource receiver. |
energy_amount / bandwidth_amount | integer | Requested quantities. |
duration_seconds | integer | Rental duration in seconds. |
total_sun | string · SUN | Original order total, not necessarily the amount finally charged after partial delivery. |
rental / bandwidth / activation | object · FeeSettlement | Separate Energy, Bandwidth and activation settlement. |
deliveries | array · Delivery | Per-resource records; can be empty before preparation. Unrequested resources have no row. |
created_at | string · date-time | Order creation time. |
starts_at / expires_at | string · date-time / null | Rental start/expiry when established; null before then. |
delegate_txid | string / null | Energy transaction only; null for Bandwidth-only. A not-yet-submitted Energy record can have an empty string. Prefer deliveries. |
notice | string / null | Localized attention message for partial/failed orders, otherwise null. |
Example of an accepted order before delivery (202):
{
"id": "22222222-2222-4222-8222-222222222222",
"status": "ready",
"status_label": "Awaiting delivery",
"receiver_address": "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb",
"energy_amount": 65000,
"bandwidth_amount": 350,
"duration_seconds": 600,
"total_sun": "1680000",
"rental": {
"amount_sun": "1400000",
"status": "held",
"status_label": "Frozen"
},
"bandwidth": {
"amount_sun": "280000",
"status": "held",
"status_label": "Frozen"
},
"activation": {
"amount_sun": "0",
"status": "not_applicable",
"status_label": "Not applicable"
},
"deliveries": [],
"created_at": "2026-10-25T08:00:00Z",
"starts_at": null,
"expires_at": null,
"delegate_txid": null,
"notice": null
}
FeeSettlement
| Field | Type | Meaning |
|---|---|---|
amount_sun | string · SUN | Component fee amount. |
status | string · enum | held, charged, released, not_applicable |
status_label | string | Localized display label; use status for logic. |
| Status | Meaning |
|---|---|
held | Reserved, not charged yet. |
charged | Actually charged. |
released | Previously held funds released. |
not_applicable | Zero fee / unrequested resource; no hold, charge or release occurred. |
If another party activates the address after a positive activation hold, activation becomes released, not not_applicable. For Bandwidth-only orders rental is zero/not_applicable; without Bandwidth, bandwidth is zero/not_applicable.
Delivery
| Field | Type | Meaning |
|---|---|---|
resource | string · enum | ENERGY, BANDWIDTH |
amount | integer | Resource units for this delivery. |
status | string · enum | preparing, pending, delegated, undelegating, undelegated, failed |
delegate_txid | string / null | Delegation transaction ID, null until available. |
recall_txid | string / null | Recall transaction ID, null until available. |
Delegated means the delegation is confirmed; undelegated means recall is confirmed. Do not substitute order states such as active for these per-resource values. One Energy transaction never proves Bandwidth was delivered.
OrderPage
| Field | Type | Meaning |
|---|---|---|
results | array · Order | This page of orders; empty if none match. |
next_cursor | string / null | Use as the next cursor; null means no further page. |
{
"results": [],
"next_cursor": null
}
ApiError
| Field | Type | Meaning |
|---|---|---|
code | string | Stable machine-readable error code. |
message | string | Localized display message. |
request_id | string | Diagnostic correlation ID, also in X-Request-ID. |
{
"code": "order_conflict",
"message": "The request conflicts with an existing order.",
"request_id": "33333333-3333-4333-8333-333333333333"
}
Order lifecycle and recovery
| Order status | Interpretation |
|---|---|
created / ready | Accepted/preparing; resources not confirmed delivered. |
delegating | Delivery in progress or transaction outcome unknown; retain applicable holds. |
active | All requested resources delivered. |
partial | Some resources delivered, others definitively failed; settle each fee separately. |
expiring / expired / undelegating | Rental ending / ended / recall in progress. |
closed | All successful deliveries have been recalled. |
failed / cancelled | Failure/cancellation; inspect each settled fee and delivery record. |
After a timeout, 500 or lost response, query orders/?idempotency_key=... first, or retry the identical POST with the same key. Do not generate a new key while the original outcome is unknown. Never treat a single failed component as proof that another uncertain transaction failed. Successful components are charged and recalled at expiry; normal expiry does not refund rent.
Errors and rate limits
| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_request | Invalid JSON, fields, quantities, pagination or headers. |
| 401 | invalid_credentials | Missing, revoked, expired or invalid key/account. |
| 403 | permission_denied | Read-only key attempted a write. |
| 404 | not_found | No owned quote/order. |
| 405 | method_not_allowed | Unsupported method; inspect Allow. |
| 409 | insufficient_balance / order_conflict | Insufficient funds, expired quote or conflicting order request. |
| 429 | rate_limited | Wait for Retry-After: 60 before retrying. |
| 503 | rentals_unavailable / rental_unavailable / temporarily_unavailable | Rentals disabled; pricing, capacity, chain or limiter unavailable. |
| 500 | internal_error | Unexpected error; recover the original request before retrying. |
These are application errors on matched endpoints. Invalid URL paths, Host rejection, reverse proxies and Cloudflare can return HTML or a different body. Inspect HTTP status and Content-Type before decoding JSON. Successful application responses and handled errors carry X-Request-ID.
| Bucket | Default per 60 seconds | Shared by |
|---|---|---|
| Authentication | 120 | Client IP |
| GET reads | 120 | Account, across all keys |
| POST quotes/ | 10 | Account, across all keys |
| POST orders/ | 10 | Account, across all keys |
Deployments may adjust these limits. Retries consume quota; use a polling interval and backoff rather than tight loops. Limiter failure returns 503. Deposit addresses, key management and financial history remain in the console; there are no withdrawal or refund operations in this API.