Environment specific vault values

I have an environment specific secret value, for example an API key. I want to store this value in Postman Vault, but be able switch between keys when changing environments and reference only 1 variable. Is this possible?

environment: env1
my_api_key = {{vault:my_api_key_env1}}

environment: env2
my_api_key = {{vault:my_api_key_env2}}

Post request
Auth-header={{my_api_key}} (scope env)

Have you tried it? Sounds like it should work.

The variable from inside the environment value doesnโ€™t get resolved and comes as a string {{vault:my_api_key_env1}}

You canโ€™t console log it in scripts as it will show as a string.

You canโ€™t retrieve the values in scripts either.

You can only use the vault values in certain places like the request body, authentication tabs, URL, etc.

This topic relates.

Access Postman Vault from Pre-Request Script - :person_raising_hand: Help - Postman Community

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.