Edit items
To edit an existing item in your 1Password account, use the op item edit
command.
You can edit basic information about the item with flags and use assignment statements to edit an item's built-in and custom fields. To edit sensitive values, use a JSON template.
You can't useop item edit
to edit SSH keys. Learn more about managing SSH keys with 1Password CLI.
Requirements
Before you can use 1Password CLI to edit items, you'll need to:
If you want to follow along with the examples in this guide, create the example items in the guide to creating items first.
Edit an item's basic information
To edit an item, use op item edit
and specify the item by name, unique identifier (ID), or sharing link.
You can use flags to generate a new password and edit an item's title, vault, or tags. You can also change the website where 1Password suggests and fills a Login, Password, or API Credential item.
For example, to change the name of the example item Netflix
, move it from the Tutorial
vault to the Private
vault, update its tags, edit its website, and generate a new random password:
- Bash, Zsh, sh, fish
- PowerShell
To change the example item name back to Netflix
and move it back to the Tutorial
vault:
- Bash, Zsh, sh, fish
- PowerShell
Edit built-in and custom fields
Command arguments can be visible to other processes on your machine. To edit sensitive values, use an item JSON template instead.
The op item edit
command can take a list of assignment statements as arguments to edit an item's built-in and custom fields.
- section (Optional) The name of the section where the field is saved.
- field The name of the field.
- fieldType The type of field. If unspecified, the fieldType stays the same.
- value The information you want to save in the field. If unspecified, the value stays the same.
For example, to change the subscription renewal date on the HBO Max
item:
- Bash, Zsh, sh, fish
- PowerShell
Delete a custom field
To delete a custom field, specify [delete]
in place of the fieldType. If you remove all the fields in a section, the section is also removed. You can't delete empty fields, but you can set them to empty strings.
To use an assignment statement to delete the subscription renewal date on the example HBO Max
item:
- Bash, Zsh, sh, fish
- PowerShell
Edit an item using a JSON template
To edit sensitive values on an item, use an item JSON template.
-
Get the JSON output for the item you want to edit and save it to a file.
If you prefer to start over, you can get a blank template for the item's category withop item template get
. -
Edit the file.
-
Use the
--template
flag to specify the path to the edited file and apply the changes to the item: -
Delete the file.
You can also edit an item using piped input:
To avoid collisions, you can't combine piped input and the --template
flag in the same command.
Next steps
If you created a Tutorial vault, you can delete the vault and the examples items you created: