PgBeam Docs
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

result, err := client.Platform.RotateSelfHostEnrollment(ctx, "org_abc123", "she_01h455vb4pex5vsknk084sn02q")

Parameters

ParameterTypeRequiredDescription
ctxcontext.ContextYesRequest context
orgIDstringYesUnique organization identifier.
enrollmentIDstringYesUnique enrollment identifier.

Response

(*pgbeam.SelfHostEnrollmentSecret, error): token rotated. new token shown once.

Example

import pgbeam "go.pgbeam.com/sdk"

client := pgbeam.NewClient(&pgbeam.ClientOptions{
  APIKey: "pgb_your_api_key",
})

result, err := client.Platform.RotateSelfHostEnrollment(ctx, "org_abc123", "she_01h455vb4pex5vsknk084sn02q")
if err != nil {
  log.Fatal(err)
}
fmt.Println(result)

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
409The enrollment is revoked and cannot be rotated.

On this page