自动带宽
创建订阅
在地址上保持带宽,并在每笔转账后续期
POST
/
v1
/
bandwidth
/
auto
创建订阅
curl --request POST \
--url https://api.tronrental.com/v1/bandwidth/auto \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"volume": 123,
"token": "<string>",
"contract": "<string>",
"label": "<string>",
"auto_pause": true,
"threshold": 123,
"notify_free_bw": true,
"stop_after_transfer": true
}
'import requests
url = "https://api.tronrental.com/v1/bandwidth/auto"
payload = {
"address": "<string>",
"volume": 123,
"token": "<string>",
"contract": "<string>",
"label": "<string>",
"auto_pause": True,
"threshold": 123,
"notify_free_bw": True,
"stop_after_transfer": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
address: '<string>',
volume: 123,
token: '<string>',
contract: '<string>',
label: '<string>',
auto_pause: true,
threshold: 123,
notify_free_bw: true,
stop_after_transfer: true
})
};
fetch('https://api.tronrental.com/v1/bandwidth/auto', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '<string>',
'volume' => 123,
'token' => '<string>',
'contract' => '<string>',
'label' => '<string>',
'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"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"volume\": 123,\n \"token\": \"<string>\",\n \"contract\": \"<string>\",\n \"label\": \"<string>\",\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tronrental.com/v1/bandwidth/auto")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"volume\": 123,\n \"token\": \"<string>\",\n \"contract\": \"<string>\",\n \"label\": \"<string>\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"<string>\",\n \"volume\": 123,\n \"token\": \"<string>\",\n \"contract\": \"<string>\",\n \"label\": \"<string>\",\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创建订阅
为一个地址创建自动带宽订阅。从下一次检查起——通常在几秒之内——我们会为该地址保持委托volume 带宽,并在每笔用完它的转账后续期。续期、费用和状态的工作方式参见概述。
请求本身不收取任何费用,但您的余额必须足以支付前 24 小时和一笔转账——如果地址在链上尚不存在,还要加上激活费用——否则返回 402 INSUFFICIENT_BALANCE。需要 buy_bandwidth 权限。如需先查看价格,请使用自动带宽报价。
请求体
地址发送的代币:
"USDT"、"TRX"、"USDD"、"CUSTOM" 或 "OWN"。它并不限制覆盖哪些转账——参见代币。来自您的代币列表的 TRC-20 合约地址。
token: "CUSTOM" 时必填,"OWN" 时可选,其他代币不接受。用于
auto_pause 和 notify_free_bw 的免费带宽水平。范围 1 至 600;开启其中任一选项时,必须介于 volume 与 345 中较大者和 600 之间。未开启 auto_pause 时,volume 高于 600 允许取 600。响应
新建的订阅,字段与列出订阅中的相同。刚创建时,delegated_bw 为 0,paid_until 为 null:首次委托会在几秒之内进行。
示例
curl -X POST https://api.tronrental.com/v1/bandwidth/auto \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"address": "TYourSenderAddress12345678901234ab",
"volume": 350,
"token": "USDT",
"label": "Payouts"
}'
import requests
resp = requests.post(
"https://api.tronrental.com/v1/bandwidth/auto",
headers={"X-API-Key": "your_api_key"},
json={
"address": "TYourSenderAddress12345678901234ab",
"volume": 350,
"token": "USDT",
"label": "Payouts",
},
)
print(resp.json())
const resp = await fetch("https://api.tronrental.com/v1/bandwidth/auto", {
method: "POST",
headers: { "X-API-Key": "your_api_key", "Content-Type": "application/json" },
body: JSON.stringify({
address: "TYourSenderAddress12345678901234ab",
volume: 350,
token: "USDT",
label: "Payouts",
}),
});
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": "active",
"stopped_reason": null,
"address_change_to": null,
"free_bw": null,
"delegated_bw": 0,
"transfers": 0,
"delivery_state": "ok",
"paid_until": null,
"total_charged_trx": "0.000000",
"daily_trx": "0.340000",
"transfer_trx": "0.340000",
"transfer_bw_trx": "0.140000",
"transfer_fee_trx": "0.200000",
"created_at": "2026-11-13T08:15:00Z"
}
错误
| 状态 | 代码 | 触发条件 |
|---|---|---|
400 | INVALID_ADDRESS | address 不是有效的 TRON 地址,或无法连接 |
400 | CONTRACT_ADDRESS_NOT_SUPPORTED | address 是智能合约 |
400 | AUTO_BW_INVALID_THRESHOLD | threshold 超出该 volume 所允许的范围;范围见消息 |
400 | AUTO_BW_INVALID_CONTRACT | token: "CUSTOM" 但没有 contract,或 contract 搭配了其他代币,或该合约不在您的代币列表中 |
402 | INSUFFICIENT_BALANCE | 余额不足以支付 24 小时和一笔转账(加上激活费用);金额见 error.required_trx 和 error.available_trx |
403 | FORBIDDEN | API 密钥缺少 buy_bandwidth 权限 |
409 | AUTO_BW_ADDRESS_TAKEN | 您的账户已有该地址的订阅 |
409 | AUTO_BW_ADDRESS_COVERED | 该地址上的带宽已由智能模式或转账套餐维持 |
409 | AUTO_BW_CONTRACT_LISTED | contract 是 USDT 或 USDD 合约——请改用 token;代币在 error.token 中给出 |
422 | — | 字段类型错误或超出范围 |
429 | RATE_LIMIT_EXCEEDED | 创建请求过多——参见速率限制 |
503 | AUTO_BW_DISABLED | 自动带宽暂时关闭;未创建订阅——请稍后重试 |
{
"detail": {
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance. Required: 0.680000 TRX, available: 0.500000 TRX",
"required_trx": "0.680000",
"available_trx": "0.500000"
}
}
}
{
"detail": {
"error": {
"code": "AUTO_BW_DISABLED",
"message": "Auto-Bandwidth is temporarily unavailable; please try again later"
}
}
}
超时后重试创建请求是安全的。如果第一次请求已经成功,重试会返回
409 AUTO_BW_ADDRESS_TAKEN,而不会创建第二个订阅;列出您的订阅即可获取其 id。⌘I
创建订阅
curl --request POST \
--url https://api.tronrental.com/v1/bandwidth/auto \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"volume": 123,
"token": "<string>",
"contract": "<string>",
"label": "<string>",
"auto_pause": true,
"threshold": 123,
"notify_free_bw": true,
"stop_after_transfer": true
}
'import requests
url = "https://api.tronrental.com/v1/bandwidth/auto"
payload = {
"address": "<string>",
"volume": 123,
"token": "<string>",
"contract": "<string>",
"label": "<string>",
"auto_pause": True,
"threshold": 123,
"notify_free_bw": True,
"stop_after_transfer": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
address: '<string>',
volume: 123,
token: '<string>',
contract: '<string>',
label: '<string>',
auto_pause: true,
threshold: 123,
notify_free_bw: true,
stop_after_transfer: true
})
};
fetch('https://api.tronrental.com/v1/bandwidth/auto', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '<string>',
'volume' => 123,
'token' => '<string>',
'contract' => '<string>',
'label' => '<string>',
'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"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"volume\": 123,\n \"token\": \"<string>\",\n \"contract\": \"<string>\",\n \"label\": \"<string>\",\n \"auto_pause\": true,\n \"threshold\": 123,\n \"notify_free_bw\": true,\n \"stop_after_transfer\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tronrental.com/v1/bandwidth/auto")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"volume\": 123,\n \"token\": \"<string>\",\n \"contract\": \"<string>\",\n \"label\": \"<string>\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"<string>\",\n \"volume\": 123,\n \"token\": \"<string>\",\n \"contract\": \"<string>\",\n \"label\": \"<string>\",\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