Skip to main content

Read 1Password Environments using 1Password SDKs Beta

You can use 1Password SDKs to programatically read environment variables stored in 1Password Environments (beta) and use them in your applications.

Requirements

To use this feature, you'll need to install the beta version of the Go, JS, or Python SDK:

Read environment variables

To read environment variables stored in an Environment, use the GetVariables() method. Replace <your-environment-id> with the Environment's ID.

The method returns a GetVariablesResponse object that contains a list of the environment variables stored in the Environment.

Each environment variable in the response contains the following:

  • Name: The environment variable's name (for example, DB_HOST).
  • Value: The environment variable's value.
  • Masked: A boolean that indicates whether the value is hidden by default in the 1Password app.
note

1Password Environment variables are masked by default. To change this:

  1. Open and unlock the 1Password desktop app.
  2. Select Developer > View Environments.
  3. Choose the Environment, select Edit, then select the vertical ellipsis next to the variable and select Show value by default.

Appendix: Get an Environment's ID

To read environment variables from a 1Password Environment, you'll need its unique identifier (ID). You can find this ID in the 1Password desktop app:

  1. Open and unlock the 1Password desktop app.
  2. Navigate to Developer > View Environments.
  3. Select View environment next to the Environment you want to fetch.
  4. Select Manage environment > Copy environment ID.

Was this page helpful?