How can I update or create with OP a Login?


I try to store login information via a bash file. How can I create or update login information in an vault?

1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided
Referrer: forum-search:How can I update or create with OP a Login?


  • cohixcohix

    Team Member

    @hayo we currently do not support updating items with op, but here are the instructions to create an item:

  • hayohayo
    edited July 2019

    Hi cohix,
    thanks. For anyone who is looking here a short script:

    delete for existing login

    uuid=$(op get item "${LOGIN_TITLE}" --vault="${VAULT_NAME}" | jq '(.uuid)' | sed 's/\"//g')
    if [ -n "$uuid" ]
    op delete item $uuid

    create new login information

    login=$( op get template login )
    login_user=$( echo $login | jq --arg USER "$USER" -c '.fields[0].value = $USER ')
    login_user_pw=$( echo $login_user | jq --arg PW "$PW" -c '.fields[1].value = $PW' )
    encoded_login=$( echo $login_user_pw | op encode )

    save in vault

    op create item Login $encoded_login --title="$LOGIN_TITLE" --vault="$VAULT_NAME"
    echo '1Password Login updated for '${USER}'

  • ag_anaag_ana

    Team Member

    Thank you for sharing this! :+1:

  • felix_1pfelix_1p

    Team Member

    As of v0.10.0, the 1Password command line tool has a edit item command with which existing fields of an item can be updated. See for more information!

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file