Skip to main content
client.secrets.create_secret_by_name() creates a secret in a folder in an environment of a project. The machine identity needs a role in the project that can change secrets, such as Member.

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
required
The value of the secret.
str
A comment that Infisical shows with the secret.
List[str]
The IDs of the tags to add to the secret.
List[Dict[str, Any]]
Key-value pairs to store with the secret, each a dictionary with key and value.
bool
default:"False"
Whether to store a multi-line value without encoding its line breaks.
str
The note that Infisical sends with each reminder to rotate the secret.
int
The number of days between reminders, at least 1.

Returns

BaseSecret
The new secret, with its id, secretKey, secretValue, secretComment, environment, type, and version. To get its tags and metadata, call get_secret_by_name.