Kv secrets engine via curl

Hi,
I have a secret in v2 of the kv engine. The path is drmkeys and the secret is called dashkey. CLI works fine to retrieve the key: $ ./vault kv get drmkeys/dashkey
But I’ve not been able to figure out the curl commands to GET the key via curl:
$ curl --header "X-Vault-Token: VAULT_TOKEN" --request GET http://127.0.0.1:8200/v2/kv/data/drmkeys/dashkey

How do you do that?
The documentation doesn’t clearly explain this with an example: KV - Secrets Engines - HTTP API | Vault by HashiCorp
Thank you,
Bob

1 Like

To get the curl version of 'kv get drmkeys/dashkey use:

 vault kv get -output-curl-string drmkeys/dashkey

Most likely issue though is that your KV engine is mounted as drmkeys/ and not kv/

2 Likes

Since we need to get a secret into a separate docker image, we don’t have the vault cli availabe.
The curl command you are looking for works like this:

curl -H "X-Vault-Request: true" -H "X-Vault-Token: $VAULT_TOKEN" "$VAULT_ADDR/v1/secrets/data/$KV_PATH"

Where KV_PATH is “drmkeys/dashkey“ in your case.