> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a secret

> Change a secret's value or name with the Node.js SDK.

`client.secrets().updateSecret()` changes a secret's value, name, comment, tags, or other settings. The settings that you don't pass stay as they are. The machine identity needs a [role](https://infisical.com/docs/documentation/platform/access-controls/role-based-access-controls.md#project-level-access-controls) in the project that can change secrets, such as **Member**.

If the folder has an [approval policy](https://infisical.com/docs/documentation/platform/pr-workflows.md), Infisical opens a change request instead of updating the secret, and returns the change request in `approval`.

## Parameters

**secretName** `string` *required*

The current name of the secret.

**options** `UpdateSecretOptions` *required*

**properties**

**projectId** `string` *required*

The ID of the project.

**environment** `string` *required*

The slug of the environment, such as `dev`.

**secretPath** `string` (default: /)

The path of the folder, such as `/backend`.

**secretValue** `string`

The new value of the secret.

**newSecretName** `string`

A new name for the secret.

**metadata** `Record\<string, string\>`

Key-value pairs to store with the secret.

**secretComment** `string`

A new comment for the secret.

**tagIds** `string[]`

The IDs of the secret's tags, which replace its current tags.

**type** `SecretType` (default: SecretType.Shared)

`SecretType.Shared`, or `SecretType.Personal` to update a [personal override](https://infisical.com/docs/documentation/platform/secrets-mgmt/project.md#personal-overrides).

**skipMultilineEncoding** `boolean`

Whether to store a multi-line value without encoding its line breaks.

**secretReminderNote** `string`

The note that Infisical sends with each reminder to rotate the secret.

**secretReminderRepeatDays** `number`

The number of days between reminders, at least 1.

## Returns

**result** `UpdateSecretResponse`

**properties**

**secret** `Secret`

The updated secret, with its `id`, `secretKey`, `secretValue`, `secretValueHidden`, `secretComment`, `environment`, `type`, and `version`. To get its tags, call [`getSecret`](https://infisical.com/docs/sdks/languages/node/secrets/get-secret). Its `secretValue` and `secretComment` hold only the values that this call sent.

**approval** `object`

The change request, if the folder has an approval policy. `secret` is then `undefined`. The TypeScript types of the SDK don't include `approval`.

```typescript Change the value theme={"dark"}
const { secret } = await client.secrets().updateSecret("STRIPE_KEY", {
  projectId: "<project-id>",
  environment: "dev",
  secretValue: "<new-stripe-key>",
});
```

```typescript Rename theme={"dark"}
const { secret } = await client.secrets().updateSecret("STRIPE_KEY", {
  projectId: "<project-id>",
  environment: "dev",
  secretPath: "/backend",
  newSecretName: "STRIPE_SECRET_KEY",
});
```

```json Response theme={"dark"}
{
  "secret": {
    "id": "9d2f1e4c-7b3a-4c6d-8e5f-0a1b2c3d4e5f",
    "environment": "dev",
    "secretKey": "STRIPE_KEY",
    "secretValue": "<new-stripe-key>",
    "secretValueHidden": false,
    "secretComment": "",
    "type": "shared",
    "version": 2,
    "createdAt": "2026-12-02T10:21:44.130Z",
    "updatedAt": "2026-12-02T11:05:12.877Z"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.