Not able to retrieve the postman vault key

Hi

I am trying to setup api and secret keys set up in postman vault and use it in the pre request script

using pm.variables.get(“Api_key”) but it is returning empty

what is the reason

Hey @kdayalan :waving_hand:t2:

Accessing vault secrets via a script is a slightly different method than normal scoped variables.

You need to first explicitly toggle the option to give access the vault, via the vault settings, then you use the pm.vault.get() function in the script sandbox.

More details can be found here:

Thank you Danny ,also can we fetch the Keys from Azure Key Vault to Postman Vault and Vice

You can integrate an external vault, the keys from that service can be used directly in your HTTP requests.

More information can be found on the Docs site:

It wouldn’t allow you to pull them down into your Vault or add secrets to an external vault.