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

# Item JSON template

1Password CLI supports item JSON templates that you can use to take control of how you create items in 1Password. Item JSON templates allow you to [create an item with all of its details specified](/cli/item-create/#with-an-item-json-template), including custom sections and fields.

Item templates are formatted similarly to the JSON output for [`op item get`](/cli/reference/management-commands/item/#item-get), so you can easily create new items based on existing items.

Each item category has its own template. You can get a list of all item categories with [`op item template list`](/cli/reference/management-commands/item/#item-template-list). And you can retrieve the template for an item category with [`op item template get <category>`](/cli/reference/management-commands/item/#item-template-get).

## Item template keys

Item JSON templates have common language keys that allow you to identify how the fields in the template correspond to the item in 1Password.

```json theme={null}
{
  "title": " ",
  "category": " ",
  "sections": [
    {
      "id": " ",
      "label": " "
    },
  ],
  "fields": [
    {
      "id": " ",
      "section": {
        "id": " "
      },
      "type": " ",
      "label": " ",
      "value": " "
    }
  ]
}
```

**Item**

| Name       | Description                                  |
| ---------- | -------------------------------------------- |
| `title`    | The name of the item displayed in 1Password. |
| `category` | The item's category.                         |

**Section**

| Name    | Description                                                                                |
| ------- | ------------------------------------------------------------------------------------------ |
| `id`    | The identifier for the section. If the item has multiple sections, each ID must be unique. |
| `label` | The name of the section displayed in 1Password.                                            |

To add a custom section, insert a section JSON object into the `sections` array.

<Accordion title="View a section JSON object">
  ```json theme={null}
      {
        "id": " ",
        "label": " "
      }
  ```
</Accordion>

**Field**

| Name         | Description                                                                                                   |
| ------------ | ------------------------------------------------------------------------------------------------------------- |
| `id`         | The field's ID. Each ID should be unique. If left empty, 1Password will generate a random ID.                 |
| `section id` | The ID of the section where the field is located. Only required if located in a custom section.               |
| `type`       | The field's type. [Learn more about custom field types.](/cli/item-fields/#custom-fields)                     |
| `label`      | The name of the field displayed in 1Password.                                                                 |
| `value`      | The information saved in the field. Depending on its type, it can be a string, a secret, a number, or a date. |

To add a custom field to the template, insert a new field JSON object into the `fields` array.

<Accordion title="View a field JSON object">
  ```json theme={null}
      {
        "id": " ",
        "section": {
          "id": " "
        },
        "type": " ",
        "label": " ",
        "value": " "
      }
  ```
</Accordion>

## Example JSON representation

This is an item `mysql` in the 1Password app, and the same item represented in an item JSON template.

<Tabs groupId="example-json">
  <Tab title="In the app">
    <div style={{textAlign: 'center'}}>
      <Frame>
        <img alt="MySQL item in 1Password" width="400" src="https://mintcdn.com/ab-634991b8/pfc4yDcmGyZA8XDs/static/img/cli/mysql-item.png?fit=max&auto=format&n=pfc4yDcmGyZA8XDs&q=85&s=9b26f9b25150e46eda39454eb355ba38" data-path="static/img/cli/mysql-item.png" />
      </Frame>
    </div>
  </Tab>

  <Tab title="In the JSON template">
    ```json theme={null}
    {
      "id": "4l3udxihvvuhszh2kxyjbblxl4",
      "title": "mysql",
      "version": 3,
      "vault": {
        "id": "uteieiwkhgv6hau7xkorejyvru"
      },
      "category": "DATABASE",
      "last_edited_by": "IU2OKUBKAFGQPFPFZEG7X3NQ4U",
      "created_at": "2021-11-25T14:50:14Z",
      "updated_at": "2022-02-25T18:12:12Z",
      "sections": [
        {
          "id": "g52gfotnw7nhnkgq477si2hmmi",
          "label": "Database Owner"
        }
      ],
      "fields": [
        {
          "id": "notesPlain",
          "type": "STRING",
          "purpose": "NOTES",
          "label": "notesPlain"
        },
        {
          "id": "database_type",
          "type": "MENU",
          "label": "type",
          "value": "mysql"
        },
        {
          "id": "hostname",
          "type": "STRING",
          "label": "server",
          "value": "http://localhost"
        },
        {
          "id": "port",
          "type": "STRING",
          "label": "port",
          "value": "5432"
        },
        {
          "id": "database",
          "type": "STRING",
          "label": "database",
          "value": "app-database"
        },
        {
          "id": "username",
          "type": "STRING",
          "label": "username",
          "value": "mysql-user"
        },
        {
          "id": "password",
          "type": "CONCEALED",
          "label": "password",
          "value": "T4Kn7np2bLJXAFoYPoVC"
        },
        {
          "id": "sid",
          "type": "STRING",
          "label": "SID"
        },
        {
          "id": "alias",
          "type": "STRING",
          "label": "alias"
        },
        {
          "id": "options",
          "type": "STRING",
          "label": "connection options"
        },
        {
          "id": "tpcs7jrjikehw5o4tzbe5pklca",
          "section": {
            "id": "g52gfotnw7nhnkgq477si2hmmi",
            "label": "Database Owner"
          },
          "type": "STRING",
          "label": "admin",
          "value": "Wendy Appleseed"
        },
        {
          "id": "sdqueijyulxryvu5ceuwktjkiq",
          "section": {
            "id": "g52gfotnw7nhnkgq477si2hmmi",
            "label": "Database Owner"
          },
          "type": "EMAIL",
          "label": "email",
          "value": "appleseed.wendy@gmail.com"
        }
      ]
    }
    ```
  </Tab>
</Tabs>

## Learn more

* [Create an item](/cli/item-create/)
* [Work with items](/cli/reference/management-commands/item/)
* [Work with vaults](/cli/reference/management-commands/vault/)
* [Workflow: Build integrations with 1Password](/get-started/build-integrations)
