自动带宽
更新订阅
更改、暂停、恢复或迁移自动带宽订阅
PATCH
/
v1
/
bandwidth
/
auto
/
{sub_id}
更新订阅
curl --request PATCH \
--url https://api.tronrental.com/v1/bandwidth/auto/{sub_id} \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"volume": 123,
"address": "<string>",
"token": "<string>",
"contract": {},
"label": {},
"auto_pause": true,
"threshold": 123,
"notify_free_bw": true,
"stop_after_transfer": true
}
'import requests
url = "https://api.tronrental.com/v1/bandwidth/auto/{sub_id}"
payload = {
"enabled": True,
"volume": 123,
"address": "<string>",
"token": "<string>",
"contract": {},
"label": {},
"auto_pause": True,
"threshold": 123,
"notify_free_bw": True,
"stop_after_transfer": True
}
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({
enabled: true,
volume: 123,
address: '<string>',
token: '<string>',
contract: {},
label: {},
auto_pause: true,
threshold: 123,
notify_free_bw: true,
stop_after_transfer: true
})
};
fetch('https://api.tronrental.com/v1/bandwidth/auto/{sub_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.tronrental.com/v1/bandwidth/auto/{sub_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([
'enabled' => true,
'volume' => 123,
'address' => '<string>',
'token' => '<string>',
'contract' => [
],
'label' => [
],
'auto_pause' => true,
'threshold' => 123,
'notify_free_bw' => true,
'stop_after_transfer' => true
]),
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.tronrental.com/v1/bandwidth/auto/{sub_id}"
payload := strings.NewReader("{\n \"enabled\": true,\n \"volume\": 123,\n \"address\": \"<string>\",\n \"token\": \"<string>\",\n \"contract\": {},\n \"label\": {},\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\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.tronrental.com/v1/bandwidth/auto/{sub_id}")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"volume\": 123,\n \"address\": \"<string>\",\n \"token\": \"<string>\",\n \"contract\": {},\n \"label\": {},\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tronrental.com/v1/bandwidth/auto/{sub_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 \"enabled\": true,\n \"volume\": 123,\n \"address\": \"<string>\",\n \"token\": \"<string>\",\n \"contract\": {},\n \"label\": {},\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\n}"
response = http.request(request)
puts response.read_body更新订阅
更改订阅的设置、暂停或恢复订阅,或将其迁移到另一个地址。只需发送要更改的字段,其余保持不变。更改立即生效:每次编辑之后我们都会重新检查该订阅。需要buy_bandwidth 权限。
路径参数
请求体
false 暂停订阅:我们会收回带宽,并在您恢复之前不收取任何费用。true 恢复已暂停或已停止的订阅;与创建时一样,您的余额必须足以支付 24 小时和一笔转账。被客服关闭的订阅(stopped_reason: "admin")无法通过此方式恢复。将订阅迁移到另一个地址。我们先从旧地址收回带宽,再向新地址委托;迁移完成之前,
address_change_to 会显示该迁移。新地址要通过与创建时相同的检查。发送当前地址会取消尚未完成的迁移。来自您的代币列表的合约,用于
CUSTOM 或 OWN。null 将其移除(CUSTOM 时不可)。响应
更新后的订阅,字段与列出订阅中的相同。示例
暂停订阅:curl -X PATCH https://api.tronrental.com/v1/bandwidth/auto/42 \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"enabled": false}'
import requests
resp = requests.patch(
"https://api.tronrental.com/v1/bandwidth/auto/42",
headers={"X-API-Key": "your_api_key"},
json={"enabled": False},
)
print(resp.json())
const resp = await fetch("https://api.tronrental.com/v1/bandwidth/auto/42", {
method: "PATCH",
headers: { "X-API-Key": "your_api_key", "Content-Type": "application/json" },
body: JSON.stringify({ enabled: false }),
});
console.log(await resp.json());
Response
{
"id": 42,
"address": "TYourSenderAddress12345678901234ab",
"label": "Payouts",
"token": "USDT",
"contract": null,
"volume": 350,
"auto_pause": false,
"threshold": 600,
"stop_after_transfer": false,
"notify_free_bw": false,
"status": "paused",
"stopped_reason": null,
"address_change_to": null,
"free_bw": 330,
"delegated_bw": 350,
"transfers": 12,
"delivery_state": "ok",
"paid_until": "2026-11-14T08:15:04Z",
"total_charged_trx": "5.100000",
"daily_trx": "0.340000",
"transfer_trx": "0.340000",
"transfer_bw_trx": "0.140000",
"transfer_fee_trx": "0.200000",
"created_at": "2026-11-10T08:15:00Z"
}
delegated_bw 会在几秒之内降为 0。
错误
| 状态 | 代码 | 触发条件 |
|---|---|---|
400 | INVALID_ADDRESS | 新的 address 不是有效的 TRON 地址,或无法连接 |
400 | CONTRACT_ADDRESS_NOT_SUPPORTED | 新的 address 是智能合约 |
400 | AUTO_BW_INVALID_THRESHOLD | threshold 超出该 volume 所允许的范围 |
400 | AUTO_BW_INVALID_CONTRACT | CUSTOM 但没有合约,或合约搭配了其他代币,或该合约不在您的代币列表中 |
402 | INSUFFICIENT_BALANCE | 恢复订阅时,余额不足以支付 24 小时和一笔转账 |
403 | FORBIDDEN | API 密钥缺少 buy_bandwidth 权限 |
404 | NOT_FOUND | 您的账户中没有该 ID 的订阅(或已被删除) |
409 | AUTO_BW_ADDRESS_TAKEN | 您的另一个订阅已在使用新地址 |
409 | AUTO_BW_ADDRESS_COVERED | 新地址上的带宽已由智能模式或转账套餐维持 |
409 | AUTO_BW_CONTRACT_LISTED | contract 是 USDT 或 USDD 合约——请改用 token |
409 | AUTO_BW_DISABLED_BY_SUPPORT | 该订阅已被客服关闭——请联系我们以恢复 |
422 | — | 字段类型错误或超出范围 |
429 | RATE_LIMIT_EXCEEDED | 编辑请求过多——参见速率限制 |
503 | AUTO_BW_DISABLED | 自动带宽暂时关闭时设置 enabled: true;未做任何更改——请稍后重试 |
⌘I
更新订阅
curl --request PATCH \
--url https://api.tronrental.com/v1/bandwidth/auto/{sub_id} \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"volume": 123,
"address": "<string>",
"token": "<string>",
"contract": {},
"label": {},
"auto_pause": true,
"threshold": 123,
"notify_free_bw": true,
"stop_after_transfer": true
}
'import requests
url = "https://api.tronrental.com/v1/bandwidth/auto/{sub_id}"
payload = {
"enabled": True,
"volume": 123,
"address": "<string>",
"token": "<string>",
"contract": {},
"label": {},
"auto_pause": True,
"threshold": 123,
"notify_free_bw": True,
"stop_after_transfer": True
}
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({
enabled: true,
volume: 123,
address: '<string>',
token: '<string>',
contract: {},
label: {},
auto_pause: true,
threshold: 123,
notify_free_bw: true,
stop_after_transfer: true
})
};
fetch('https://api.tronrental.com/v1/bandwidth/auto/{sub_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.tronrental.com/v1/bandwidth/auto/{sub_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([
'enabled' => true,
'volume' => 123,
'address' => '<string>',
'token' => '<string>',
'contract' => [
],
'label' => [
],
'auto_pause' => true,
'threshold' => 123,
'notify_free_bw' => true,
'stop_after_transfer' => true
]),
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.tronrental.com/v1/bandwidth/auto/{sub_id}"
payload := strings.NewReader("{\n \"enabled\": true,\n \"volume\": 123,\n \"address\": \"<string>\",\n \"token\": \"<string>\",\n \"contract\": {},\n \"label\": {},\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\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.tronrental.com/v1/bandwidth/auto/{sub_id}")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"volume\": 123,\n \"address\": \"<string>\",\n \"token\": \"<string>\",\n \"contract\": {},\n \"label\": {},\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tronrental.com/v1/bandwidth/auto/{sub_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 \"enabled\": true,\n \"volume\": 123,\n \"address\": \"<string>\",\n \"token\": \"<string>\",\n \"contract\": {},\n \"label\": {},\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\n}"
response = http.request(request)
puts response.read_body