Requirements
Before you begin, follow the steps to get started with a 1Password SDK. The examples on this page assume you have an initializedclient instance. For example:
- Go
- JavaScript
- Python
Read secrets
- Go
- JavaScript
- Python
To read the secrets stored in an Environment, use the The method returns a Each secret in the response is an
GetVariables() method. Replace <your-environment-id> with the Environment’s ID.GetVariablesResponse struct that contains a list of the secrets stored in the Environment.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:
- Open and unlock the 1Password desktop app.
- Select Developer > View Environments.
- 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:- Open and unlock the 1Password desktop app.
- Navigate to Developer > View Environments.
- Select View environment next to the Environment you want to fetch.
- Select Manage environment > Copy environment ID.