aip_sdk.get_secret
aip_sdk.get_secret(name: str, *, workspace_id: str | None = None, client: APIClient | None = None) -> WorkspaceSecret
Look up one secret by name.
Parameters
namestr: The secret's name.workspace_idstr | None: Workspace holding the secret. Defaults to the session's workspace.clientAPIClient | None: Optional pre-configured API client.
Returns
WorkspaceSecretWorkspaceSecret: the secret, without its value. Callreveal()on it for that.
Raises
SecretNotFoundError: If the workspace has no secret with this name.ForbiddenError: If you cannot access this workspace.NoWorkspaceSelectedError: If no workspace is passed and none is set for the session.AuthError: If credentials are missing or invalid.APIError: If the request otherwise fails.
Example:
secret = aip.get_secret("OPENAI_API_KEY", workspace_id="ws-abc123")
print(secret.description)