> ## 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.

# Create items

To create a new item in your 1Password account and assign information to it, use the [`op item create`](/cli/reference/management-commands/item/#item-create) command.

You can [specify basic information about the item](#create-an-item) with flags and use assignment statements to [assign built-in and custom fields](#create-a-customized-item). To assign sensitive values, [use a JSON template](#with-an-item-json-template).

## Requirements

Before you can use 1Password CLI to create items, you'll need to:

* [Sign up for 1Password](https://1password.com/pricing/password-manager)
* [Install 1Password CLI](/cli/get-started/#step-1-install-1password-cli)

<Note>
  **Follow along**

  If you want to follow along with the examples in this guide, [sign in to your account](/cli/get-started/#step-3-enter-any-command-to-sign-in) then create a new vault named `Tutorial` where the example items will be saved:

  ```shell theme={null}
  op vault create Tutorial
  ```
</Note>

## Create an item

To create a new item, use [`op item create`](/cli/reference/management-commands/item/#item-create) and specify basic information about the item with flags.

For example, to create a Login item named `Netflix` in the `Tutorial` vault:

<Tabs groupId="shells">
  <Tab title="Bash, Zsh, sh, fish">
    ```shell theme={null}
    op item create \
        --category login \
        --title "Netflix" \
        --vault Tutorial \
        --url 'https://www.netflix.com/login' \
        --generate-password='letters,digits,symbols,32' \
        --tags tutorial,entertainment
    ```
  </Tab>

  <Tab title="PowerShell">
    ```powershell theme={null}
    op item create `
        --category login `
        --title "Netflix" `
        --vault Tutorial `
        --url 'https://www.netflix.com/login' `
        --generate-password='letters,digits,symbols,32' `
        --tags tutorial,entertainment
    ```
  </Tab>
</Tabs>

Here's what each of the above flags does:

<p>`--category` Sets the <a href="https://support.1password.com/item-categories/">item category</a>, in this case a Login item. Use <code>op item template list</code> to get a list of available categories. The category value is case-insensitive and ignores whitespace characters. For example, the <code>Social Security Number</code> category can also be specified as <code>socialsecuritynumber</code>.</p>

<p>`--title` Gives the item a name so that you can easily identify it. If unspecified, 1Password CLI selects a default name. For example, <code>Untitled Login item</code>.</p>

<p>`--vault` Specifies which <a href="https://support.1password.com/create-share-vaults/">vault</a> the item should be created in. If unspecified, the item will be created in your built-in <a href="https://support.1password.com/1password-glossary/#personal-vault">Personal</a>, <a href="https://support.1password.com/1password-glossary/#private-vault">Private</a>, or <a href="https://support.1password.com/1password-glossary/#employee-vault">Employee</a> vault. The name of this vault varies depending on your account type.</p>

<p>`--url` Sets the website where 1Password suggests and fills a Login, Password, or API Credential item.</p>

<p>`--generate-password` Generates a strong password for Login and Password category items. You can specify a password recipe, as shown in the example. If left unspecified, a default recipe will be used to generate a 32-character password consisting of letters, digits, and symbols.</p>

<p>`--tags` Adds <a href="https://support.1password.com/favorites-tags/">tags</a> to the item using a comma-separated list.</p>

## Create a customized item

Each item category has its own set of built-in fields that you can use to save more information to the item. You can also create custom fields to save additional details about the item.

Learn more about [built-in and custom fields](/cli/item-fields/).

You can assign built-in and custom fields to your item in two ways:

* [With assignment statements](#with-assignment-statements)
* [With an item JSON template](#with-an-item-json-template)

### With assignment statements

<Danger>
  Command arguments can be visible to other processes on your machine. If you're assigning sensitive values, use [an item JSON template](#with-an-item-json-template) instead.
</Danger>

The [`op item create`](/cli/reference/management-commands/item/#item-create) command can take a list of assignment statements as arguments to create fields on an item.

Assignment statements are formatted like this:

```shell theme={null}
[<section>.]<field>[[<fieldType>]]=<value>
```

* `section` (Optional) The name of the section where you want to create the field.
* `field` The name of the field you want to create.
* `fieldType` The type of field you want to create. If unspecified, <code>fieldType</code> will default to <code>password</code>.
* `value` The information you want to save in the field.

For built-in fields, the `field` name should match the [built-in field `id`](/cli/item-fields/#built-in-fields) in the item category template. Don't include a `fieldType` for built-in fields.

For custom fields, the `fieldType` should match the [custom field `type`](/cli/item-fields/#custom-fields) you want to create. The `field` name can be anything you want.

If you need to use periods, equal signs, or backslashes in the name of a section or field, use a backslash character to escape them. Don't use backslashes to escape the `value`.

Here's an example of an assignment statement for the built-in field `username` on a Login item, set to `john.doe&#64;acme.org`:

```shell theme={null}
'username=john.doe@acme.org'
```

And here's an example of an assignment statement for a custom field type titled `date`, which is set to `2022-12-31`, in a field named `Renewal Date` within a section titled `Subscription Info`:

```shell theme={null}
'Subscription Info.Renewal Date[date]=2022-12-31'
```

To add both of the above assignment statements to a new item, `HBO Max`, in the `Tutorial` vault:

<Tabs groupId="shells">
  <Tab title="Bash, Zsh, sh, fish">
    ```shell theme={null}
    op item create \
        --category login \
        --title "HBO Max" \
        --vault Tutorial \
        --url 'https://www.hbomax.com' \
        --generate-password='letters,digits,symbols,32' \
        --tags tutorial,entertainment \
        'username=john.doe@acme.org' \
        'Subscription Info.Renewal Date[date]=2022-12-31'
    ```
  </Tab>

  <Tab title="PowerShell">
    ```powershell theme={null}
    op item create `
        --category login `
        --title "HBO Max" `
        --vault Tutorial `
        --url 'https://www.hbomax.com' `
        --generate-password='letters,digits,symbols,32' `
        --tags tutorial,entertainment `
        'username=john.doe@acme.org' `
        'Subscription Info.Renewal Date[date]=2022-12-31'
    ```
  </Tab>
</Tabs>

### With an item JSON template

To assign sensitive values, fill out an item JSON template for the category of item you want to create. If you combine field assignment statements with a template, the assignment statements overwrite the template's values.

To see a list of available templates, run [`op item template list`](/cli/reference/management-commands/item#item-template-list). To get a template for a category, run [`op item template get <category>`](/cli/reference/management-commands/item#item-template-get).

For example, to create a new Login item using a template:

1. Get the template for a Login item and save it in your current directory:

   ```shell theme={null}
   op item template get --out-file=login.json "Login"
   ```

2. Edit [the template file](/cli/item-template-json/) to add your information.

3. Create the item using the `--template` flag to specify the path to the template file:

   ```shell theme={null}
   op item create --template=login.json
   ```

   This example template file creates a Login item named `Hulu` in a vault [specified by its ID](/cli/reference/#unique-identifiers-ids). It specifies values for built-in `username`, `password`, and `notesPlain` fields. It also adds a custom `date` field.

   <Accordion title="Example Login template">
     ```json login.json theme={null}
     {
       "title": "Hulu",
       "vault": {
         "id": "sor33rgjjcg2xykftymcmqm5am"
       },
       "category": "LOGIN",
       "fields": [
         {
           "id": "username",
           "type": "STRING",
           "purpose": "USERNAME",
           "label": "username",
           "value": "wendy.appleseed@gmail.com"
         },
         {
           "id": "password",
           "type": "CONCEALED",
           "purpose": "PASSWORD",
           "label": "password",
           "password_details": {
             "strength": ""
           },
           "value": "Dp2WxXfwN7VFJojENfEHLEBJmAGAxup@"
         },
         {
           "id": "notesPlain",
           "type": "STRING",
           "purpose": "NOTES",
           "label": "notesPlain",
           "value": "This is Wendy's Hulu account."
         },
         {
           "id": "date",
           "type": "date",
           "label": "Subscription renewal date",
           "value": "2023-04-05"
         }
       ]
     }
     ```
   </Accordion>

4. Delete the edited template file from your computer.

You can also create an item from standard input using a template:

```shell theme={null}
op item template get Login | op item create --vault Tutorial -
```

## Create an item from an existing item

You can create a new item from an existing item by piping the item JSON from standard input.

For example, to create a new item based on the `HBO Max` item you created in the assignment statement section, with a new title, username, and password:

```shell theme={null}
op item get "HBO Max" --format json | op item create --vault Tutorial --title "Wendy's HBO Max" - 'username=wendy.appleseed@acme.org' 'password=Dp2WxXfwN7VFJojENfEHLEBJmAGAxup@'
```

## Add a one-time password to an item

You can attach a [one-time password](https://support.1password.com/one-time-passwords/) to an item using a custom field [assignment statement](#with-assignment-statements). The `fieldType` should be `otp` and the `value` should be the [otpauth:// URI](https://github.com/google/google-authenticator/wiki/Key-Uri-Format) for the one-time password.

<Tabs>
  <Tab title="Bash, Zsh, sh, fish">
    ```shell theme={null}
    op item create \
        --category login \
        --title='My OTP Example' \
        --vault Tutorial \
        --url 'https://www.acme.com/login' \
        --generate-password='letters,digits,symbols,32' \
        --tags tutorial,entertainment \
        'Test Section 1.Test Field3[otp]=otpauth://totp/<website>:<user>?secret=<secret>&issuer=<issuer>'
    ```
  </Tab>

  <Tab title="PowerShell">
    ```powershell theme={null}
    op item create `
        --category login `
        --title='My OTP Example' `
        --vault Tutorial `
        --url 'https://www.acme.com/login' `
        --generate-password='letters,digits,symbols,32' `
        --tags tutorial,entertainment `
        'Test Section 1.Test Field3[otp]=otpauth://totp/<website>:<user>?secret=<secret>&issuer=<issuer>'
    ```
  </Tab>
</Tabs>

## Attach a file to an item

You can attach a file to an item using a custom field [assignment statement](#with-assignment-statements). The `field` should be the name the file will have in 1Password, the `fieldType` should be `file`, and the `value` should be the path to the file.

Include the file extension in the field name by [escaping the period with a backslash](#with-assignment-statements). This keeps the extension visible in 1Password instead of stripping it from the name.

```shell theme={null}
JanuaryReceipt\.png[file]=/path/to/your/receipt.png
```

The file in the above example will be named `JanuaryReceipt.png`. To preserve the original file name from the path, you can omit the `field`:

```shell theme={null}
[file]=/path/to/your/file
```

Here's what an example `PlayStation Store` login would look like with the file `/wendyappleseed/documents/receipt.png` attached, named `JanuaryReceipt.png`.

<Tabs>
  <Tab title="Bash, Zsh, sh, fish">
    ```shell theme={null}
    op item create \
        --category login \
        --title "PlayStation Store" \
        --vault Tutorial \
        --url 'https://store.playstation.com/' \
        --generate-password='letters,digits,symbols,32' \
        --tags tutorial,entertainment \
        'JanuaryReceipt\.png[file]=/wendyappleseed/documents/receipt.png'
    ```
  </Tab>

  <Tab title="PowerShell">
    ```powershell theme={null}
    op item create `
        --category login `
        --title "PlayStation Store" `
        --vault Tutorial `
        --url 'https://store.playstation.com/' `
        --generate-password='letters,digits,symbols,32' `
        --tags tutorial,entertainment `
        'JanuaryReceipt\.png[file]=/wendyappleseed/documents/receipt.png'
    ```
  </Tab>
</Tabs>

## Next steps

If you want to continue learning about item management, keep the example items you created and move on to the [edit items](/cli/item-edit) tutorial.

If you created a Tutorial vault and don't want to continue on, you can delete the vault and the examples items you created by running:

```shell theme={null}
op vault delete "Tutorial"
```

## Learn more

* [`op item create` reference documentation](/cli/reference/management-commands/item#item-create)
* [Built-in and custom item fields](/cli/item-fields)
* [Item JSON template](/cli/item-template-json)
* [Workflow: Build integrations with 1Password](/get-started/build-integrations)
