## DNS API(证书验证) (`dns-apis`)

DNS 服务商的 API 凭据,用于 DNS-01 验证与签发通配证书。凭据只写,响应只回掩码。

鉴权: 用户（部分参数仅管理员） · 文档: https://www-demo.kuxitong.com/zh/docs/api/dns-apis

### GET `/api/v2/dns-apis`

列出DNS API 凭据 · 鉴权: 用户（部分参数仅管理员）

查询参数:

| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `page` | integer |  | 页码,从 1 开始。 默认: 1 |
| `page_size` | integer |  | 每页条数。 默认: 20 |
| `sort` | string |  | 排序字段,逗号分隔,前缀 `-` 表示降序,如 `-created_at,id`。 |
| `tenant_id` | integer |  | 仅管理员可用:按租户过滤。租户凭据调用时忽略,只返回本租户数据。 |

```sh
curl "https://panel.example.com/api/v2/dns-apis" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### POST `/api/v2/dns-apis`

创建DNS API 凭据 · 鉴权: 用户（部分参数仅管理员）

查询参数:

| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `tenant_id` | integer |  | 仅管理员可用:按租户过滤。租户凭据调用时忽略,只返回本租户数据。 |

请求体:

| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `auth` | object |  | 凭据键名 → 掩码(≥16 位露末 4 位 `****abcd`,否则 `********`),不回明文。 |
| `des` | string |  | 备注说明 |
| `name` | string | 有 | 名称 |
| `type` | string | 有 | DNS 服务商。 |

```sh
curl -X POST "https://panel.example.com/api/v2/dns-apis" \
  -H "X-API-Key: $GOCDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auth":{"DP_Id":"12345","DP_Key":"${DP_KEY}"},"name":"my-dns","type":"dnspod_cn"}'
```

### GET `/api/v2/dns-apis/{id}`

获取DNS API 凭据 · 鉴权: 用户（部分参数仅管理员）

```sh
curl "https://panel.example.com/api/v2/dns-apis/{id}" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### PUT `/api/v2/dns-apis/{id}`

修改DNS API 凭据 · 鉴权: 用户（部分参数仅管理员）

请求体:

| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `auth` | object |  | 凭据键名 → 掩码(≥16 位露末 4 位 `****abcd`,否则 `********`),不回明文。 |
| `des` | string |  | 备注说明 |
| `name` | string | 有 | 名称 |
| `type` | string | 有 | DNS 服务商。 |

```sh
curl -X PUT "https://panel.example.com/api/v2/dns-apis/{id}" \
  -H "X-API-Key: $GOCDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auth":{"DP_Id":"12345","DP_Key":"${DP_KEY}"},"name":"my-dns","type":"dnspod_cn"}'
```

### DELETE `/api/v2/dns-apis/{id}`

删除DNS API 凭据 · 鉴权: 用户（部分参数仅管理员）

```sh
curl -X DELETE "https://panel.example.com/api/v2/dns-apis/{id}" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

DNS API(证书验证)对象:

| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `auth` | object |  | 凭据键名 → 掩码(≥16 位露末 4 位 `****abcd`,否则 `********`),不回明文。 |
| `created_at` | string |  | 创建时间 (只读) |
| `des` | string |  | 备注说明 |
| `id` | integer |  | 记录 ID (只读) |
| `name` | string |  | 名称 |
| `tenant_id` | integer |  | 所属租户(用户)ID (只读) |
| `type` | string |  | DNS 服务商。 |
| `updated_at` | string |  | 更新时间 (只读) |
