---
title: "API·更新 DNS 解析记录"
description: "POST /api/v1/dns/record/update 接口，修改已有 DNS 记录的主机名、记录值、类型、MX 优先级、TTL 与线路 view_id，所有修改项可选且仅提交变更部分。"
---

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

# API·更新 DNS 解析记录

## 更新解析记录

## 接口描述

更新已存在的 DNS 解析记录信息。

**接口地址：** `POST /api/v1/dns/record/update`

## 输入参数

### 请求示例

```json
{
  "record_id": 1,
  "domain_type": 2,
  "domain_id": 1222200,
  "record": "www",
  "value": "",
  "type": "A",
  "mx": 1,
  "ttl": 600,
  "remark": "默认解析",
  "view_id": 1
}
```

### 请求参数

| 参数名称 | 必选 | 类型 | 描述 |
|---------|------|------|------|
| record_id | 是 | Integer | 记录 ID |
| domain_type | 是 | Integer | 域名类型：1（宝塔内部域名）、2（外部域名） |
| domain_id | 是 | Integer | 域名 ID |
| record | 否 | String | 主机记录 |
| value | 否 | String | 记录值 |
| type | 否 | String | 记录类型 |
| mx | 否 | Integer | 权重：5（高优先级）、10（次高优先级）、20（备份节点） |
| ttl | 否 | Integer | 生存时间（秒） |
| remark | 否 | String | 备注信息 |
| view_id | 否 | Integer | 线路类型 ID |

:::info 提示
- 只需要传入需要更新的字段，未传入的字段保持原值不变
- 记录类型如果发生变化，记录值必须符合新类型的格式要求
- 必须同时提供 domain_type 和 domain_id 参数
:::

## 输出参数

### 响应示例

**返回：**

```json
{
  "code": 0,
  "data": {},
  "msg": "更新解析记录成功",
  "status": true
}
```

Source: https://docs.bt.cn/domain/api/dns-records/update-record/index.mdx
