bw list itemsAlternatively, if you don't set the environment variable, you can pass the session key as an option with each bw command:BashCopybw list items --session "5PBYGU+5yt3RHcCjoeJKx/wByU34vokGRZjXpSH7Ylo8w=="tipWhen you're finished, always end your session using the bw lock or bw logout commands. This will invalidate the active session key.Core CommandscreateThe create command creates a new object (item, attachment, and more) in your vault:BashCopybw create (item|attachment|folder|org-collection) <encodedJson> [options]The create command takes encoded JSON. A typical workflow for creating an object might look something like:Use the get template command (see for details) to output the appropriate JSON template for the object type.Use a to manipulate the outputted template as required.Use the encode command (see ) to encode the manipulated JSON.Use the create command to create an object from the encoded JSON.For example:BashCopybw get template folder | jq '.name="My First Folder"' | bw encode | bw create folderorBashCopybw get template item | jq ".name=\"My Login Item\" | .login=$(bw get template item.login | jq '.username="jdoe" | .password="myp@ssword123"')" | bw encode | bw create itemUpon successful creation, the newly created object will be returned as JSON.create other item typesThe create command defaults to creating a login item, but you can use a to change a .type= attribute to create other item types:NameValueLogin.type=1Secure note.type=2Card.type=3Identity.type=4For example, the following command will create a secure note:BashCopybw get template item | jq '.type = 2 | .secureNote.type = 0 | .notes = "Contents of my Secure Note." | .name = "My Secure Note"' | bw encode | bw create itemnoteNotice in the above example that Secure Notes require a sub-template (.secureNote.type). You can view item type sub-templates using bw get template (see for details).create attachmentThe create attachment command attaches a file to an existing item.Unlike other create operations, you don’t need to use a JSON processor or encode to create an attachment. Instead, use the --file option to specify the file to attach and the --itemid option to specify the item to attach it to. For example:BashCopybw create attachment --file ./path/to/file --itemid 16b15b89-65b3-4639-ad2a-95052a6d8f66tipIf you don’t know the exact itemid you want to use, use bw get item <search-term> to return the item (see ), including its id.getThe get command retrieves a single object (item, username, password, and more) from your vault:BashCopybw get (item|username|password|uri|totp|exposed|attachment|folder|collection|organization|org-collection|template|fingerprint) <id> [options]The get command takes an item id or string for its argument. If you use a string (for example, anything other than an exact id), get will search your vault objects for one with a value that matches. For example, the following command would return a Github password:BashCopybw get password GithubnoteThe get command can only return one result, so you should use specific search terms. If multiple results are found, the CLI will return an error.get attachmentThe get attachment command downloads a file attachment:BashCopybw get attachment <filename> --itemid <id>The get attachment command takes a filename and exact id. By default, get attachment will download the attachment to the current working directory. You can use the --output option to specify a different output directory, for example:BashCopybw get attachment photo.png --itemid 99ee88d2-6046-4ea7-92c2-acac464b1412 --output /Users/myaccount/Pictures/noteWhen using --output, the path must end a forward slash (/) to specify a directory or a filename (/Users/myaccount/Pictures/photo.png).get notesThe get notes command retrieves the note for any vault item:BashCopybw get notes <id>The get notes command takes an exact item id or string. If you use a string (for example, anything other than an exact id), get notes will search your vault objects for one with a value that matches. For example, the following command would return a Github note:BashCopybw get notes Githubget templateThe get template command returns the expected JSON formatting for an object (item, item.field, item.login, and more):BashCopybw get template (item|item.field|item.login|item.login.uri|item.card|item.identity|item.securenote|folder|collection|item-collections|org-collection)While you can use get template to output the format to your screen, the most common use-case is to pipe the output into a bw create operation, using a and bw encode to manipulate the values retrieved from the template, for example:BashCopybw get template folder | jq '.name="My First Folder"' | bw encode | bw create foldernoteAny item.xxx template should be used as a sub-object to an item template, for example:BashCopybw get template item | jq ".name=\"My Login Item\" | .login=$(bw get template item.login | jq '.username="jdoe" | .password="myp@ssword123"')" | bw encode | bw create itemget fingerprintRetrieve the fingerprint phrase of a user. You may specify userId directly, or use the shortcut me to get your own fingerprint phrase:Plain TextCopybw get fingerprint <userId>Plain TextCopybw get fingerprint meeditThe edit command edits an object (item, item-collections, etc.) in your vault:BashCopybw edit (item|item-collections|folder|org-collection) <id> [encodedJson] [options]The edit command takes an exact id (the object to edit) and encoded JSON (edits to be made). A typical workflow might look something like:Use the get command (see ) to output the object to edit.Use a to manipulate the outputted object as required.Use the encode command (see ) to encode the manipulated JSON.Use the edit command (including the object id) to edit the object.For example, to edit the password of a login item:BashCopybw get item 7ac9cae8-5067-4faf-b6ab-acfd00e2c328 | jq '.login.password="newp@ssw0rd"' | bw encode | bw edit item 7ac9cae8-5067-4faf-b6ab-acfd00e2c328Or, to edit the collection(s) an item is in:BashCopyecho '["5c926f4f-de9c-449b-8d5f-aec1011c48f6"]' | bw encode | bw edit item-collections 28399a57-73a0-45a3-80f8-aec1011c48f6 --organizationid 4016326f-98b6-42ff-b9fc-ac63014988f5Or, to edit a collection:BashCopybw get org-collection ee9f9dc2-ec29-4b7f-9afb-aac8010631a1 --organizationid 4016326f-98b6-42ff-b9fc-ac63014988f5 | jq '.name="My Collection"' | bw encode | bw edit org-collection ee9f9dc2-ec29-4b7f-9afb-aac8010631a1 --organizationid 4016326f-98b6-42ff-b9fc-ac63014988f5The edit command will perform a replace operation on the object. Once completed, the updated object will be returned as JSON.listThe list command retrieves an array of objects (items, folders, collections, and more) from your vault:BashCopybw list (items|folders|collections|organizations|org-collections|org-members) [options]Options for the list command are filters used to dictate what will be returned, including --url <url>, --folderid <folderid>, --collectionid <collectionid>, --organizationid <organizationid> and --trash. Any filter will accept null or notnull. Combining multiple filters in one command will perform an OR operation, for example:BashCopybw list items --folderid null --collectionid nullThis command will return items that aren't in a folder or collection.Additionally, you can search for specific objects using --search <search-term>. Combining filter and search in one command will perform an AND operation, for example:BashCopybw list items --search github --folderid 9742101e-68b8-4a07-b5b1-9578b5f88e6fThis command will search for items with the string github in the specified folder.deleteThe delete command deletes an object from your vault. delete takes only an exact id for its argument.BashCopybw delete (item|attachment|folder|org-collection) <id> [options]By default, delete will send an item to the Trash, where it will remain for 30 days. You can permanently delete an item using the -p, --permanent option.BashCopybw delete item 7063feab-4b10-472e-b64c-785e2b870b92 --permanentTo delete an org-collection, you'll also need to specify --organizationid <organizationid>. See .warningWhile items that are deleted using delete can be recovered using the restore command for up to 30 days (see ), items that are deleted using delete --permanent are completely removed and irrecoverable.restoreThe restore command restores a deleted object from your trash. restore takes only an exact id for its argument.BashCopybw restore (item) <id> [options]For example:BashCopybw restore item 7063feab-4b10-472e-b64c-785e2b870b92sendThe send command creates a Bitwarden Send object for ephemeral sharing. This section will detail simple send operations, however send is a highly flexible tool and we recommend referring to the dedicated article on Send from CLI.To create a simple text Send:BashCopybw send -n "My First Send" -d 7 --hidden "The contents of my first text Send."To create a simple file Send:BashCopybw send -n "A Sensitive File" -d 14 -f /Users/my_account/Documents/sensitive_file.pdfreceiveThe receive command accesses a Bitwarden Send object. To receive a Send object:BashCopybw receive --password passwordforaccess https://vault.bitwarden.com/#/send/yawoill8rk6VM6zCATXv2A/9WN8wD-hzsDJjfnXLeNc2QOrganizations commandsOrganization IDsAccessing an organization from the CLI requires knowledge of an ID for your organization, as well as IDs for individual members and collections.Retrieve this information directly from the CLI using bw list, for example:BashCopybw list organizations, When you unlock your vault using bw login with email and password or bw unlock, the CLI will return both an export BW_SESSION (Bash) and env:BW_SESSION (PowerShell) command, including your session key., Bitwarden CLI allows users to lookup passwords in their preferred terminal, the BW_SESSION token allows for easy authentication, this guide will show you how to set this in one command.