Claude Platform Docs

Effectuer la rotation du jeton d'un tunnel

$client->beta->tunnels->rotateToken(string tunnelID, ?string reason, ?list<AnthropicBeta> betas, ?string workspaceID): BetaTunnelToken
POST/v1/tunnels/{tunnel_id}/rotate_token

L'API Tunnels est en « research preview » (aperçu de recherche). Elle nécessite l'en-tête anthropic-beta: mcp-tunnels-2026-06-22 et peut changer sans période de dépréciation. Elle remplace les points de terminaison de l'Admin API situés sous /v1/organizations/tunnels, qui restent disponibles pendant une fenêtre de migration.

Effectue la rotation du jeton de connecteur d'un tunnel. La rotation invalide le jeton actuel pour les nouvelles connexions et renvoie une nouvelle valeur ; les connexions établies ne sont pas interrompues. Un connecteur redémarré après la rotation doit utiliser la nouvelle valeur.

Parameters
tunnelID: string
reason?:optional string

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

betas?:optional list<AnthropicBeta>

Optional header to specify the beta version(s) you want to use.

workspaceID?:optional string
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.

Effectuer la rotation du jeton d'un tunnel
<?php

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

$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"
}