Platform
rotateSelfHostEnrollment
Rotate a self-host enrollment token
Mints a new enrollment token in place, keeping the same enrollment id, metadata, and expiry. The swap is atomic: the old token stops authenticating new proxy connections the moment this call returns. An already-connected proxy keeps its existing gRPC streams until it disconnects, then must present the new token to reconnect. The new token is returned once and cannot be retrieved again.
Usage
const result = await api.platform.rotateSelfHostEnrollment({
pathParams: {
org_id: "org_abc123",
enrollment_id: "she_01h455vb4pex5vsknk084sn02q",
},
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| pathParams.org_id | string | Yes | Unique organization identifier. |
| pathParams.enrollment_id | string | Yes | Unique enrollment identifier. |
Response
Promise<SelfHostEnrollmentSecret>: token rotated. new token shown once.
Example
import { PgBeamClient } from "pgbeam";
const client = new PgBeamClient({
token: "pbk_...",
baseUrl: "https://api.pgbeam.com",
});
const result = await client.api.platform.rotateSelfHostEnrollment({
pathParams: {
org_id: "org_abc123",
enrollment_id: "she_01h455vb4pex5vsknk084sn02q",
},
});Errors
| Status | Description |
|---|---|
| 400 | Invalid request parameters. |
| 401 | Missing or invalid authentication. |
| 403 | Operation not allowed by current plan limits. |
| 404 | Resource not found. |
| 409 | The enrollment is revoked and cannot be rotated. |