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 use op 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:Follow alongIf 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, useop 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
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.
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.fieldThe name of the field.fieldTypeThe type of field. If unspecified, the fieldType stays the same.valueThe information you want to save in the field. If unspecified, the value stays the same.
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
JSON item templates do not support passkeys. If you use a JSON template to update an item that contains a passkey, the passkey will be overwritten. To fix this, you can restore a previous version of the item.
-
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 with
op item template get. - Edit the file.
-
Use the
--templateflag to specify the path to the edited file and apply the changes to the item: - Delete the file.
--template flag in the same command.