# rename_secret

Source: https://modulify.ai/docs/mcp/secrets/rename-secret

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

- Title: Rename an environment variable
- Scope: `config:write`
- Access: Makes 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](https://modulify.ai/docs/data/secrets#edit-and-rename).

## 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. |