Auto Refill
Update Bandwidth Rule
Change, pause or resume a bandwidth Auto Refill rule
PATCH
/
api
/
v1
/
bandwidth
/
auto-refill
/
{rule_id}
Update Bandwidth Rule
curl --request PATCH \
--url https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id} \
--header 'Content-Type: application/json' \
--data '
{
"threshold_bandwidth": 123,
"add_volume": 123,
"duration": "<string>",
"label": "<string>",
"status": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}"
payload = {
"threshold_bandwidth": 123,
"add_volume": 123,
"duration": "<string>",
"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_bandwidth: 123,
add_volume: 123,
duration: '<string>',
label: '<string>',
status: '<string>'
})
};
fetch('https://api.example.com/api/v1/bandwidth/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/bandwidth/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_bandwidth' => 123,
'add_volume' => 123,
'duration' => '<string>',
'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/bandwidth/auto-refill/{rule_id}"
payload := strings.NewReader("{\n \"threshold_bandwidth\": 123,\n \"add_volume\": 123,\n \"duration\": \"<string>\",\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/bandwidth/auto-refill/{rule_id}")
.header("Content-Type", "application/json")
.body("{\n \"threshold_bandwidth\": 123,\n \"add_volume\": 123,\n \"duration\": \"<string>\",\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/bandwidth/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_bandwidth\": 123,\n \"add_volume\": 123,\n \"duration\": \"<string>\",\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyUpdate Bandwidth Rule
Changes the threshold, volume, duration 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_bandwidth scope.
The address 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 Bandwidth RulesRequest body
number
New threshold. From 1 to 1,000,000.
number
New bandwidth amount per refill. From 350 to 100,000.
string
New rental duration for future refills:
"1h" or "1d". Rentals already bought keep their duration.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 Bandwidth Rules.Example
curl -X PATCH https://api.tronrental.com/v1/bandwidth/auto-refill/15 \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"duration": "1d"}'
import requests
resp = requests.patch(
"https://api.tronrental.com/v1/bandwidth/auto-refill/15",
headers={"X-API-Key": "your_api_key"},
json={"duration": "1d"},
)
print(resp.json())
const resp = await fetch("https://api.tronrental.com/v1/bandwidth/auto-refill/15", {
method: "PATCH",
headers: { "X-API-Key": "your_api_key", "Content-Type": "application/json" },
body: JSON.stringify({ duration: "1d" }),
});
console.log(await resp.json());
Response
{
"id": 15,
"target_address": "TYourRecipientAddress1234567890abc",
"label": "Payouts",
"threshold_bandwidth": 1000,
"add_volume": 5000,
"duration": "1d",
"status": "active",
"stopped_reason": null,
"consecutive_failures": 0,
"last_checked_at": "2026-10-14T09:41:02Z",
"last_available_bandwidth": 3655,
"last_read_error_at": null,
"last_refill_at": "2026-10-14T09:12:30Z",
"refill_count": 4,
"total_spent_trx": "1.480000",
"created_at": "2026-10-14T08:15:00Z",
"estimated_cost_per_refill_trx": "0.500000",
"volume_below_threshold": false
}
Errors
| Status | Code | When |
|---|---|---|
403 | FORBIDDEN | The API key lacks the buy_bandwidth scope |
404 | NOT_FOUND | No bandwidth 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, duration is not "1h" or "1d", 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 Bandwidth Rule
curl --request PATCH \
--url https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id} \
--header 'Content-Type: application/json' \
--data '
{
"threshold_bandwidth": 123,
"add_volume": 123,
"duration": "<string>",
"label": "<string>",
"status": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}"
payload = {
"threshold_bandwidth": 123,
"add_volume": 123,
"duration": "<string>",
"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_bandwidth: 123,
add_volume: 123,
duration: '<string>',
label: '<string>',
status: '<string>'
})
};
fetch('https://api.example.com/api/v1/bandwidth/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/bandwidth/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_bandwidth' => 123,
'add_volume' => 123,
'duration' => '<string>',
'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/bandwidth/auto-refill/{rule_id}"
payload := strings.NewReader("{\n \"threshold_bandwidth\": 123,\n \"add_volume\": 123,\n \"duration\": \"<string>\",\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/bandwidth/auto-refill/{rule_id}")
.header("Content-Type", "application/json")
.body("{\n \"threshold_bandwidth\": 123,\n \"add_volume\": 123,\n \"duration\": \"<string>\",\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/bandwidth/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_bandwidth\": 123,\n \"add_volume\": 123,\n \"duration\": \"<string>\",\n \"label\": \"<string>\",\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body