PgBeam Docs
Agents

rotateAgentCredential

Rotate an agent credential's secrets

Generates a new Postgres password and MCP token for the credential in place, keeping the same id, username, name, and policy. Live connections using the old password are dropped within seconds. The new secrets are returned once and cannot be retrieved again.

Usage

const result = await api.agents.rotateAgentCredential({
  pathParams: { project_id: "prj_xxx", agent_id: "agt_xxx" },
});

Parameters

ParameterTypeRequiredDescription
pathParams.project_idstringYesUnique project identifier (prefixed, e.g. prj_xxx).
pathParams.agent_idstringYesUnique agent credential identifier (prefixed, e.g. agt_xxx).

Response

Promise<AgentCredentialSecrets> — secrets rotated. new secrets shown once.

Example

import { PgBeamClient } from "pgbeam";

const client = new PgBeamClient({
  token: "pbk_...",
  baseUrl: "https://api.pgbeam.com",
});

const result = await client.api.agents.rotateAgentCredential({
  pathParams: { project_id: "prj_xxx", agent_id: "agt_xxx" },
});

Errors

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

On this page