How can I list KV folders using the golang client?

Using the UI I have created some secrets under the networks/production/SpaceA and networks/production/SpaceB folders.

I have managed to read individual secrets using the golang client successfully.

However, I’m struggling to list the folders. Basically, I’m trying to make a call that returns both the SpaceA and SpaceB folders.

I have tried multiple variations of Logical().List("secrets/secret/networks/production/") with no luck.


part of the path is probably incorrect, but to know for sure we would need to know whether you are using KV version 1 or 2, and what path in Vault the KV engine is mounted at.

I am using the 1.11.0 docker image with the default config. I suspect that it comes with KV version 2.

This is how the folders that I’m trying to list show up in the UI.

Then, what you actually need is


The URL structure of the KV v2 secret engine is fairly complex - you will need some time studying the API docs to relate UI features to the URLs involved.

1 Like

Thank you! This did the trick!