Skip to main content
POST
Create Energy Rule

Create Energy Rule

Creates an Auto Refill rule for one address. From the next check on, whenever the address has less available energy than threshold_energy, we buy add_volume energy for one hour and charge your balance. See the overview for how checks, cost and statuses work. The request only creates the rule — it does not buy anything itself. Requires the buy_energy scope. To see the price of one refill first, use Energy Refill Quote.

Request body

string
required
TRON address to keep supplied (T… format, 34 characters). Contract addresses are rejected.
number
required
Buy when the address has less available energy than this. From 1 to 50,000,000.
number
required
Energy to buy per refill. From 32,000 to 5,000,000. Keep it at or above threshold_energy — see the warning in the overview.
string
default:"1h"
Rental duration of each refill. Only "1h" is accepted; any other value returns 422.
string
Your own name for the rule, up to 100 characters. Optional.

Response

The new rule — the same fields as in List Energy Rules — plus two fields about the address right now:
number | null
Energy available on the address at the moment the rule was created. null if it could not be read; the rule is created either way.
boolean
true if current_energy is already below the threshold, so the next check — usually within a minute — will buy. false if the address has enough, or if the level could not be read.

Example

Response

Errors

A validation error comes in the framework’s format, with detail as an array:
Retrying a create after a timeout is safe. If the first request went through, the retry returns 409 AUTOREFILL_ADDRESS_TAKEN instead of making a second rule; list your rules to get its id.