Skip to main content
client.secrets.get_secret_by_name() fetches one secret from a folder in an environment of a project. The machine identity needs a role in the project that can read secrets, such as Viewer.

Parameters

str
required
The name of the secret.
str
The ID of the project. Pass project_id or project_slug. If you pass both, the SDK uses project_id.
str
The slug of the project.
str
required
The slug of the environment, such as dev.
str
required
The path of the folder, such as / or /backend.
str
The version of the secret to fetch. Defaults to the latest version. The cache ignores the version, so turn the cache off to fetch an older version.
bool
default:"True"
Whether to also look for the secret in the folder’s secret imports.
bool
default:"True"
Whether to replace each secret reference in the value with the value it points to.
bool
default:"True"
Whether to return the secret’s value.

Returns

BaseSecret
The secret.