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

# Delete a secret

> Delete a secret from a folder with the Node.js SDK.

`client.secrets().deleteSecret()` deletes a secret from a folder in an environment of a project. 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 deleting the secret, and returns the change request in `approval`.

## Parameters

**secretName** `string` *required*

The name of the secret.

**options** `DeleteSecretOptions` *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`.

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

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

## Returns

**result** `DeleteSecretResponse`

**properties**

**secret** `Secret`

The deleted secret, with the values it had before the delete.

**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 Basic theme={"dark"}
const { secret } = await client.secrets().deleteSecret("STRIPE_SECRET_KEY", {
  projectId: "<project-id>",
  environment: "dev",
  secretPath: "/backend",
});
```

```json Response theme={"dark"}
{
  "secret": {
    "id": "9d2f1e4c-7b3a-4c6d-8e5f-0a1b2c3d4e5f",
    "environment": "dev",
    "secretKey": "STRIPE_SECRET_KEY",
    "secretValue": "<stripe-key>",
    "secretValueHidden": false,
    "secretComment": "",
    "type": "shared",
    "version": 3,
    "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.