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

# 删除订阅

> 删除一个自动带宽订阅

## 删除订阅

删除一个订阅。我们会停止监控该地址，并在几秒之内收回已委托给它的带宽；该地址随即可用于新的订阅。在删除之前用掉我们带宽的转账仍会收费。需要 `buy_bandwidth` 权限。

如果只想暂时停止而不丢失设置，请改为用 `enabled: false` [暂停订阅](https://docs.tronrental.com/zh/api-reference/auto-bandwidth/update-subscription.md)。

### 路径参数

**sub\_id** `number` *required*

订阅 ID——创建或列出订阅返回的 `id`

### 响应

**id** `number`

已删除订阅的 ID

**status** `string`

`deleted`

### 示例

```bash cURL theme={null}
curl -X DELETE https://api.tronrental.com/v1/bandwidth/auto/42 \
  -H "X-API-Key: your_api_key"
```

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

resp = requests.delete(
    "https://api.tronrental.com/v1/bandwidth/auto/42",
    headers={"X-API-Key": "your_api_key"},
)
print(resp.json())
```

```javascript JavaScript theme={null}
const resp = await fetch("https://api.tronrental.com/v1/bandwidth/auto/42", {
  method: "DELETE",
  headers: { "X-API-Key": "your_api_key" },
});
console.log(await resp.json());
```

```json Response theme={null}
{
  "id": 42,
  "status": "deleted"
}
```

### 错误

| 状态 | 代码 | 触发条件 |
| - | - | - |
| `403` | `FORBIDDEN` | API 密钥缺少 `buy_bandwidth` 权限 |
| `404` | `NOT_FOUND` | 您的账户中没有该 ID 的订阅（或已被删除） |

```json theme={null}
{
  "detail": {
    "error": {
      "code": "NOT_FOUND",
      "message": "Auto-Bandwidth subscription not found"
    }
  }
}
```


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