---
layout: docs
page_title: Read data
description: >-
   Read versioned key/value data from the kv v2 plugin
---

# Read versioned key/value data

Read versioned data from an existing data path in the `kv` v2 plugin.

<Tip title="Assumptions">

- You have [set up a `kv` v2 plugin](/vault/docs/secrets/kv/kv-v2/setup). 
- Your authentication token has `read` permissions for the `kv` v2 plugin.

</Tip>

<Tabs>

<Tab heading="CLI" group="cli">

Use [`vault kv get`](/vault/docs/command/kv/read) to read **all** the current
key/value pairs on the given path:

```shell-session
$ vault kv get             \
   -mount <mount_path>     \
   <secret_path>
```

For example:

<CodeBlockConfig hideClipboard="true">

```shell-session
$ vault kv get -mount shared dev/square-api

======= Secret Path =======
shared/data/dev/square-api

======= Metadata =======
Key                Value
---                -----
created_time       2024-11-13T21:58:32.128442898Z
custom_metadata    <nil>
deletion_time      n/a
destroyed          false
version            3

===== Data =====
Key        Value
---        -----
prod       5678
sandbox    1234
```

</CodeBlockConfig>

Use the `-field` flag to target specific key value pairs on the given path:

```shell-session
$ vault kv get          \
   -mount <mount_path>  \
   -field <field_name>  \
   <secret_path>
```

For example:

<CodeBlockConfig hideClipboard="true">

```shell-session
$ vault kv get -mount shared -field prod dev/square-api

5678
```

</CodeBlockConfig>

</Tab>

<Tab heading="GUI" group="gui">

@include 'gui-instructions/plugins/kv/open-overview.mdx'

- Select the **Secret** tab.
- Click the eye icon to view the desired key value.

![Partial screenshot of the Vault GUI showing two key/value pairs at the path dev/square-api. The "prod" key is visible](/img/gui/kv/read-data.png)

</Tab>

<Tab heading="API" group="api">

Call the [`/{plugin_mount_path}/data/{secret_path}`](/vault/api-docs/secret/kv/kv-v2#read-secret-version)
endpoint to read all the key/value pairs at the secret path:

```shell-session
$ curl                                       \
   --request GET                             \
   --header "X-Vault-Token: ${VAULT_TOKEN}"  \
   ${VAULT_ADDR}/v1/<plugin_mount_path>/data/<secret_path>
```

For example:

<CodeBlockConfig hideClipboard="true">

```shell-session
$ curl                                       \
   --request GET                             \
   --header "X-Vault-Token: ${VAULT_TOKEN}"  \
   ${VAULT_ADDR}/v1/shared/data/dev/square-api | jq

{
  "request_id": "992da4a2-f2d1-5786-ea53-1e8ea6440a7c",
  "lease_id": "",
  "renewable": false,
  "lease_duration": 0,
  "data": {
    "data": {
      "prod": "5679",
      "sandbox": "1234",
      "smoke": "abcd"
    },
    "metadata": {
      "created_time": "2024-11-15T02:41:02.556301319Z",
      "custom_metadata": null,
      "deletion_time": "",
      "destroyed": false,
      "version": 7
    }
  },
  "wrap_info": null,
  "warnings": null,
  "auth": null,
  "mount_type": "kv"
}
```

</CodeBlockConfig>

</Tab>

</Tabs>
