Auto Refill
Update Energy Rule
Change, pause or resume an energy Auto Refill rule
PATCH
/
api
/
v1
/
energy
/
auto-refill
/
{rule_id}
Update Energy Rule
curl --request PATCH \
--url https://api.example.com/api/v1/energy/auto-refill/{rule_id} \
--header 'Content-Type: application/json' \
--data '
{
"threshold_energy": 123,
"add_volume": 123,
"label": "<string>",
"status": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/energy/auto-refill/{rule_id}"
payload = {
"threshold_energy": 123,
"add_volume": 123,
"label": "<string>",
"status": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({threshold_energy: 123, add_volume: 123, label: '<string>', status: '<string>'})
};
fetch('https://api.example.com/api/v1/energy/auto-refill/{rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/energy/auto-refill/{rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'threshold_energy' => 123,
'add_volume' => 123,
'label' => '<string>',
'status' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/energy/auto-refill/{rule_id}"
payload := strings.NewReader("{\n \"threshold_energy\": 123,\n \"add_volume\": 123,\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/api/v1/energy/auto-refill/{rule_id}")
.header("Content-Type", "application/json")
.body("{\n \"threshold_energy\": 123,\n \"add_volume\": 123,\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/energy/auto-refill/{rule_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"threshold_energy\": 123,\n \"add_volume\": 123,\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyUpdate Energy Rule
Changes the threshold, volume or label of a rule, or pauses and resumes it. Send only the fields you want to change; the others stay as they are. Changes apply from the next check. Requires thebuy_energy scope.
The address and the duration of a rule cannot be changed. To move a rule to another address, delete it and create a new one.
Path parameters
number
required
Rule ID — the
id from Create or List Energy RulesRequest body
number
New threshold. From 1 to 50,000,000.
number
New energy amount per refill. From 32,000 to 5,000,000.
string
New label, up to 100 characters. An empty string removes the label.
string
"paused" to pause the rule, "active" to resume it. Resuming also clears stopped_reason and resets consecutive_failures to 0. A rule stopped for balance resumes on its own after a deposit, so you do not have to; if you resume it while the balance is still short, it stops again at the next check. stopped_insufficient_balance cannot be set directly.Response
The updated rule, with the same fields as in List Energy Rules.Example
curl -X PATCH https://api.tronrental.com/v1/energy/auto-refill/12 \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"status": "paused"}'
import requests
resp = requests.patch(
"https://api.tronrental.com/v1/energy/auto-refill/12",
headers={"X-API-Key": "your_api_key"},
json={"status": "paused"},
)
print(resp.json())
const resp = await fetch("https://api.tronrental.com/v1/energy/auto-refill/12", {
method: "PATCH",
headers: { "X-API-Key": "your_api_key", "Content-Type": "application/json" },
body: JSON.stringify({ status: "paused" }),
});
console.log(await resp.json());
Response
{
"id": 12,
"target_address": "TYourRecipientAddress1234567890abc",
"label": "Hot wallet",
"threshold_energy": 65000,
"add_volume": 131000,
"duration": "1h",
"status": "paused",
"stopped_reason": null,
"consecutive_failures": 0,
"last_checked_at": "2026-10-14T09:41:02Z",
"last_available_energy": 212480,
"last_read_error_at": null,
"last_refill_at": "2026-10-14T08:57:40Z",
"refill_count": 3,
"total_spent_trx": "7.854000",
"created_at": "2026-10-14T08:12:05Z",
"estimated_cost_per_refill_trx": "2.618000",
"volume_below_threshold": false
}
Errors
| Status | Code | When |
|---|---|---|
403 | FORBIDDEN | The API key lacks the buy_energy scope |
404 | NOT_FOUND | No energy rule with this ID on your account (or it was deleted) |
409 | AUTOREFILL_IN_PROGRESS | A refill for this rule is being bought right now — retry in a minute |
422 | — | A value is out of range, or status is not "active" or "paused" |
{
"detail": {
"error": {
"code": "AUTOREFILL_IN_PROGRESS",
"message": "A refill is in progress for this rule; try again in a minute"
}
}
}
⌘I
Update Energy Rule
curl --request PATCH \
--url https://api.example.com/api/v1/energy/auto-refill/{rule_id} \
--header 'Content-Type: application/json' \
--data '
{
"threshold_energy": 123,
"add_volume": 123,
"label": "<string>",
"status": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/energy/auto-refill/{rule_id}"
payload = {
"threshold_energy": 123,
"add_volume": 123,
"label": "<string>",
"status": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({threshold_energy: 123, add_volume: 123, label: '<string>', status: '<string>'})
};
fetch('https://api.example.com/api/v1/energy/auto-refill/{rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/energy/auto-refill/{rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'threshold_energy' => 123,
'add_volume' => 123,
'label' => '<string>',
'status' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/energy/auto-refill/{rule_id}"
payload := strings.NewReader("{\n \"threshold_energy\": 123,\n \"add_volume\": 123,\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/api/v1/energy/auto-refill/{rule_id}")
.header("Content-Type", "application/json")
.body("{\n \"threshold_energy\": 123,\n \"add_volume\": 123,\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/energy/auto-refill/{rule_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"threshold_energy\": 123,\n \"add_volume\": 123,\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body