How to enable a kv secret engine in vault using HTTP APIs

Viewed 2511

I am trying to enable kv secret engine at secret path in my vault setup.. I can easily do it using CLI

vault secrets enable -path=secret kv

But I have to make it work using Vault's HTTP APIs.

I have gone through documentation but could not find any endpoint for the above command.

Thanks in advance

1 Answers

This is covered under the System Backend/sys/mounts API reference page.

Issue a POST request to /v1/sys/mounts/<mountpoint> with a payload containing the type (kv) and various configuration options. For KV, you probably want to specify version: 2 (or type kv-v2) unless you want to stick to V1.

See the above link for details on the possible parameters.

Here is the example from the docs:

payload.json:

{
  "type": "aws",
  "config": {
    "force_no_cache": true
  }
}

Request:

$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --data @payload.json \
    http://127.0.0.1:8200/v1/sys/mounts/my-mount
Related