GasTank
Documentation menu
← Back to docs

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

ItemContract
AuthenticationAuthorization: Bearer YOUR_API_KEY; browser/admin cookies are not accepted.
Content-TypePOST bodies use application/json; unsupported body fields are rejected. Maximum body size: 8,192 bytes.
Accept-LanguageOptional: en or zh-hans. Labels and messages are display text, not program states.
Scoperead: GET operations. rent: GET plus quote creation and order submission.
MoneyResponses encode integer SUN as decimal strings. 1 TRX = 1,000,000 SUN. Avoid floating-point arithmetic.
ResourcesInteger Energy/Bandwidth units, not staked TRX or transaction counts. Deployment limits still apply.
TimeDuration: integer seconds. Timestamps: ISO 8601 UTC (Z or +00:00).
Nullabilitynull is a value; it does not mean the field is omitted. Listed response fields are present unless stated otherwise.
NetworkThe 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

MethodRelative pathScopeSuccess schema
GETbalance/read / rent200 · Balance
POSTquotes/rent201 · Quote
GETquotes/{quote_id}/read / rent200 · Quote
POSTorders/rent202 · Order
GETorders/read / rent200 · OrderPage
GETorders/{order_id}/read / rent200 · 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 fieldTypeRequiredConstraints
receiver_addressstringYesChecksum-valid TRON wallet that will use the resources.
energy_amountintegerYes0–2^63−1. Positive values must obey deployment minimum and maximum.
bandwidth_amountintegerNoDefault 0; 0–2^63−1. Must be positive when Energy is 0.
duration_secondsintegerYes1–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 parameterTypeRequiredMeaning
quote_idstring · uuidYesQuote 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.

HeaderTypeRequiredConstraints
Idempotency-KeystringYes1–128 characters: letters, digits, ., _, :, -. Persist before the first POST.
Body fieldTypeRequiredConstraints
quote_idstring · uuidYesAn owned quote, valid for a new order.
max_total_sunstring / integerYesPositive 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 parameterTypeRequiredConstraints
idempotency_keystringNoFilter by your persisted request key; response is still OrderPage.
limitintegerNo1–100; default 20.
cursorstringNoOpaque 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 parameterTypeRequiredMeaning
order_idstring · uuidYesOrder 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

FieldTypeMeaning
networkstringmainnet or nile.
assetstringTRX
balance_sunstring · SUNTotal account balance, including holds.
frozen_sunstring · SUNCurrently held funds.
available_sunstring · SUNbalance_sun − frozen_sun.

Quote

FieldTypeMeaning
idstring · uuidQuote ID for order creation.
receiver_addressstringResource receiver.
energy_amount / bandwidth_amountintegerRequested resource units.
duration_secondsintegerShared rental duration in seconds.
rental_fee_sunstring · SUNEnergy rental fee; 0 for Bandwidth-only.
bandwidth_fee_sunstring · SUNComplete Bandwidth rental fee; 0 when not requested.
activation_fee_sunstring · SUNApplicable address activation fee, or 0.
total_sunstring · SUNSum of all three fee fields.
expires_atstring · date-timeQuote 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

FieldTypeMeaning
idstring · uuidOrder ID.
statusstring · enumStable order state; see the state table below.
status_labelstringLocalized display label.
receiver_addressstringResource receiver.
energy_amount / bandwidth_amountintegerRequested quantities.
duration_secondsintegerRental duration in seconds.
total_sunstring · SUNOriginal order total, not necessarily the amount finally charged after partial delivery.
rental / bandwidth / activationobject · FeeSettlementSeparate Energy, Bandwidth and activation settlement.
deliveriesarray · DeliveryPer-resource records; can be empty before preparation. Unrequested resources have no row.
created_atstring · date-timeOrder creation time.
starts_at / expires_atstring · date-time / nullRental start/expiry when established; null before then.
delegate_txidstring / nullEnergy transaction only; null for Bandwidth-only. A not-yet-submitted Energy record can have an empty string. Prefer deliveries.
noticestring / nullLocalized 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

FieldTypeMeaning
amount_sunstring · SUNComponent fee amount.
statusstring · enumheld, charged, released, not_applicable
status_labelstringLocalized display label; use status for logic.
StatusMeaning
heldReserved, not charged yet.
chargedActually charged.
releasedPreviously held funds released.
not_applicableZero 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

FieldTypeMeaning
resourcestring · enumENERGY, BANDWIDTH
amountintegerResource units for this delivery.
statusstring · enumpreparing, pending, delegated, undelegating, undelegated, failed
delegate_txidstring / nullDelegation transaction ID, null until available.
recall_txidstring / nullRecall 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

FieldTypeMeaning
resultsarray · OrderThis page of orders; empty if none match.
next_cursorstring / nullUse as the next cursor; null means no further page.
{
  "results": [],
  "next_cursor": null
}

ApiError

FieldTypeMeaning
codestringStable machine-readable error code.
messagestringLocalized display message.
request_idstringDiagnostic 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 statusInterpretation
created / readyAccepted/preparing; resources not confirmed delivered.
delegatingDelivery in progress or transaction outcome unknown; retain applicable holds.
activeAll requested resources delivered.
partialSome resources delivered, others definitively failed; settle each fee separately.
expiring / expired / undelegatingRental ending / ended / recall in progress.
closedAll successful deliveries have been recalled.
failed / cancelledFailure/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

HTTPcodeMeaning
400invalid_requestInvalid JSON, fields, quantities, pagination or headers.
401invalid_credentialsMissing, revoked, expired or invalid key/account.
403permission_deniedRead-only key attempted a write.
404not_foundNo owned quote/order.
405method_not_allowedUnsupported method; inspect Allow.
409insufficient_balance / order_conflictInsufficient funds, expired quote or conflicting order request.
429rate_limitedWait for Retry-After: 60 before retrying.
503rentals_unavailable / rental_unavailable / temporarily_unavailableRentals disabled; pricing, capacity, chain or limiter unavailable.
500internal_errorUnexpected 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.

BucketDefault per 60 secondsShared by
Authentication120Client IP
GET reads120Account, across all keys
POST quotes/10Account, across all keys
POST orders/10Account, 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.