# itemコマンド

[**サブコマンド**](https://developer.1password.com/docs/cli/reference/management-commands/item/#subcommands)

* item create: アイテムをCreateする
* item delete: アイテムを削除またはアーカイブする
* item edit: アイテムの詳細を編集する
* item get : アイテムの詳細を取得する
* item list: アイテムをリストする
* item move: 保管庫間でアイテムを移動する
* item share: アイテムを共有する
* item template: テンプレートの管理

### **item create** <a href="#eyh16t3296fh" id="eyh16t3296fh"></a>

新しいアイテムをCreateします。

op item create \[ - ] \[ \<assignment>... ] \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#id-5y30vkssqdh2" id="id-5y30vkssqdh2"></a>

\--category category Set the item's category.

\--dry-run Test the command and output a preview of the resulting item.

\--favorite Add item to favorites.

\--generate-password\[=recipe] Add a randomly-generated password to a Login or Password item.

\--reveal Don't conceal sensitive fields.

\--ssh-generate-key The type of SSH key to create: Ed25519 or RSA. For RSA,

specify 2048, 3072, or 4096 (default) bits. Possible values:

ed25519, rsa, rsa2048, rsa3072, rsa4096. (default Ed25519)

\--tags tags Set the tags to the specified (comma-separated)

values.

\--template string Specify the filepath to read an item template from.

\--title title Set the item's title.

\--url URL Set the URL associated with the item.

\--vault vault Save the item in this vault. Default: Private.

全てのアイテム カテゴリのリストを取得します。

$ op item template list

割り当てステートメントまたはアイテム カテゴリ JSON テンプレートを使用して、組み込みフィールドまたはカスタム フィールドに詳細をSaveします。

[アイテムのCreateについて詳しく紹介します。](https://developer.1password.com/docs/cli/item-create/)

[アイテム フィールドとフィールド タイプの詳細について説明します。](https://developer.1password.com/docs/cli/item-fields/)

**Generate a password**

ログインまたはパスワード項目にランダムなパスワードを設定するには、オプションを使用します--generate-password。デフォルトは 32 文字で、大文字と小文字、数字、記号 ( !@.-\_\*) が含まれます。

パスワードの長さ (1 ～ 64 文字) と使う文字の種類を指定できます。

$ --generate-password='letters,digits,symbols,32'

**Set additional fields with assignment statements**

組み込みフィールドとカスタム フィールドを設定するには、代入ステートメントをコマンド引数として使用できます。

\[\<section>.]\<field>\[\[\<fieldType>]]=\<value>

コマンド引数はコマンド履歴に記録され、マシン上の他のプロセスから参照できます。機密値を割り当てる場合は、代わりに JSON テンプレートを使用してください。

例えば、「データベース資格情報」というセクション内に「host」というテキスト フィールドをCreateし、値を 33.166.240.221 に設定するには、次のようにします。

$ --generate-password='letters,digits,symbols,32'

複数のセクションに同じ名前のフィールドが含まれていない限り、セクション名はオプションです。

セクション名またはフィールド名内のピリオド、等号、またはバックスラッシュをエスケープするには、バックスラッシュを使用します。値をエスケープするためにバックスラッシュを使用しないでください。

セクション名またはフィールド名のスペースを省略したり、JSON 短縮名 (nameまたはn)でフィールドを参照したりできます。

**Create an item using a json template**

アイテム JSON テンプレートを使用して、アイテムに機密値を割り当てます。テンプレートと割り当てステートメントを組み合わせた場合、割り当てステートメントが優先されます。

* ①適切なアイテム カテゴリ テンプレートをファイルにSaveします。
* $ op item template get --out-file login.json "Login"
* ②テンプレートを編集します。
* ③編集したテンプレートへのパスを指定する——templateフラグを使用して新しいアイテムをCreateします。
* $ op item create --template=login.json
* ④1Password CLI がアイテムをCreateしたら、編集したテンプレートを削除します。\
  アイテム JSON テンプレートを使用して、標準入力からアイテムをCreateすることもできます。\
  文字を最初の引数として渡し-、その後に代入ステートメントを続けます。
* $ op item template get Login | op item create --vault personal -
* 衝突を避けるため、同じコマンドでパイプと--templateフラグの両方を使うことはできません。

#### [**例**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-examples) <a href="#cbvbo8guajpp" id="cbvbo8guajpp"></a>

フラグと、割り当てステートメントで設定されたカスタム フィールドと組み込みフィールド (ワンタイム パスワード フィールドとファイル添付を含む) を使用して、ランダム パスワードと Web サイトが設定されたログイン項目をCreateします。

$ op item create --category=login --title='My Example Item' --vault='Test' \\

\--url <https://www.acme.com/login> \\

\--generate-password=20,letters,digits \\

username\[username]=<jane@acme.com> \\

'Test Section 1.Test Field3\[otp]=otpauth://totp/\<website>:\<user>?secret=\<secret>\&issuer=\<issuer>' \\

'FileName\[file]=/path/to/your/file'

別の保管庫から保存済みのアイテムを複製し、割り当てステートメントを使用して変更することでアイテムをCreateします。

$ op item get "My Item" --format json | op item create --vault prod - \\

username="My Username" password="My Password"

あるアカウントの Vault 内の全てのアイテムを別のアカウントの Vault に複製します。

$ op item list --vault test-vault --format json --account agilebits | \\

$ op item get --format json --account agilebits - | \\

$ op item create --account work -

### **item delete** <a href="#id-65sxj8mchdbj" id="id-65sxj8mchdbj"></a>

アイテムを完全に削除します。

op item delete \[{ \<itemName> | \<itemID> | \<shareLink> | - }] \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#gjdqumgtes0r" id="gjdqumgtes0r"></a>

\--archive Move the item to the Archive.

\--vault string Look for the item in this vault.

代わりに--archiveオプションを使用してアーカイブに移動します。

アイテムは、名前、ID、または共有リンクで指定できます。

**Specify items on standard input**

このコマンドは、標準入力 (stdin) 上の各情報行をオブジェクト指定子として扱います。オブジェクトの指定方法の詳細については、op helpを実行してください。

入力は、JSON オブジェクトのリストまたは配列にすることもできます。このコマンドは、ID を持つオブジェクトの項目を取得します。これは、あるopコマンドから別のコマンドに情報を渡す場合に便利です。

#### [**例**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-delete-examples) <a href="#ghbf4gz97afh" id="ghbf4gz97afh"></a>

アイテムを完全に削除します:

op item delete "Defunct Login"

アイテムをアーカイブに移動する:

op item delete "Defunct Login" --archive

### **item edit** <a href="#xgql9wbkitny" id="xgql9wbkitny"></a>

アイテムの詳細を編集します。

op item edit { \<itemName> | \<itemID> | \<shareLink> } \[ \<assignment> ... ] \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#id-4eojlin3v50l" id="id-4eojlin3v50l"></a>

\--dry-run Perform a dry run of the command and output a preview

of the resulting item.

\--favorite Whether this item is a favorite item. Options: true, false.

\--generate-password\[=recipe] Give the item a randomly generated password.

\--reveal Don't conceal sensitive fields.

\--tags tags Set the tags to the specified (comma-separated)

values. An empty value will remove all tags.

\--template string Specify the filepath to read an item template from.

\--title title Set the item's title.

\--url URL Set the URL associated with the item.

\--vault vault Edit the item in this vault.

アイテムを名前、ID、または共有リンクで指定します。フラグを使用してタイトルやタグを更新したり、新しいランダム パスワードを生Createしたりします。

組み込みフィールドまたはカスタム フィールドを更新するために、代入ステートメントをコマンド引数として使用できます。機密値の場合は、代わりにテンプレートを使用します。

**Edit an item using assignment statements**

注意: コマンド引数は、マシン上の他のプロセスから見える場合があります。

$ \[\<section>.]\<field>\[\[\<fieldType>]]=\<value>

新しいフィールドまたはセクションをCreateするには、アイテムにまだ存在しないフィールドまたはセクションの名前を指定します。

保存済みのフィールドを編集するには、現在のセクションとフィールド名を指定し、fieldType または値を変更します。 fieldType または値を指定しない場合、値は変わりません。

カスタムフィールドを削除するには、fieldType の代わりに \[delete] を指定します。セクションにフィールドがなくなった場合、そのセクションも削除されます。組み込みフィールドは削除できませんが、空の文字列に設定することはできます。代入ステートメントの詳細については、op item create –-help を参照してください。

[利用可能なフィールドとフィールド タイプの詳細をご覧ください。](https://developer.1password.com/docs/cli/item-fields)

**Edit an item using a template**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#edit-an-item-using-a-template)

JSON テンプレートを単独で、またはコマンド引数と組み合わせて使用​​して、項目を編集できます。フィールド割り当てステートメントは、テンプレート内の値を上書きします。

* 1\. 編集したい項目を JSON 形式で取得し、ファイルにSaveします。
* op item get oldLogin --format=json > updatedLogin.json
* 2\. ファイルを編集します。
* 3\. フラグを使用して--template編集したファイルへのパスを指定し、項目を編集します。\
  op 項目の編集 oldLogin --template=updatedLogin.json
* 4\. ファイルを削除します。\
  パイプ入力を使用してアイテムを編集することもできます。
* $ cat updatedLogin.json | op item edit oldLogin

衝突を避けるため、パイプ入力と--template フラグを同じコマンド内で組み合わせることはできません。

#### [**例**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-edit-examples) <a href="#s5251bganc4l" id="s5251bganc4l"></a>

大文字、小文字、数字、記号を含む 32 文字のランダムなパスワードをアイテムに追加します。

$ op item edit 'My Example Item' --generate-password='letters,digits,symbols,32'

フィールドタイプを変更せずにカスタムフィールドの値を編集します。

op item edit 'My Example Item' 'field1=new value'

値を変更せずにカスタム フィールドの fieldType を編集します。

op item edit 'My Example Item' 'field1\[password]'

カスタム フィールドのタイプと値を編集します。

op item edit 'My Example Item' 'field1\[monthyear]=2021/09'

アイテムに新しいカスタム フィールドを追加します。

op item edit 'My Example Item' 'section2.field5\[phone]=1-234-567-8910'

保存済みのカスタム フィールドを削除します。

op item edit 'My Example Item' 'section2.field5\[delete]'

組み込みのユーザー名フィールドを空の値に設定します。

op item edit 'My Example Item' 'username='

コマンド引数および代入ステートメントとともにテンプレートを使用して項目を編集します。

$ op item edit oldLogin --vault Private 'username=Lucky' --template=updatedLogin.json

### **item get** <a href="#fjhoysli0yvv" id="fjhoysli0yvv"></a>

アイテムの詳細を取得します。アイテムの名前、ID、または共有リンクでアイテムを指定します。

op item get \[{ \<itemName> | \<itemID> | \<shareLink> | - }] \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#id-6rgogaa6pmg7" id="id-6rgogaa6pmg7"></a>

\--fields strings Return data from specific fields. Use \`label=\` to get the field by name or \`type=\` to filter fields by type. Specify multiple in a comma-separated list.

\--include-archive Include items in the Archive. Can also be set using

OP\_INCLUDE\_ARCHIVE environment variable.

\--otp Output the primary one-time password for this item.

\--reveal Don't conceal sensitive fields.

\--share-link Get a shareable link for the item.

\--vault vault Look for the item in this vault.

同じ名前のアイテムが複数ある場合、または API レート制限が懸念される場合は、アイテムを ID で指定するか、フラグを使用して検索範囲を制限します--vault。

[ID とキャッシュについて詳しく紹介します。](https://developer.1password.com/docs/cli/reference)

特定のフィールドの内容を取得するには、代わりに op read を使用します。サービス アカウントを使う場合は、 --vault フラグを使うか、パイプ入力を通じてコン​​テナーを指定する必要があります。

**Specify items on standard input**

op item getは、標準入力 (stdin) 上の各情報行をオブジェクト指定子として扱います。

JSON オブジェクトのリストまたは配列を入力することもできます。コマンドは、ID キーを持つオブジェクトの項目を取得します。これは、あるコマンドから別のコマンドに情報を渡す場合に便利です。

**Items in the archive**

アーカイブ内のアイテムはデフォルトでは無視されます。アーカイブ内のアイテムの詳細を取得するには、アイテムを ID で指定するか、 --include-archiveオプションを使用します。

#### [**例**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-get-examples) <a href="#hr48gwb6adko" id="hr48gwb6adko"></a>

指定されたタグを持つ全てのアイテムの詳細を取得します。

op item list --tags documentation --format json | op item get -

保管庫内の全てのログインのユーザー名とパスワードの CSV リストを取得します。

op item list --categories Login --vault Staging --format json | op item get - --fields label=username,label=password

アイテムのユーザー名とパスワード フィールドの JSON オブジェクトを取得します。

op item get Netflix --fields label=username,label=password --format json

タイプ別にフィールドのリストを取得します。

op item get Netflix --fields type=concealed

アイテムのワンタイムパスワードを取得します:

op item get Google --otp

ID で参照されるアイテムの共有可能なリンクを取得します。

op item get kiramv6tpjijkuci7fig4lndta --vault "Ops Secrets" --share-link

### **item list** <a href="#y3nb4yjgjr2i" id="y3nb4yjgjr2i"></a>

項目をリストします。

op item list \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#id-9b6eg7pzumdk" id="id-9b6eg7pzumdk"></a>

\--categories categories Only list items in these categories (comma-separated).

\--favorite Only list favorite items.

\--include-archive Include items in the Archive. Can also be set using

OP\_INCLUDE\_ARCHIVE environment variable.

\--tags tags Only list items with these tags (comma-separated).

\--vault vault Only list items in this vault.

デフォルトでアカウントが読み取りアクセス権を持つ全てのアイテムのリストを返します。結果をフィルタリングするにはフラグを使用します。デフォルトではアーカイブ内のアイテムは除外されます。

カテゴリーは次のとおりです:

* API Credential
* Bank Account
* Credit Card
* Database
* Document
* Driver License
* Email Account
* Identity
* Login
* Membership
* Outdoor License
* Passport
* Password
* Reward Program
* Secure Note
* Server
* Social Security Number
* Software License
* Wireless Router

#### [**例**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-list-examples) <a href="#w4pgo5cna58" id="w4pgo5cna58"></a>

指定されたタグを持つ全てのアイテムの詳細を取得します。

op item list --tags documentation --format=json | op item get -

保管庫内の全てのログインのユーザー名とパスワードの CSV リストを取得します。

op item list --categories Login --vault Staging --format=json | op item get - --fields username,password

タグを選択すると、\<tag>にサブネストされたタグを持つアイテムも返されます\<tag>。例: \<tag/subtag>。

### **item move** <a href="#hljj85tdobfo" id="hljj85tdobfo"></a>

アイテムを保管庫間で移動します。

アイテムを移動すると、移動先の保管庫にアイテムのコピーがCreateされ、現在の保管庫からアイテムが削除されます。その結果、アイテムには新しい ID が付与されます。

op item move \[{ \<itemName> | \<itemID> | \<shareLink> | - }] \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#gouywaixkayr" id="gouywaixkayr"></a>

\--current-vault string Vault where the item is currently saved.

\--destination-vault string The vault you want to move the item to.

\--reveal Don't conceal sensitive fields.

元のアイテムを復元または完全に削除するには、1Password アプリまたは 1Password.com の「最近削除した項目」でアイテムを見つけます。

アイテムを保管庫間で移動すると、そのアイテムにアクセスできるユーザーが変わる場合があります。

#### [**例**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-move-examples) <a href="#z5j5z6i12yqw" id="z5j5z6i12yqw"></a>

プライベート 保管庫から共有保管庫にアイテムを移動します。

op item move "My Example Item" --current-vault Private --destination-vault Shared

### **item share** <a href="#y3u0q966feet" id="y3u0q966feet"></a>

アイテムを共有します。

op item share { \<itemName> | \<itemID> } \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#wo75y95okmv" id="wo75y95okmv"></a>

#### &#x20;<a href="#id-46z4w1sihxyf" id="id-46z4w1sihxyf"></a>

\--emails strings Email addresses to share with.

\--expires-in duration Expire link after the duration specified in (s)econds,

(m)inutes, (h)ours, (d)ays, and/or (w)eeks. (default 7d)

\--vault string Look for the item in this vault.

\--view-once Expire link after a single view.

1Password を使用していない人でも、1PasswordにSaveしたパスワードやその他の項目のコピーを安全に共有できます。

アイテムを共有すると、他のユーザーに送信できる固有のリンクが取得されます。

URL をコピーし、メールやテキスト メッセージなどで、アイテムのコピーを共有したい相手にリンクを送信します。メール フラグでアドレスを指定しない限り、リンクを知っている人なら誰でもアイテムのコピーを表示できます。

アイテムを編集した場合、そのアイテムを再度共有するまで変更内容は共有されません。添付ファイルとドキュメント アイテムは共有できないことに注意してください。

### **item template** <a href="#rdc69adbmnvf" id="rdc69adbmnvf"></a>

#### [**サブコマンド**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-template-subcommands) <a href="#hs8qu25q858w" id="hs8qu25q858w"></a>

* [item template get](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-template-get): アイテムテンプレートを取得する
* [item template list](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-template-list): テンプレートのリストを取得します

### **item template get**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-template-get) <a href="#id-5vp5vwidyqux" id="id-5vp5vwidyqux"></a>

アイテム タイプのテンプレートを返します。

op item template get \[{ \<category> | - }] \[flags]

#### **Flags**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-create-flags) <a href="#jrf6jim0v9m3" id="jrf6jim0v9m3"></a>

#### --file-mode filemode Set filemode for the output file. It is ignored without the --out-file flag. (default 0600) <a href="#fy08l4a650ca" id="fy08l4a650ca"></a>

#### -f, --force Do not prompt for confirmation. <a href="#fy08l4a650ca" id="fy08l4a650ca"></a>

#### -o, --out-file string Write the template to a file instead of stdout. <a href="#avw8p59oz2el" id="avw8p59oz2el"></a>

#### &#x20;<a href="#fy08l4a650ca" id="fy08l4a650ca"></a>

テンプレートを使用して新しいアイテムをCreateできます。詳細についてはop item create --help実行してください。

カテゴリーは次のとおりです:

* API Credential
* Bank Account
* Credit Card
* Database
* Document
* Driver License
* Email Account
* Identity
* Login
* Membership
* Outdoor License
* Passport
* Password
* Reward Program
* Secure Note
* Server
* Social Security Number
* Software License
* Wireless Router

### **item template list**[**​**](https://developer.1password.com/docs/cli/reference/management-commands/item/#item-template-list) <a href="#ns4zqpprw8js" id="ns4zqpprw8js"></a>

使用可能なアイテム タイプ テンプレートを一覧表示します。

op item template list \[flags]

テンプレートを取得するためにop item template get \<category>使用します。
