Error : Patch method not allowed while updating key/value pair using kv2 api's

Hello guys,

I am new to vault and exploring it’s api’s and CLI command.
I am using kv2 (version 2) secret engine to store keys and values, I am able to put, get the key/value pair using CLI and api. but while calling PATCH method to update to key/value pair via api, it’s throwing an error (405 method not allowed).

vault version : v1.4.0
Kindly provide some input.

Thanks in advance

1 Like

Hi Surendra-94,

Thanks for posting your question on the community forum.

The KVV2 API docs are here: https://www.vaultproject.io/api/secret/kv/kv-v2.html

As you can see, PATCH is not supported. There have been feature requests for it in the past, e.g. https://github.com/hashicorp/vault/issues/7437, but as of yet it has not been implemented.

One workaround that’s sometimes helpful is to break up your JSON across multiple KV keys. That way you don’t need PATCH, you just update different paths instead. Does that make sense?

Hi, this will not be convenient if there are many of the same type key/value =(