轮换隧道令牌
post /v1/organizations/tunnels/{tunnel_id}/rotate_token
使隧道的当前令牌对新连接失效,并返回新的令牌值。
已建立的连接不会因轮换而断开;轮换后重新启动的连接器必须使用新值。可选的 reason 参数用于记录操作上下文。
路径参数
-
tunnel_id: string隧道的 ID。
请求头参数
-
"anthropic-beta": array of "mcp-tunnels-2026-05-19"所有隧道端点都需要此参数。
"mcp-tunnels-2026-05-19"
请求体参数
-
reason: optional string可选的轮换原因自由文本,用于审计记录。
返回值
-
id: string当前令牌值的稳定标识符。令牌轮换时会更改。
-
tunnel_token: string隧道的连接令牌。
-
type: "tunnel_token"对象类型。隧道令牌始终为
tunnel_token。"tunnel_token"
示例
curl https://api.anthropic.com/v1/organizations/tunnels/$TUNNEL_ID/rotate_token \
-X POST \
-H 'anthropic-version: 2023-06-01' \
-H "Authorization: Bearer $ANTHROPIC_WIF_BEARER_TOKEN"
响应
{
"id": "ttkn_bb97000eaec162831399ca9b6684a4fdf5be49ace5683057b017aab5c87e19e0",
"tunnel_token": "eyJhIjoiRVhBTVBMRSIsInQiOiJFWEFNUExFIiwicyI6IkVYQU1QTEUifQ==",
"type": "tunnel_token"
}