For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a rental

POST /v1/rentals: delegate energy to a sending address for one transaction.

The receiver is the address that sends the transaction and receives the energy. The endpoint returns 201 when the energy is on the address, 202 when the request is queued and 503 CAPACITY_EXHAUSTED when the request cannot be queued.

At a glance

Item
Detail

Method and path

POST /v1/rentals

Authentication

Signed request. See Authentication and signing

Retry-safe

Yes, while the first rental is pending or active: a repeated request returns 409 ACTIVE_RENTAL_EXISTS with the existing rental_id. See Retry behaviour

Rate limit

Per API key. See Conventions and limits

Modes

Mode
You send
We delegate

transaction

The USDT transfer in transaction: token, to and amount. Any token other than USDT returns 400 UNSUPPORTED_TOKEN

The energy the simulated transfer needs, plus 5%

energy

An amount of energy in energy, from 10,000 to 140,000

The amount you set, for any contract call

Request body

Name
Type
Required
Default
Description

mode

string

Yes

None

transaction or energy

receiver

string

Yes

None

Address that sends the transaction and receives the energy

transaction

object

In transaction mode

None

token, to and amount of the transfer

energy

integer

In energy mode

None

Energy to delegate. 10,000 to 140,000

max_wait_seconds

integer

No

300

Longest wait in seconds if the request is queued

activate_if_needed

boolean

No

false

If the receiver is not activated, activate it before delegating the energy

The transaction object holds the transfer. Its fields match the Estimate energy body, without from:

Name
Type
Description

token

string

USDT

to

string

Recipient address

amount

string

Amount in the smallest unit. 10 USDT = "10000000"

Sample request

Sample IDs, addresses and hashes are illustrative.

Transaction mode

The request is signed inline. It needs BASE_URL, API_KEY and API_SECRET in your environment.

signedRequest is the helper from Authentication and signing, saved as tron_energy.mjs.

signed_request is the helper from Authentication and signing, saved as tron_energy.py.

Energy mode

Set the amount of energy yourself. The response has the same fields, with mode set to energy.

The request is signed inline. It needs BASE_URL, API_KEY and API_SECRET in your environment.

signedRequest is the helper from Authentication and signing, saved as tron_energy.mjs.

signed_request is the helper from Authentication and signing, saved as tron_energy.py.

Responses

The energy is on the receiver and the rental is active. Broadcast now.

The request is queued. Poll GET /v1/rentals/{id} every 2 to 5 seconds and broadcast once the status is active.

The address already has a pending or active rental. details holds the existing rental_id.

When the request cannot be queued, the API returns 503 CAPACITY_EXHAUSTED in place of 202. details has reason and estimated_wait_seconds. See Errors.

Response fields

Field
Type
In sample
Description

rental_id

string

201 and 202

Rental ID. Use it to poll GET /v1/rentals/{id}

status

string

201 and 202

active or pending

mode

string

201

transaction or energy

receiver

string

201 and 202

Address that sends the transaction and receives the energy

energy_delegated

integer

201

Energy delegated to the receiver. In transaction mode the simulated need plus 5%

energy_used

integer or null

201

Energy the transaction consumed. null until the rental is reclaimed

delegator

string

201

Luganodes address that delegated the energy

delegate_tx

string

201

Hash of the delegation transaction

activation_tx

string or null

201

Hash of the activation transaction. null when none was needed

created_at

string

201 and 202

Time the rental was created

starts_at

string

201

Start of the 10-second window

expires_at

string

201

End of the 10-second window

pending_reason

string

202

waiting_for_energy or confirming

reason

string

202

Why the rental is queued: busy or daily_limit

estimated_wait_seconds

integer

202

Expected wait before energy is delegated

estimated_ready_at

string

202

Expected time the rental turns active

queue_position

integer

202

Position in the queue

serve_by

string

202

Latest time the rental can be served

Rental lifecycle explains the window, the queue and every status.

Retry behaviour

Each address can hold one pending or active rental at a time. That rule makes a repeated request safe while the first rental is in progress.

Situation
What the API does
What to do

The request is repeated while the first rental is pending or active

Returns 409 ACTIVE_RENTAL_EXISTS with the existing rental_id. No second rental is created

Poll GET /v1/rentals/{id} for that rental

The first rental has ended as reclaimed, failed or expired

The address has no pending or active rental, so a new request is a new rental

Send a new request only if you still need energy for a transaction

The request timed out and the outcome is unknown

The rental may or may not exist

Call GET /v1/accounts/{address}: a value in active_rental_id means the address has a pending or active rental. If there is none, call GET /v1/rentals with the receiver filter: rentals come back newest first, and one created after your request was sent means the first call succeeded. Send the request again only if neither check finds that rental

429 RATE_LIMITED

Returns Retry-After

Wait for Retry-After, then send the request again

502 CHAIN_ERROR

The network was unreachable or the delegation did not land

Check GET /v1/rentals/{id} and send the request again if the rental is failed

503 CAPACITY_EXHAUSTED

The request cannot be queued

Send the transfer and pay TRX, or retry later

503 SERVICE_UNAVAILABLE

Returns Retry-After

Wait for Retry-After, then send the request again

Errors

The full list is in Errors.

HTTP
Code
When
Action
Retry?

400

INVALID_REQUEST

Malformed JSON, missing field or wrong type

Fix the request

No

400

INVALID_ADDRESS

receiver or transaction.to has an invalid format or checksum

Fix the address

No

400

INVALID_AMOUNT

transaction.amount is not a positive whole number in the smallest unit

Fix the amount

No

400

INVALID_DURATION

max_wait_seconds is out of range

Fix the value

No

400

UNSUPPORTED_TOKEN

transaction.token is not USDT

Use USDT

No

401

UNAUTHORIZED

Invalid API key, signature or timestamp

Check your credentials and server clock

After a fix

403

ADDRESS_BLOCKED

An address matched a sanctions list

Stop the transfer. Contact us if you believe the match is wrong

No

409

ACTIVE_RENTAL_EXISTS

The address already has a pending or active rental

Poll the rental in details.rental_id

No

422

SIMULATION_FAILED

The transfer would fail on chain. details.chain_message holds the chain's message

Check the sender's USDT balance

After a fix

422

RECEIVER_NOT_ACTIVATED

The receiver has never been activated on chain

Activate the address first, or set activate_if_needed to true

After a fix

422

RECEIVER_IS_CONTRACT

The receiver is a smart contract

Send from a wallet address

No

422

RENTAL_TOO_LARGE

Energy above max_single_rental

Request less energy

No

429

RATE_LIMITED

Too many requests

Retry after Retry-After

Yes, after Retry-After

429

QUOTA_EXCEEDED

Daily energy quota or queued-rental cap used

Contact us to raise the quota

After a fix

502

CHAIN_ERROR

The network was unreachable or the delegation did not land

Check GET /v1/rentals/{id} and retry if the rental is failed

Yes, after checking

503

CAPACITY_EXHAUSTED

Estimated wait is longer than max_wait_seconds, or no energy is available. details has reason and estimated_wait_seconds

Send the transfer and pay TRX, or retry later

Yes, later

503

SERVICE_UNAVAILABLE

Planned maintenance or an outage

Retry after Retry-After

Yes, after Retry-After

Last updated