---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ydb.tech/docs/en/yql/reference/syntax/drop-secret.md?version=main
  - https://ydb.tech/docs/ru/yql/reference/syntax/drop-secret.md?version=main
sourcePath: en/core/yql/reference/syntax/drop-secret.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# DROP SECRET

The `DROP SECRET` statement deletes an existing [secret](https://ydb.tech/docs/en/concepts/datamodel/secrets.md?version=main).

## Syntax {#syntax}

```sql
DROP SECRET [IF EXISTS] secret_name
```

* `IF EXISTS` — the statement does not return an error if the secret does not exist; in this case, it is a no-op.
* `secret_name` — the name of the secret to delete.

## Permissions {#permissions}

Deleting a secret requires the [rights](https://ydb.tech/docs/en/yql/reference/syntax/grant.md?version=main#permissions-list) `REMOVE SCHEMA` and `ALTER SCHEMA`.

## Examples {#examples}

Delete the secret named `secret_name`:

```sql
DROP SECRET secret_name;
```

Delete the secret named `secret_name` only if it exists; if it does not exist, the statement is a no-op:

```sql
DROP SECRET IF EXISTS secret_name;
```

## See also {#see-also}

* [CREATE SECRET](https://ydb.tech/docs/en/yql/reference/syntax/create-secret.md?version=main)
* [ALTER SECRET](https://ydb.tech/docs/en/yql/reference/syntax/alter-secret.md?version=main)
