Rotate share

Replaces the credential of a tunnel account and ends every environment enabled with it, shares and all, so a credential handed out before — to a member who has left, or to anyone who read it — opens nothing from now on.

POST /v1/share/rotate

Addresshttps://api.hanzo.ai/v1/share/rotate
MethodPOST
Operationpost_share_rotate
AuthAuthorization: Bearer $HANZO_API_KEY

Replaces the credential of a tunnel account and ends every environment enabled with it, shares and all, so a credential handed out before — to a member who has left, or to anyone who read it — opens nothing from now on. The account is kept: enable hands its holder the new credential.

In a customer's org the account is the org's, which its members share, and an admin of the org or a SuperAdmin rotates it. In a held org each person's account is their own, and they rotate it — every account they hold, the one an API key of theirs was handed before included, so none stays live. An admin of the org or a SuperAdmin then rotates the org's own account, which no call there hands out, whether or not they hold an account of their own; when that one cannot be rotated, pending says so and their own are rotated still.

An account never provisioned has nothing to rotate and counts 0. 503 when the deployment has no share controller configured; 502 when that controller is unreachable, or holds the caller's account under a credential this deployment does not derive — out of a rotation's reach, so it is refused rather than reported done.

Request

The document declares no body for POST /v1/share/rotate. The handler is typed in cloud but its shape is not yet emitted, so the fields are not listed here — ask MCP's describe for post_share_rotate, which answers from the running route.

Response

StatusBodyMeaning
200share.rotatedok
defaultproblem-detailsrefused

200 body — 2 fields.

FieldInTypeAlwaysDescription
endedbodyinteger (int64)—Ended is how many environments the rotated accounts had enabled.
pendingbodystring—Pending says what this call could not rotate, and is empty when it rotated everything.

Failure carries the platform error shape — see Errors.

Examples

hanzo share rotate
import { Configuration, ShareApi } from 'hanzoai';

const api = new ShareApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postShareRotate();
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ShareApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ShareApi(client).post_share_rotate()
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.ShareAPI.PostShareRotate(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, share_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = share_api::post_share_rotate(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ShareApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new ShareApi(client).postShareRotate();
curl -X POST https://api.hanzo.ai/v1/share/rotate \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches share through the share tool, which names its 3 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_shares"
         }
       }
     }'

Share API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.