Skip to main content
You can use 1Password SDKs to programmatically read the secrets stored in 1Password Environments and use them in your applications.
Upcoming deprecationThe get_variables() function and the GetVariablesResponse and EnvironmentVariable types it returns will be deprecated on November 17, 2026, and removed on January 20, 2027. The new list_secrets() function will replace them. It takes an Environment name or ID and a reveal option, and returns a list of EnvironmentSecret objects directly, without a response wrapper.

Requirements

Before you begin, follow the steps to get started with a 1Password SDK. The examples on this page assume you have an initialized client instance. For example:

Read secrets

To read the secrets stored in an Environment, use the GetVariables() method. Replace <your-environment-id> with the Environment’s ID.
The method returns a GetVariablesResponse struct that contains a list of the secrets stored in the Environment.
Each secret in the response is an EnvironmentVariable struct that contains the following:
  • Name: The secret’s name (for example, DB_HOST).
  • Value: The secret’s value.
  • Masked: A boolean that indicates whether the value is hidden by default in the 1Password app.
Secrets in 1Password Environments 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 secret and select Show value by default.

Appendix: Get an Environment’s ID

To read secrets 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.