> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tronrental.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 能量补充报价

> 在创建规则之前查看一次能量补充的价格

## 能量补充报价

返回您的账户补充一次 `add_volume` 能量的费用：即采用该数量的规则每次补充支付的价格，已包含固定手续费。不会创建任何东西，也不会扣费。需要 `view` 权限。

价格取决于调用方式。使用 API 密钥调用时，返回的是通过该 API 密钥创建的规则的价格；在网站上调用时，返回的是在网站上创建的规则的价格。这是请求时刻的价格，不包含激活链上尚不存在的地址的费用——激活费用会在首次补充时加上。

### 查询参数

**add\_volume** `number` *required*

每次补充的能量。范围 32,000 至 5,000,000，与创建规则时相同。

能量补充的租期始终为一小时，因此没有 `duration` 参数；响应中始终为 `"duration": "1h"`。

### 响应

**add\_volume** `number`

您查询的数量

**duration** `string`

补充的租赁时长——能量始终为 `1h`

**estimated\_cost\_per\_refill\_trx** `string`

您的账户补充一次的全部价格，已包含固定手续费

### 示例

```bash cURL theme={null}
curl "https://api.tronrental.com/v1/energy/auto-refill/quote?add_volume=131000" \
  -H "X-API-Key: your_api_key"
```

```python Python theme={null}
import requests

resp = requests.get(
    "https://api.tronrental.com/v1/energy/auto-refill/quote",
    headers={"X-API-Key": "your_api_key"},
    params={"add_volume": 131000},
)
print(resp.json())
```

```javascript JavaScript theme={null}
const resp = await fetch(
  "https://api.tronrental.com/v1/energy/auto-refill/quote?add_volume=131000",
  { headers: { "X-API-Key": "your_api_key" } },
);
console.log(await resp.json());
```

```json Response theme={null}
{
  "add_volume": 131000,
  "duration": "1h",
  "estimated_cost_per_refill_trx": "2.618000"
}
```

### 错误

| 状态 | 代码 | 触发条件 |
| - | - | - |
| `403` | `FORBIDDEN` | API 密钥缺少 `view` 权限 |
| `422` | — | 缺少 `add_volume`，或其超出 32,000 – 5,000,000 范围 |
| `503` | `TEMPORARILY_UNAVAILABLE` | 暂时无法获取价格——请等待 `Retry-After` 给出的秒数后重试 |

```json theme={null}
{
  "detail": {
    "error": {
      "code": "TEMPORARILY_UNAVAILABLE",
      "message": "Please retry shortly"
    }
  }
}
```

校验错误采用框架自身的格式，其中 `detail` 是数组：

```json theme={null}
{
  "detail": [
    {
      "type": "greater_than_equal",
      "loc": ["query", "add_volume"],
      "msg": "Input should be greater than or equal to 32000",
      "input": "1000",
      "ctx": {"ge": 32000}
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.