---
title: "创建隧道"
method: POST
path: "/tunnels"
tags: ["隧道管理"]
---

# 创建隧道

`POST /tunnels`

## Request body

- object
  - `name` string, required — 隧道名
  - `type` 'tcp' | 'udp' | 'http' | 'https' | 'wol' | 'etcp' | 'eudp', required — 隧道类型
  - `node` integer, required — 节点 ID
  - `note` string — 备注信息
  - `extra` string — 自定义配置数据
  - `local_ip` string — 本地 IP, 除 wol 类型外必填
  - `local_port` integer — 本地端口, 除 wol 类型外必填
  - `remote` string — 远程信息, 端口或绑定域名 (http/https 类型必填)

## Response `201`

创建成功

- object
  - `id` integer, required — 创建的隧道 ID
  - `name` string, required — 创建的隧道名
  - `remote` string — 远程信息, 端口或绑定域名

## Other responses

- `500` — 通用错误返回

---

[API](https://skmtc.dev/natfrp/apis/sakurafrp-api.md) · [All operations](https://skmtc.dev/natfrp/apis/sakurafrp-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/natfrp/sakurafrp-api/revisions/2caa73524824/schema)
