> ## Documentation Index
> Fetch the complete documentation index at: https://www.1password.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Use 1Password CLI 1

<head>
  <meta name="robots" content="noindex,nofollow" />
</head>

<Warning>
  **Upgrade to 1Password CLI 2**

  1Password CLI 1 is deprecated as of **October 1, 2024**. Scripts and integrations that use version 1 will no longer work as expected. [Upgrade to 1Password CLI 2](/cli/upgrade/) to maintain uninterrupted access and compatibility with the latest features.
</Warning>

## Sign in or out

To sign in to an account and get a session token:

```shell theme={null}
op signin <sign_in_address> <email_address> <secret_key> [--raw]
```

After you sign in the first time, you can sign in again using only the shorthand for your account:

```shell theme={null}
op signin <shorthand> [--raw]
```

By default, the shorthand is your account's subdomain. You can change it the first time you sign in by using the `--shorthand` option.

Hyphens (-) in a subdomain will be changed to an underscore (\_).

See also [*Appendix: Session management*](#appendix-session-management).

### Sign out

Sessions automatically expire after 30 minutes of inactivity. You can sign out manually using the `signout` command:

```shell theme={null}
op signout
```

See also [*Appendix: Session management*](#appendix-session-management).

## List objects

To list objects in a 1Password account:

```shell theme={null}
op list (users | groups | vaults | items | documents | templates) [--vault <vault> | --group <group>]
```

To list users or groups with access to a vault:

```shell theme={null}
op list (users | groups) --vault <vault>
```

To list users in a group:

```shell theme={null}
op list users --group <group>
```

To list items in a vault:

```shell theme={null}
op list items --vault <vault>
```

To include items or documents in the Archive:

```shell theme={null}
op list (items | documents) [--vault <vault>] --include-archive
```

## List Activity Log events

<Note>
  **1Password Business**

  The Activity Log is only available for 1Password Business accounts.
</Note>

To list events from the [Activity Log](https://support.1password.com/activity-log):

```shell theme={null}
op list events [--eventid <event_ID>] [--older]
```

The 100 most recent events will be listed.

### List events after a specific log entry

You can provide an event ID (`eid`) as a starting point for listing entries by using the `--eventid` option. A maximum of 100 events will be returned, starting after, but not including, the provided event.

```shell theme={null}
op list events --eventid 319458129
```

### List events before a specific log entry

The `--older` option can be used with the `--eventid` option to list entries that occurred before the provided event ID.

```shell theme={null}
op list events --older --eventid 319179570
```

A maximum of 100 events will be returned, starting with the event before, not including, the provided event.

## Manage objects

### Get details

To get details about an object:

```shell theme={null}
op get (account | group | vault | item | totp) [<item>] [--vault <vault>] [--include-archive]
```

The `--include-archive` option will allow for items in the Archive to be returned.

To get the UUID of an object, look it up by name, email address, or domain. See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

### Get details of an item

By default, `op get item` gets details of all fields. You can get details of just the fields you want instead. For one field, 1Password CLI returns a simple string:

```shell theme={null}
op get item nqikpd2bdjae3lmizdajy2rf6e --fields password
5ra3jOwnUsXVjx5GL@FX2d7iZClrrQDc
```

For multiple fields, specify them in a comma-separated list. 1Password CLI returns a JSON object:

```shell theme={null}
op get item nqikpd2bdjae3lmizdajy2rf6e --fields username,password
{"username": "wendy_appleseed", "password": "5ra3jOwnUsXVjx5GL@FX2d7iZClrrQDc"}
```

You can change the output to CSV or to always use JSON with the `--format` option.

### Create or edit an item

To create an item:

```shell theme={null}
op create item <category> [<assignment> ...]
```

<Note>
  If you can't trust other users or processes on your system, use `op create item <category> --template=file.json` instead.
</Note>

To edit an item:

```shell theme={null}
op edit item <item> <assignment> [<assignment> ...]
```

Assignment statements follow this syntax:

```
[<section>.]<field>=<value>
```

You can omit spaces when you specify the section or field name. You can also refer to a field by its JSON short name (`name` or `n`).

```
issuingcountry=Canada
```

The section is optional unless multiple sections have a field with the same name.

```
testingserver.address=db.local.1password.com
developmentserver.address=db.dev.1password.com
```

You can't make a new custom section using an assignment statement.

You can generate a password for the item with the `--generate-password` option. By default, it will create a 32-character password made up of letters, numbers, and symbols.

See also [*Appendix: Categories*](#appendix-categories) for a list of categories.

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

When you create an item, its UUID is returned.

### Delete an item

To delete an item:

```shell theme={null}
op delete item <item> [--vault <vault>]
```

Use the `--archive` option to move it to the Archive instead.

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

### Create or remove a vault

To create a vault:

```shell theme={null}
op create vault <name> [--allow-admins-to-manage <true|false>] [--description <description>]
```

When you create a vault, its UUID is returned. Use the `--allow-admins-to-manage` option to specify whether administrators can manage access to the vault or not. If not provided, the default policy for the account applies.

To remove a vault:

```shell theme={null}
op delete vault <vault>
```

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

### Work with documents

To create a document:

```shell theme={null}
op create document <file_name> [--title <title>] [--vault <vault>] [--tags <tags>]
```

When you create a document, its UUID is returned.

To download a document and save it to a file:

```shell theme={null}
op get document <document> [--vault <vault>] [--output <file_path>]
```

The document's contents are sent to standard output (`stdout`) by default. Use the `--output` option to save the document to a file directly. It won't overwrite an existing file unless it's empty.

To delete a document:

```shell theme={null}
op delete document <document> [--vault <vault>]
```

Use the `--archive` option to move it to the Archive instead.

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

## Manage users and groups

### Invite and confirm users

To create and invite a new user:

```shell theme={null}
op create user <email_address> <name>
```

Users are invited by email and then must be confirmed using their email address or UUID:

```shell theme={null}
op confirm [<user> | --all]
```

The `--all` option confirms all users pending confirmation.

### Get user details

To get details about a user:

```shell theme={null}
op get user <user> [--publickey | --fingerprint]
```

If the `--publickey` or `--fingerprint` options are used, only the user’s public key or public key fingerprint is returned.

### Edit users and groups

To edit a user's name:

```shell theme={null}
op edit user <user> [--name <name>]
```

To turn Travel Mode on or off for a user:

```shell theme={null}
op edit user <user> --travelmode <on | off>
```

To edit the name or description of a group:

```shell theme={null}
op edit group <group> [--name <name>] [--description <description>]
```

### Suspend or reactivate a user

To suspend or reactivate a user:

```shell theme={null}
op (suspend | reactivate) <user>
```

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

### Remove a user

To completely remove a user:

```shell theme={null}
op delete user <user>
```

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

### Manage individual access

To grant a user access to a vault or group:

```shell theme={null}
op add user <user> [<vault> | <group>]
```

To revoke a user's access to a vault or group:

```shell theme={null}
op remove user <user> [<vault> | <group>]
```

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

### Manage group access

To grant a group access to a vault:

```shell theme={null}
op add group <vault>
```

To revoke a group's access to a vault:

```shell theme={null}
op remove group <vault>
```

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

### Create or remove a group

To create a group:

```shell theme={null}
op create group <name>
```

When you create a group, its UUID is returned.

To remove a group:

```shell theme={null}
op delete group <group>
```

See also [*Appendix: Specifying objects*](#appendix-specifying-objects).

## Appendix: Checking for updates

To check for updates to 1Password CLI:

```shell theme={null}
op update
```

If a newer version is available, 1Password CLI can download it for you. To change the download folder, use the `--directory` option.

## Appendix: Specifying objects

Every object can be specified by UUID or name. Users and items can also be specified by email address and domain, respectively.

| Object | UUID | Name | Email<br />address | Domain |
| - | - | - | - | - |
| Group | ✅ | ✅ | — | — |
| User | ✅ | ✅ | ✅ | — |
| Vault | ✅ | ✅ | — | — |
| Item | ✅ | ✅ | — | ✅ |
| Document | ✅ | ✅ | — | — |

When specifying by UUID, the item or its details will be returned, even if the item is in the Archive. You don’t need to specify `--include-archive`.

## Appendix: Categories

<CardGroup cols={2}>
  <div>
    * API Credential
    * Bank Account
    * Credit Card
    * Database
    * Document
    * Driver License
    * Email Account
    * Identity
    * Login
    * Membership
  </div>

  <div>
    * Outdoor License
    * Passport
    * Password
    * Reward Program
    * Secure Note
    * Server
    * Social Security Number
    * Software License
    * Wireless Router
  </div>
</CardGroup>

## Appendix: Session management

`op signin` will prompt you for your 1Password account password and output a command that can save your session token to an environment variable:

```shell theme={null}
op signin <shorthand>
export OP_SESSION_<shorthand>="EXAMPLEeSHByBqEXAMPLEfdMVLLdEXAMPLEUrNMuRXQ"
```

To set the environment variable, run the `export` command manually, or use `eval` (Mac, Linux) or `Invoke-Expression` (Windows) to set it automatically.

On Mac and Linux:

```shell theme={null}
eval $(op signin <shorthand>)
```

On Windows:

```shell theme={null}
Invoke-Expression $(op signin <shorthand>)
```

You can sign in to multiple accounts at the same time.

### Use with multiple accounts

Commands that you run will use the account you signed in to most recently. To run a command using a specific account, use `--account <shorthand>`:

```shell theme={null}
op list items --account <shorthand>
```

To authenticate with a session token, sign in with the `--raw` option to get the token. Then use `--session <session_token>` with any command:

```shell theme={null}
op signin <shorthand> --raw
```

```shell theme={null}
op list items --session <session_token>
```

### Remove account details from your computer

You can remove account details from your computer at any time.

To sign out of an account and remove its details from your computer:

```shell theme={null}
op signout --forget
```

If you're already signed out, you can specify an account by its shorthand:

```shell theme={null}
op forget <shorthand>
```

## Learn more

* [1Password CLI 1: Reference](./reference)


## Related topics

- [1Password CLI](/cli.md)
- [Use 1Password CLI with Connect](/cli/connect.md)
- [Upgrade to 1Password CLI 2](/cli/upgrade.md)
