### Get Started with 1Password CLI Setup
Source: https://www.1password.dev/cli/reference
Learn how to set up the 1Password CLI and sign in to your account. This is the first step for new users.
```markdown
If you're new to 1Password CLI, [learn how to set it up and sign in to your account](/cli/get-started/).
```
--------------------------------
### Example Request with Reset Cursor
Source: https://www.1password.dev/events-api/reference
Use this example to initiate a request for sign-in attempts, providing a limit and start time. Ensure you include your bearer token and set the Content-Type header.
```shell
curl --request POST \
--url base_url/api/v2/signinattempts \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--data '{ \
"limit": 100, \
"start_time": "2023-03-15T16:32:50-03:00" \
}'
```
--------------------------------
### Get all details for an item
Source: https://www.1password.dev/cli/reference
This example shows the full output when retrieving an item with all its fields.
```shell
op item get "work email"
#code-result
ID: a5w3is43ohs25qonzajrqaqx4q
Title: work email
Vault: Work (2gq6v6vzorl7jfxdurns4hl66e)
Created: 6 years ago
Updated: 9 months ago by Wendy Appleseed
Favorite: true
Version: 1
Category: LOGIN
Fields:
username: wendy.c.appleseed@agilebits.com
password: NLuXcEtg27JMjGmiBHXZMGCgce
URLs:
website: https://www.gmail.com (primary)
```
--------------------------------
### Install 1Password Go SDK (Beta)
Source: https://www.1password.dev/environments/read-environment-variables
Install the beta version of the Go SDK to read environment variables. Ensure you have Go installed and configured.
```shell
go get github.com/1password/onepassword-sdk-go@v0.4.1-beta.1
```
--------------------------------
### Install 1Password CLI and Use Secrets in CircleCI
Source: https://www.1password.dev/ci-cd/circle-ci
This example demonstrates installing the 1Password CLI and then using it to log into Docker and push an image. It shows how to read secrets directly from 1Password using `op read`.
```yaml
version: 2.1
orbs:
1password: onepassword/secrets@1.0.0
jobs:
deploy:
machine:
image: ubuntu-2204:current
steps:
- 1password/install-cli
- checkout
- run: |
docker login -u $(op read op://company/docker/username) -p $(op read op://company/docker/password)
docker build -t company/app:${CIRCLE_SHA1:0:7} .
docker push company/app:${CIRCLE_SHA1:0:7}
```
--------------------------------
### Get specific fields for an item
Source: https://www.1password.dev/cli/reference
This example shows the output when retrieving only the username and password for an item.
```shell
op item get "work email" --fields label=username,label=password
#code-result
wendy.c.appleseed@agilebits.com,NLuXcEtg27JMjGmiBHXZMGCgce
```
--------------------------------
### File Object Example
Source: https://www.1password.dev/connect/api-reference
Example of a file object, including its ID, name, size, and content path.
```json
{
"id": "6r65pjq33banznomn7q22sj44e",
"name": "testfile.txt",
"size": 35,
"content_path": "v1/vaults/ftz4pm2xxwmwrsd7rjqn7grzfz/items/2fcbqwe9ndg175zg2dzwftvkpa/files/6r65pjq33banznomn7q22sj44e/content",
"content": "VGhlIGZ1dHVyZSBiZWxvbmdzIHRvIHRoZSBjdXJpb3VzLgo=",
"section": {
"id": "95cdbc3b-7742-47ec-9056-44d6af82d562"
}
}
```
--------------------------------
### Install 1Password Pulumi Provider with go get
Source: https://www.1password.dev/pulumi
Use this command to download the latest version of the 1Password provider for Pulumi in your Go project.
```shell
go get github.com/1Password/pulumi-onepassword/sdk/go/...
```
--------------------------------
### Kubernetes Injector Link
Source: https://www.1password.dev/k8s/integrations
Link to get started with the Kubernetes Injector integration.
```html
Get started with the Kubernetes Injector
```
--------------------------------
### Install 1Password CLI and Use Secrets for AWS in CircleCI
Source: https://www.1password.dev/ci-cd/circle-ci
This example shows installing the 1Password CLI and then using it within a job to set AWS credentials as environment variables. It demonstrates how to securely inject secrets for use in subsequent commands.
```yaml
version: 2.1
orbs:
1password: onepassword/secrets@1.0.0
jobs:
deploy:
machine:
image: ubuntu-2204:current
steps:
- 1password/install-cli
- checkout
- run:
shell: op run -- /bin/bash
environment:
AWS_ACCESS_KEY_ID: op://company/app/aws/access_key_id
AWS_SECRET_ACCESS_KEY: op://company/app/aws/secret_access_key
command: |
echo "This value will be masked: $AWS_ACCESS_KEY_ID"
echo "This value will be masked: $AWS_SECRET_ACCESS_KEY"
./deploy-my-app.sh
```
--------------------------------
### Example item usage request with a reset cursor
Source: https://www.1password.dev/events-api/reference
Use this snippet to initiate a request for item usage events, providing a limit and start time. Ensure you include your bearer token and set the Content-Type to application/json.
```shell
curl --request POST \
--url base_url/api/v2/itemusages \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--data '{ \
"limit": 100, \
"start_time": "2023-03-15T16:32:50-03:00" \
}'
```
--------------------------------
### Install 1Password Provider Binary
Source: https://www.1password.dev/pulumi
Installs the 1Password provider binary using the Pulumi CLI. Replace `` with the desired version.
```shell
pulumi plugin install resource onepassword --server github://api.github.com/1Password/pulumi-onepassword
```
--------------------------------
### 1Password Helm Charts Link
Source: https://www.1password.dev/k8s/integrations
Link to get started with the 1Password Helm charts for Kubernetes.
```html
Get started 1Password Helm charts
```
--------------------------------
### Configure Multiple Commit Signing Setups with includeIf
Source: https://www.1password.dev/ssh/git-commit-signing
Use this TOML configuration in your global ~/.gitconfig to conditionally apply different commit signing setups based on the repository's directory. The SSH setup is used by default, while the GPG setup is applied to repositories under ~/work/acme/.
```toml
[user]
name = "Wendy Appleseed"
email = "wendy@appleseed.com"
signingkey = "ssh-ed25519 AAAAC3NzaC1IZDI1NTE5AAAAIFIUXAdv5sWOrfZFEPAW8liKjBW3sFxuaNITBWwtFKO"
[commit]
gpgsign = true
[gpg]
format = ssh
[gpg "ssh"]
program = /Applications/1Password.app/Contents/MacOS/op-ssh-sign"
[includeIf "gitdir:~/work/acme/"]
path = ~/work/acme/.gitconfig
```
```toml
[user]
email = "wendy.appleseed@acme.com"
signingkey = "6A40D13BBB936F443084E8C9292E4F983136B860"
[gpg]
format = openpgp
```
--------------------------------
### Install 1Password JavaScript SDK (Beta)
Source: https://www.1password.dev/environments/read-environment-variables
Install the beta version of the JavaScript SDK for Node.js or browser environments. This is required for reading environment variables.
```shell
npm install @1password/sdk@0.4.1-beta.1
```
--------------------------------
### Install 1Password CLI on Debian/Ubuntu (APT)
Source: https://www.1password.dev/cli/get-started
This shell command installs the 1Password CLI by adding the official repository, its GPG key, and the debsig policy, then updating the package list and installing the CLI.
```shell
curl -sS https://downloads.1password.com/linux/keys/1password.asc | \
sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/$(dpkg --print-architecture) stable main" | \
sudo tee /etc/apt/sources.list.d/1password.list && \
sudo mkdir -p /etc/debsig/policies/AC2D62742012EA22/ && \
curl -sS https://downloads.1password.com/linux/debian/debsig/1password.pol | \
sudo tee /etc/debsig/policies/AC2D62742012EA22/1password.pol && \
sudo mkdir -p /usr/share/debsig/keyrings/AC2D62742012EA22 && \
curl -sS https://downloads.1password.com/linux/keys/1password.asc | \
sudo gpg --dearmor --output /usr/share/debsig/keyrings/AC2D62742012EA22/debsig.gpg && \
sudo apt update && sudo apt install 1password-cli
```
--------------------------------
### Example Request with Continuing Cursor
Source: https://www.1password.dev/events-api/reference
Use this example to fetch subsequent pages of sign-in attempt events by providing a cursor obtained from a previous response. Include your bearer token and set the Content-Type header.
```shell
curl --request POST \
--url base_url/api/v2/signinattempts \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--data '{ \
"cursor": "aGVsbG8hIGlzIGl0IG1lIHlvdSBhcmUgbG9va2luZyBmb3IK" \
}'
```
--------------------------------
### Install 1Password Python SDK (Beta)
Source: https://www.1password.dev/environments/read-environment-variables
Install the beta version of the Python SDK to integrate with your Python applications for reading environment variables.
```python
pip install onepassword-sdk==0.4.1b1
```
--------------------------------
### Example API Endpoint (Test Server, No Path Parameter)
Source: https://www.1password.dev/partnership-api/reference
Shows an example of a test server API endpoint URL without any specific path parameters.
```text
https://billing.b5test.eu/api/v1/partners/accounts
```
--------------------------------
### Example audit events request with a reset cursor
Source: https://www.1password.dev/events-api/reference
Use this snippet to make an initial request for audit events, including a limit and start time. Ensure you include your bearer token and the correct content type.
```shell
curl --request POST \
--url base_url/api/v2/auditevents \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--data '{ \
"limit": 100, \
"start_time": "2023-03-15T16:32:50-03:00" \
}'
```
--------------------------------
### Example of Correct Local Git Signing Configuration
Source: https://www.1password.dev/ssh/git-commit-signing
This is an example of the expected output when your local Git configuration for SSH commit signing is set up correctly. It shows the format, signing key, SSH program, and whether commit signing is enabled.
```text
gpg.format: ssh
user.signingkey: ssh-ed25519 AAAAC3NzaC1IZDI1NTE5AAAAIFIUXAdv5sWOrfZFEPAW8liKjBW3sFxuaNITBWwtFKO
gpg.ssh.program: /Applications/1Password.app/Contents/MacOS/op-ssh-sign
commit.gpgsign: true
```
--------------------------------
### Install 1Password CLI (Declarative Jenkinsfile)
Source: https://www.1password.dev/ci-cd/jenkins
Installs the 1Password CLI by downloading, unzipping, and moving the executable. This snippet is for Declarative Jenkins pipelines.
```groovy
pipeline {
agent any
stages {
stage('Install 1Password CLI') {
steps {
sh 'curl -sSfLo op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/v2.24.0/op_linux_amd64_v2.24.0.zip"'
sh 'unzip -o op.zip -d op-dir'
sh 'mv -f op-dir/op /usr/local/bin'
sh 'rm -r op.zip op-dir'
}
}
}
}
```
--------------------------------
### Verify 1Password CLI Installation (macOS/Linux)
Source: https://www.1password.dev/cli/get-started
After installation, run this command to check if the 1Password CLI is installed correctly and to see its version. This is applicable to macOS and Linux.
```shell
op --version
```
--------------------------------
### 1Password CLI Item Creation Example (Fails in Pipeline)
Source: https://www.1password.dev/ci-cd/github-actions
This example demonstrates a command that fails in a GitHub pipeline environment due to the CLI's pipe detection expecting piped input. Use JSON templates instead.
```shell
op item create --category=login --title='My Example Item' --vault='Test' \
--url https://www.acme.com/login \
--generate-password=20,letters,digits \
username=jane@acme.com \
'Test Field 1=my test secret' \
'Test Section 1.Test Field2[text]=Jane Doe' \
'Test Section 1.Test Field3[date]=1995-02-23' \
'Test Section 2.Test Field4[text]='$myNotes'
```
--------------------------------
### Install 1Password CLI with Homebrew
Source: https://www.1password.dev/get-started/administrator-quickstart
Use this command to install the 1Password CLI on macOS or Linux systems that have Homebrew installed.
```shell
brew install 1password-cli
```
--------------------------------
### 404 Not Found Error Example
Source: https://www.1password.dev/partnership-api/reference
This example demonstrates a 404 Not Found error, returned when a requested resource or a dependency of a resource cannot be located. The description clarifies which resource was not found.
```json
{
"code": 404,
"error": "not_found",
"description": "Domain not found."
}
```
--------------------------------
### Generator Recipe Example
Source: https://www.1password.dev/connect/api-reference
Example of a generator recipe object to customize password generation.
```json
{
"length": 55,
"characterSets": [
"LETTERS",
"DIGITS"
]
}
```
--------------------------------
### Install 1Password CLI with Winget
Source: https://www.1password.dev/get-started/administrator-quickstart
Use this command to install the 1Password CLI on Windows systems that have the Windows Package Manager (winget) configured.
```shell
winget install 1password-cli
```
--------------------------------
### Example SSH Public Key Format
Source: https://www.1password.dev/ssh/git-commit-signing
This is an example of a correctly formatted SSH public key that should be used for Git commit signing.
```text
ssh-ed25519 AAAAC3NzaC1IZDI1NTE5AAAAIFIUXAdv5sWOrfZFEPAW8liKjBW3sFxuaNITBWwtFKO
```
--------------------------------
### Install 1Password Pulumi Provider with pip
Source: https://www.1password.dev/pulumi
Use this command to install the 1Password provider for Pulumi in your Python project.
```shell
pip install pulumi_onepassword
```
--------------------------------
### Install 1Password Pulumi Provider with npm
Source: https://www.1password.dev/pulumi
Use this command to install the 1Password provider for Pulumi in your Node.js project using npm.
```shell
npm install @1password/pulumi-onepassword
```
--------------------------------
### Update APT and Install 1Password CLI
Source: https://www.1password.dev/cli/get-started
Updates the package list and installs the 1Password CLI package using APT.
```shell
sudo apt update && sudo apt install 1password-cli
```
--------------------------------
### Install 1Password CLI on Windows
Source: https://www.1password.dev/cli/get-started
This PowerShell script downloads, installs, and adds the 1Password CLI to the system's PATH. It automatically detects the OS architecture and handles potential language differences.
```powershell
$arch = (Get-CimInstance Win32_OperatingSystem).OSArchitecture
switch ($arch) {
'64-bit' { $opArch = 'amd64'; break }
'32-bit' { $opArch = '386'; break }
Default { Write-Error "Sorry, your operating system architecture '$arch' is unsupported" -ErrorAction Stop }
}
$installDir = Join-Path -Path $env:ProgramFiles -ChildPath '1Password CLI'
Invoke-WebRequest -Uri "https://cache.agilebits.com/dist/1P/op2/pkg/v2.33.1/op_windows_$($opArch)_v2.33.1.zip" -OutFile op.zip
Expand-Archive -Path op.zip -DestinationPath $installDir -Force
$envMachinePath = [System.Environment]::GetEnvironmentVariable('PATH','machine')
if ($envMachinePath -split ';' -notcontains $installDir){
[Environment]::SetEnvironmentVariable('PATH', "$envMachinePath;$installDir", 'Machine')
}
Remove-Item -Path op.zip
```
--------------------------------
### Install Save in 1Password button using npm
Source: https://www.1password.dev/web/add-1password-button-website
Install the Save in 1Password button package as a development dependency using npm.
```shell
npm install @1password/save-button --save-dev
```
--------------------------------
### Manual Linux Installation of 1Password CLI
Source: https://www.1password.dev/cli/get-started
Installs the 1Password CLI on Linux without a package manager. Choose the appropriate architecture for your system.
```shell
ARCH="" && \
wget "https://cache.agilebits.com/dist/1P/op2/pkg/v2.33.1/op_linux_${ARCH}_v2.33.1.zip" -O op.zip && \
unzip -d op op.zip && \
sudo mv op/op /usr/local/bin/ && \
rm -r op.zip op && \
sudo groupadd -f onepassword-cli && \
sudo chgrp onepassword-cli /usr/local/bin/op && \
sudo chmod g+s /usr/local/bin/op
```
--------------------------------
### Example Partner Billing Link for New Individual Account
Source: https://www.1password.dev/partnership-api/reference
An example of a partner billing link for a new individual account on 1Password.eu, including an optional language parameter set to German.
```text
https://start.1password.eu/sign-up/individual?c=4266474b-6385-56d4-7b75-648096593064&l=de
```
--------------------------------
### Example Partner Billing Link for New Family Account
Source: https://www.1password.dev/partnership-api/reference
An example of a partner billing link for a new family account on 1Password.com, including an optional language parameter set to English.
```text
https://start.1password.com/sign-up/family?c=4266474b-6385-56d4-7b75-648096593064&l=en
```
--------------------------------
### Install 1Password CLI (Scripted Jenkinsfile)
Source: https://www.1password.dev/ci-cd/jenkins
Installs the 1Password CLI using a shell script within a Scripted Jenkins pipeline. It allows for variable substitution for the architecture.
```groovy
node {
stage('Install 1Password CLI') {
sh '''
ARCH="amd64"
curl -sSfLo op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/v2.24.0/op_linux_${ARCH}_v2.24.0.zip"
unzip -o op.zip -d op-dir
mv -f op-dir/op /usr/local/bin
rm -r op.zip op-dir
'''
}
}
```
--------------------------------
### Kubernetes Operator Link
Source: https://www.1password.dev/k8s/integrations
Link to get started with the Kubernetes Operator integration.
```html
Get started with the Kubernetes Operator
```
--------------------------------
### Example API Endpoint (Production Server, With Path Parameter)
Source: https://www.1password.dev/partnership-api/reference
Demonstrates a production server API endpoint URL that includes a required path parameter for a specific account.
```text
https://billing.1password.com/api/v1/partners/accounts/4266474b-6385-56d4-7b75-648096593064
```
--------------------------------
### Example item usage response
Source: https://www.1password.dev/events-api/reference
This is a sample response from the item usages endpoint, showing cursor details, whether more data is available, and an array of item usage events.
```json
{
"cursor": "aGVsbG8hIGlzIGl0IG1lIHlvdSBhcmUgbG9va2luZyBmb3IK",
"has_more": true,
"items": [
{
"uuid": "56YE2TYN2VFYRLNSHKPW5NVT5E",
"timestamp": "2023-03-15T16:33:50-03:00",
"used_version": 0,
"vault_uuid": "VZSYVT2LGHTBWBQGUJAIZVRABM",
"item_uuid": "SDGD3I4AJYO6RMHRK8DYVNFIDZ",
"user": {
"uuid": "4HCGRGYCTRQFBMGVEGTABYDU2V",
"name": "Wendy Appleseed",
"email": "wendy_appleseed@agilebits.com"
},
"client": {
"app_name": "1Password Browser",
"app_version": "20240",
"platform_name": "Chrome",
"platform_version": "string",
"os_name": "MacOSX",
"os_version": "13.2",
"ip_address": "192.0.2.254"
},
"location": {
"country": "Canada",
"region": "Ontario",
"city": "Toronto",
"latitude": 43.5991,
"longitude": -79.4988
},
"action": "secure-copy"
}
]
}
```
--------------------------------
### Jenkinsfile with 1Password Secrets Plugin
Source: https://www.1password.dev/get-started/secure-deployment
Example of using the `withSecrets` function in a Jenkinsfile to load secrets from 1Password. This requires the 1Password Secrets plugin to be installed in Jenkins.
```groovy
pipeline {
agent any
stages {
stage('Load Secrets') {
steps {
withSecrets {
// Use secrets loaded by the withSecrets step
sh 'echo "The secret is: $MY_SECRET_VARIABLE"'
}
}
}
}
}
// Example of how to use withSecrets in a Jenkinsfile
// This assumes the 1Password Secrets plugin is installed and configured
// with your service account token or Connect server credentials.
def call() {
withSecrets {
// Your pipeline steps that need access to secrets go here
sh 'echo "Loading secrets..."'
sh 'echo "MY_SECRET_VARIABLE is available as an environment variable."'
}
}
```
--------------------------------
### Introspect Bearer Token
Source: https://www.1password.dev/events-api/reference
Use this example to make a GET request to the /api/v2/auth/introspect endpoint to check token authorization and account details. Ensure you replace YOUR_BEARER_TOKEN with your actual token.
```shell
curl --request GET \
--url base_url/api/v2/auth/introspect \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN'
```
--------------------------------
### Access Secrets in CircleCI Job using Service Account
Source: https://www.1password.dev/ci-cd/circle-ci
Example CircleCI `config.yml` demonstrating how to install the 1Password CLI and use `op run` to access secrets. The `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are loaded from 1Password and will be masked in logs.
```yaml
version: 2.1
orbs:
1password: onepassword/secrets@1.0.0
jobs:
deploy:
machine:
image: ubuntu-2204:current
steps:
- 1password/install-cli:
version: 2.x.x
- checkout
- run:
shell: op run -- /bin/bash
environment:
AWS_ACCESS_KEY_ID: op://company/app/aws/access_key_id
AWS_SECRET_ACCESS_KEY: op://company/app/aws/secret_access_key
command: |
echo "This value will be masked: $AWS_ACCESS_KEY_ID"
echo "This value will be masked: $AWS_SECRET_ACCESS_KEY"
./deploy-my-app.sh
workflows:
deploy:
jobs:
- deploy
```
--------------------------------
### Provision a New User and Add to Group
Source: https://www.1password.dev/get-started/manage-organization
Use these commands to provision a new user and then grant them access to a specific group.
```shell
op user provision --name "Wendy Appleseed" --email wendy.appleseed@agilebits.com
op group user grant --group Engineering --user wendy.appleseed@agilebits.com
```
--------------------------------
### Install 1Password CLI with YUM
Source: https://www.1password.dev/cli/get-started
Installs 1Password CLI on RPM-based distributions using YUM. It configures the repository and installs the package.
```shell
sudo rpm --import https://downloads.1password.com/linux/keys/1password.asc
sudo sh -c 'echo -e "[1password]\nname=1Password Stable Channel\nbaseurl=https://downloads.1password.com/linux/rpm/stable/$basearch\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=\"https://downloads.1password.com/linux/keys/1password.asc\"" > /etc/yum.repos.d/1password.repo'
sudo dnf check-update -y 1password-cli && sudo dnf install 1password-cli
```
--------------------------------
### Example .ignore file entries
Source: https://www.1password.dev/watchtower
Add file names or patterns to this file to specify which files 1Password should ignore in your ~/.ssh directory. Each entry should be on a new line.
```text
test_key
*_development
```
--------------------------------
### Install 1Password CLI with Alpine APK
Source: https://www.1password.dev/cli/get-started
Installs 1Password CLI on Alpine Linux distributions. It adds the repository, imports the public key, and installs the package.
```shell
echo https://downloads.1password.com/linux/alpinelinux/stable/ >> /etc/apk/repositories
wget https://downloads.1password.com/linux/keys/alpinelinux/support@1password.com-61ddfc31.rsa.pub -P /etc/apk/keys
apk update && apk add 1password-cli
```
--------------------------------
### Initialize and Authenticate 1Password Client
Source: https://www.1password.dev/environments/read-environment-variables
Initializes the 1Password client using environment variables for authentication. Ensure OP_ACCOUNT_NAME is set.
```python
client = await Client.authenticate(
auth=DesktopAuth(os.environ.get("OP_ACCOUNT_NAME")),
integration_name="My 1Password Integration",
integration_version="v1.0.0",
)
```
--------------------------------
### Get Help for a Command
Source: https://www.1password.dev/cli/reference
Use the --help option with any command to display its usage information.
```bash
op [subcommand] --help
```
--------------------------------
### Field Object Example
Source: https://www.1password.dev/connect/api-reference
Example of a field object, specifying type, generation, and label.
```json
{
"section": {
"id": "95cdbc3b-7742-47ec-9056-44d6af82d562"
},
"type": "STRING",
"generate": true,
"label": "Random Text"
}
```
--------------------------------
### Example Error Response
Source: https://www.1password.dev/events-api/reference
An example of an error response from the API, indicating unauthorized access.
```json
{
"status": 401,
"message": "Unauthorized access"
}
```
--------------------------------
### Example API Endpoint Structure
Source: https://www.1password.dev/partnership-api/reference
Illustrates the general structure of an API endpoint, including base URL, path, and parameters.
```text
//{parameters}
```
--------------------------------
### Filter Vaults by Name Example
Source: https://www.1password.dev/connect/api-reference
This example demonstrates how to filter the vault collection by name using SCIM-style filters.
```http
name eq "Demo Vault"
```
--------------------------------
### MCP Server Config with Plaintext Token
Source: https://www.1password.dev/get-started/secure-ai-access
Example of an MCP server configuration file with a GitHub token exposed directly.
```json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_your-secret-token"
}
}
}
}
```
--------------------------------
### Example Sign-in Attempt Response
Source: https://www.1password.dev/events-api/reference
A successful response includes a cursor for pagination, a boolean indicating if more data is available, and an array of sign-in attempt objects.
```json
{
"cursor": "aGVsbG8hIGlzIGl0IG1lIHlvdSBhcmUgbG9va2luZyBmb3IK",
"has_more": true,
"items": [
{
"uuid": "56YE2TYN2VFYRLNSHKPW5NVT5E",
"session_uuid": "A5K6COGVRVEJXJW3XQZGS7VAMM",
"timestamp": "2023-03-15T16:32:50-03:00",
"category": "firewall_failed",
"type": "continent_blocked",
"country": "France",
"details": {
"value": "Europe"
},
"target_user": {
"uuid": "IR7VJHJ36JHINBFAD7V2T5MP3E",
"name": "Wendy Appleseed",
"email": "wendy_appleseed@agilebits.com"
},
"client": {
"app_name": "1Password Browser",
"app_version": "20240",
"platform_name": "Chrome",
"platform_version": "string",
"os_name": "MacOSX",
"os_version": "13.2",
"ip_address": "192.0.2.254"
},
"location": {
"country": "Canada",
"region": "Ontario",
"city": "Toronto",
"latitude": 43.5991,
"longitude": -79.4988
}
}
]
}
```
--------------------------------
### Install Save in 1Password button using Yarn
Source: https://www.1password.dev/web/add-1password-button-website
Install the Save in 1Password button package as a development dependency using Yarn.
```shell
yarn add @1password/save-button -D
```
--------------------------------
### Example item usage request with a continuing cursor
Source: https://www.1password.dev/events-api/reference
Use this snippet to retrieve subsequent pages of item usage events by providing the cursor from a previous response. Include your bearer token and set the Content-Type to application/json.
```shell
curl --request POST \
--url base_url/api/v2/itemusages \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--data '{ \
"cursor": "aGVsbG8hIGlzIGl0IG1lIHlvdSBhcmUgbG9va2luZyBmb3IK" \
}'
```
--------------------------------
### Create a 1Password Database Item
Source: https://www.1password.dev/terraform
This example demonstrates the creation of a 'database' type item using the `onepassword_item` resource. It configures details specific to a MySQL database, including hostname, port, username, and the database name.
```terraform
resource "onepassword_item" "demo_db" {
vault = var.demo_vault
category = "database"
type = "mysql"
title = "Demo TF Database"
username = "root"
database = "Example MySQL Instance"
hostname = "localhost"
port = 3306
}
```
--------------------------------
### Install 1Password Pulumi Provider with yarn
Source: https://www.1password.dev/pulumi
Use this command to install the 1Password provider for Pulumi in your Node.js project using yarn.
```shell
yarn add @1password/pulumi-onepassword
```
--------------------------------
### Configure 1Password CLI in NixOS
Source: https://www.1password.dev/cli/get-started
Example snippet for NixOS configuration to enable 1Password CLI and the 1Password app. This requires NixOS to have built-in modules for 1Password.
```nix
# NixOS has built-in modules to enable 1Password
# along with some pre-packaged configuration to make
# it work nicely. You can search what options exist
# in NixOS at https://search.nixos.org/options
```
--------------------------------
### Build and Push Docker Image
Source: https://www.1password.dev/ci-cd/github-actions
Build and push a Docker image using the docker/build-push-action. This step typically follows a successful Docker Hub login.
```yaml
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: acme/app:latest
```