Export all entries of 1password via command line

growlert
growlert
Community Member

Hello!
I want to periodically backup all of my entries in 1password account, so I need to automate this process by some script.
Is there a way to do this via command line or maybe Powershell (Windows)?


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • ag_ana
    ag_ana
    1Password Alumni

    Hi @growlert! Welcome to the forum!

    Yes, you can use the 1Password CLI for this :)

  • growlert
    growlert
    Community Member

    OK.
    I saw this article, but didnt find anything related to do an export. Can you give me please exact command to do so?

  • cohix
    cohix
    1Password Alumni

    @growlert there is no specific command, you would do a process such as:

    • op list items to get a list of every item you have access to
    • loop through that list and use op get item <uuid> to fetch the full item contents, then write that to a file or something like that :)
  • felix_1p
    felix_1p
    1Password Alumni

    @growlert See my comment here for an example with bash (or other POSIX-complient shells): https://discussions.agilebits.com/discussion/comment/544051/#Comment_544051

  • growlert
    growlert
    Community Member

    Thank you! Both
    I've already found a solution in Powershell, so it does the same as you wrote:

    [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
    $op =  "D:\op_windows_amd64_v0.9.1\op.exe"
    $results = & $op list items
    
    $data = $results | ConvertFrom-Json
    
    $id = $data.uuid
    
    foreach ($item in $id) {
        & $op get item $item
    }
    

    One thing it's very slow for each iteration of item. We have many of them, so I have to wait hours to save it all?
    Can I get the bunch of it at one command?

  • felix_1p
    felix_1p
    1Password Alumni

    Can I get the bunch of it at one command?

    Unfortunately not. There are some things we can improve regarding getting items by UUID, but for now to fetch a single item as quickly as possible you should pass both, the item UUID and the vault UUID via --vault=<vault UUID>.

  • growlert
    growlert
    Community Member

    Ok. Thanks

  • cohix
    cohix
    1Password Alumni

    @growlert Let us know if you have any other questions or feedback.

This discussion has been closed.