Modulify

Rename an environment variable

rename_secret

Renames one environment variable on a site and keeps its value, without reading the value.

Scopeconfig:writeMakes changes

The new name follows the same rules as set_secret and must not already belong to another variable or be a reserved name. Locked variables cannot be renamed, and an encrypted variable cannot take a NEXT_PUBLIC_ name here, because that name puts its value in the browser code. Rename that one in the Secrets tab instead, where its value is shown.

The site's code keeps reading the old name until it is changed too, so every place that reads it needs updating. The running preview gets the new name straight away, and the published site gets it on the next publish. See Secrets.

Inputs

Input Type Required Description
projectId string Yes The site id.
secretId string Yes The variable id from list_secrets.
key string Yes The new name. Use letters, digits and underscores only, starting with a letter or an underscore.