2019-06-10 17:41:55 +00:00
|
|
|
---
|
2020-01-18 00:18:09 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: kv delete - Command
|
2019-06-10 17:41:55 +00:00
|
|
|
description: |-
|
2023-08-02 19:49:30 +00:00
|
|
|
The "kv delete" command deletes the data for the provided path in the key/value secrets engine.
|
2019-06-10 17:41:55 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# kv delete
|
|
|
|
|
|
|
|
The `kv delete` command deletes the data for the provided path in
|
|
|
|
the key/value secrets engine. If using K/V Version 2, its versioned data will
|
|
|
|
not be fully removed, but marked as deleted and will no longer be returned in
|
|
|
|
normal get requests.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Delete the latest version of the key "creds":
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
```shell-session
|
2022-06-15 23:07:50 +00:00
|
|
|
$ vault kv delete -mount=secret creds
|
2019-06-10 17:41:55 +00:00
|
|
|
Success! Data deleted (if it existed) at: secret/creds
|
|
|
|
```
|
|
|
|
|
|
|
|
**[K/V Version 2]** Delete version 11 of key "creds":
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
```shell-session
|
2022-06-15 23:07:50 +00:00
|
|
|
$ vault kv delete -mount=secret -versions=11 creds
|
|
|
|
Success! Data deleted (if it existed) at: secret/data/creds
|
2019-06-10 17:41:55 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2023-01-26 00:12:15 +00:00
|
|
|
There are no flags beyond the [standard set of flags](/vault/docs/commands)
|
2019-06-10 17:41:55 +00:00
|
|
|
included on all commands.
|
|
|
|
|
2023-07-18 21:07:55 +00:00
|
|
|
### Command options
|
2019-06-10 17:41:55 +00:00
|
|
|
|
2023-08-02 19:49:30 +00:00
|
|
|
- `-mount` `(string: "")` - Specifies the path where the KV backend is mounted.
|
|
|
|
If specified, the next argument will be interpreted as the secret path. If
|
|
|
|
this flag is not specified, the next argument will be interpreted as the
|
|
|
|
combined mount path and secret path, with /data/ automatically inserted for
|
2022-06-15 23:07:50 +00:00
|
|
|
KV v2 secrets.
|
|
|
|
|
2019-06-10 17:41:55 +00:00
|
|
|
- `-versions` `([]int: <required>)` - The versions to be deleted. The versioned
|
2020-01-18 00:18:09 +00:00
|
|
|
data will not be deleted, but it will no longer be returned in normal get
|
|
|
|
requests.
|
2019-06-10 17:41:55 +00:00
|
|
|
|
2022-06-15 23:07:50 +00:00
|
|
|
~> **NOTE:** The `-versions` command option is only for K/V v2.
|