Claude Platform Docs

Tunnel-Token rotieren

$client->beta->tunnels->rotateToken(string tunnelID, ?string reason, ?list<AnthropicBeta> betas, ?string workspaceID): BetaTunnelToken
POST/v1/tunnels/{tunnel_id}/rotate_token
Requires anthropic-beta: mcp-tunnels-2026-06-22. How to send beta headers

Die Tunnels API befindet sich in der "Research Preview" (Forschungsvorschau). Sie erfordert den Header anthropic-beta: mcp-tunnels-2026-06-22 und kann sich ohne Abkündigungsfrist ändern. Sie ersetzt die Admin-API-Endpunkte unter /v1/organizations/tunnels, die während eines Migrationszeitraums weiterhin verfügbar bleiben.

Rotiert das Connector-Token eines Tunnels. Die Rotation macht das aktuelle Token für neue Verbindungen ungültig und gibt einen neuen Wert zurück; bestehende Verbindungen werden nicht getrennt. Ein nach der Rotation neu gestarteter Connector muss den neuen Wert verwenden.

Parameters
tunnelID: string⁠Path parameter

ID of the tunnel (tnl_...).

reason?: optional string

Optional free-text reason for the rotation, recorded for audit.

betas?: optional list<AnthropicBeta>⁠Header parameter

This endpoint is in beta: requests must send mcp-tunnels-2026-06-22 in this header.

workspaceID?: optional string⁠Header parameter

Optional header to select the Workspace for this request. The value is a Workspace ID (for example, wrkspc_011CZkZaBF1tNoB5wlCeusgy).

Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace.

Returns
class BetaTunnelToken { $type = 'tunnel_token'; $id; $tunnelToken; }
"tunnel_token" type
string id

Stable identifier for the current token value. Changes when the token is rotated.

string tunnelToken

The connector token used to run the tunnel. Treat as a credential.

Tunnel-Token rotieren
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Anthropic\Client;
use Anthropic\Beta\AnthropicBeta;

$client = new Client(apiKey: 'my-anthropic-api-key');

$betaTunnelToken = $client->beta->tunnels->rotateToken(
  'tunnel_id',
  reason: 'reason',
  betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
  workspaceID: 'wrkspc_011CZkZaBF1tNoB5wlCeusgy',
);

var_dump($betaTunnelToken);
Returns Examples
Response 200
{
  "id": "id",
  "tunnel_token": "tunnel_token",
  "type": "tunnel_token"
}