> ## 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.

# 购买能量

> 为 TRON 地址购买能量

## 购买能量

将能量委托给指定的 TRON 地址。费用从您的账户余额中扣除。

### 请求体

<ParamField body="target_address" type="string" required>
  目标 TRON 地址（T... 格式，34 个字符）
</ParamField>

<ParamField body="volume" type="number" required>
  要委托的能量数量（最小 32,000，最大 5,000,000）
</ParamField>

<ParamField body="duration" type="string" required>
  租赁时长：`"1h"`（仅 1 小时）
</ParamField>

### 响应

<ResponseField name="id" type="number">
  唯一订单标识符
</ResponseField>

<ResponseField name="status" type="string">
  订单状态：`pending`、`filled`、`failed`
</ResponseField>

<ResponseField name="txid" type="string | null">
  委托广播后的链上交易 ID（`pending` 期间为 null）
</ResponseField>

<ResponseField name="price_trx" type="string">
  从余额中扣除的总费用，以 TRX 计
</ResponseField>

<ResponseField name="reclaim_at" type="string | null">
  带宽租赁回收的 ISO 8601 时间戳（能量由提供方自动回收）
</ResponseField>

<ResponseField name="activation_cost_trx" type="string">
  地址激活费用（以 TRX 计），如已激活则为 `"0"`
</ResponseField>

### 示例

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.tronrental.com/v1/energy/buy \
    -H "X-API-Key: your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "target_address": "TYourRecipientAddress1234567890abc",
      "volume": 65000,
      "duration": "1h"
    }'
  ```

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

  resp = requests.post(
      "https://api.tronrental.com/v1/energy/buy",
      headers={"X-API-Key": "your_api_key"},
      json={
          "target_address": "TYourRecipientAddress1234567890abc",
          "volume": 65000,
          "duration": "1h",
      },
  )
  print(resp.json())
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch("https://api.tronrental.com/v1/energy/buy", {
    method: "POST",
    headers: {
      "X-API-Key": "your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      target_address: "TYourRecipientAddress1234567890abc",
      volume: 65000,
      duration: "1h",
    }),
  });
  console.log(await resp.json());
  ```
</CodeGroup>

```json Response theme={null}
{
  "id": 12345,
  "price_trx": "2.75",
  "status": "pending"
}
```

<Tip>
  **65,000 能量**可覆盖一笔向已持有 USDT 地址的转账。
  对于首次接收 USDT 的地址（新建存储槽），请使用 **131,000**。
</Tip>
