[ PROMPT_NODE_24158 ]
Network Interconnect API 参考
[ SKILL_DOCUMENTATION ]
# CNI API 参考
查看 [README.md](README.md) 获取概述。
## 基础
https://api.cloudflare.com/client/v4
认证: Authorization: Bearer
## SDK 命名空间
**主要 (推荐):**
typescript
client.networkInterconnects.interconnects.*
client.networkInterconnects.cnis.*
client.networkInterconnects.slots.*
**替代 (已弃用):**
typescript
client.magicTransit.cfInterconnects.*
所有新代码请使用 `networkInterconnects` 命名空间。
## 互联 (Interconnects)
http
GET /accounts/{account_id}/cni/interconnects # 查询: page, per_page
POST /accounts/{account_id}/cni/interconnects # 查询: validate_only=true (可选)
GET /accounts/{account_id}/cni/interconnects/{icon}
GET /accounts/{account_id}/cni/interconnects/{icon}/status
GET /accounts/{account_id}/cni/interconnects/{icon}/loa # 返回 PDF
DELETE /accounts/{account_id}/cni/interconnects/{icon}
**创建主体:** `account`, `slot_id`, `type`, `facility`, `speed`, `name`, `description`
**状态值:** `active` | `healthy` | `unhealthy` | `pending` | `down`
**响应示例:**
{"result": [{"id": "icon_abc", "name": "prod", "type": "direct", "facility": "EWR1", "speed": "10G", "status": "active"}]}
## CNI 对象 (BGP 配置)
http
GET /accounts/{account_id}/cni/cnis
POST /accounts/{account_id}/cni/cnis
GET /accounts/{account_id}/cni/cnis/{cni}
PUT /accounts/{account_id}/cni/cnis/{cni}
DELETE /accounts/{account_id}/cni/cnis/{cni}
主体: `account`, `cust_ip`, `cf_ip`, `bgp_asn`, `bgp_password`, `vlan`
## 插槽 (Slots)
http
GET /accounts/{account_id}/cni/slots
GET /accounts/{account_id}/cni/slots/{slot}
查询: `facility`, `occupied`, `speed`
## 健康检查
通过 Magic Transit/WAN 隧道端点 (CNI v2) 配置。
typescript
await client.magicTransit.tunnels.update(accountId, tunnelId, {
health_check: { enabled: true, target: '192.0.2.1', rate: 'high', type: 'request' },
});
速率: `high` | `medium` | `low`。类型: `request` | `reply`。查看 [Magic Transit 文档](https://developers.cloudflare.com/magic-transit/how-to/configure-tunnel-endpoints/#add-tunnels)。
## 设置
http
GET /accounts/{account_id}/cni/settings
PUT /accounts/{account_id}/cni/settings
主体: `default_asn`
## TypeScript SDK
typescript
import Cloudflare from 'cloudflare';
const client = new Cloudflare({ apiToken: process.env.CF_TOKEN });
// 列出
await client.networkInterconnects.interconnects.list({