# Models

Learn how to create, edit, and delete content models in the Schema builder, and how to add fields that define your project's content structure.

A model defines the structure of a content type in your project. The models you create and the [fields](https://hygraph.com/docs/developer-guides/schema/field-types) you add make up your schema. Hygraph exposes models and their fields in the GraphQL API as soon as you save it. Content editors then create entries based on those models in the Content editor.

**Looking for the API Reference?:**

For GraphQL operations generated from models and programmatic schema management, see the [Models API Reference](https://hygraph.com/docs/api-reference/schema/models).

Every Hygraph project includes the following system models:

| Model | Purpose |
| --- | --- |
| **Asset** | Stores images and other files. You can add fields to it, but you cannot delete it. |
| **Query** | Used to configure top-level remote fields. You cannot delete it. |
| **Segment** | A named reference used to target a group of users for [Variants](https://hygraph.com/docs/developer-guides/schema/variants). You can add fields to it, but you cannot delete it or localize its fields. |

You can create custom models for the rest of your content types. Schema changes are available in the GraphQL API as soon as you save them.

## Create a model

[Video: Create a model](https://eu-central-1-shared-euc1-02.graphassets.com/AvHQ3RDvFSousA8iwElOKz/cmkc6mce6w7w407vzxb6vyz2v)

1. Navigate to the **Schema** builder.
2. In the Schema list, click **+ Add** next to **Models**. Or, if you're adding a model for the first time, click **+ Add Model** in the center of the screen.
3. Complete the model settings:

    | Property | Example | Description |
    | --- | --- | --- |
    | Display name | `Post` | The name shown in Hygraph for content editors. |
    | API ID | `Post` | The ID used to fetch a single entry through the API. |
    | Plural API ID | `Posts` | The ID used to fetch multiple entries through the API. |
    | Description | `Blog posts` | Optional hint for editors working with this model. |

    Hygraph auto-fills **API ID** and **Plural API ID** from the display name. You can edit them before you save. Avoid [reserved terms](https://hygraph.com/docs/developer-guides/schema/reserved-terms).

4. Click **Add Model**.

Your model appears in the Schema list. It has no custom fields yet. Next, [add fields](https://hygraph.com/docs/developer-guides/schema/models#add-fields-to-a-model) to define what editors can enter.

## Add fields to a model

Fields define the data a model can store. Each field uses one of Hygraph’s supported [field types](https://hygraph.com/docs/developer-guides/schema/field-types).

1. Open the model in the Schema builder.
2. From the **Add fields** sidebar, select a field type.
3. Configure the field display name, API ID, and any options or [validations](https://hygraph.com/docs/developer-guides/schema/field-configuration#validations).
4. Click **Add**.

You can add fields to custom models and to the system **Asset** model.

### System fields

Every model includes [system fields](https://hygraph.com/docs/api-reference/schema/system-fields) such as `id`, `createdAt`, `createdBy`, `updatedAt`, `updatedBy`, `publishedAt`, `publishedBy`, and `scheduledIn`. You do not need to add them; Hygraph manages them automatically.

To view system fields on a model, enable **Show system fields** in the **Fields** tab.

## Edit a model

1. Navigate to the **Schema** builder.
2. Select the model you want to edit.
3. On the **Settings** tab, update the display name, API IDs, or description.

Changing the API IDs could break existing queries and integrations. Plan renames carefully.

## Delete a model

1. Navigate to the **Schema** builder.
2. Select the model you want to delete.
3. Open the context menu and choose **Delete**.

Deleting a model also deletes all of its content entries. System models (**Asset**, **Query**, and **Segment**) cannot be deleted.

## Customize the sidebar

Each model has a **Sidebar** tab, next to the **Fields** and **Settings** tabs. Use it to add, remove, and reorder the widgets that appear in the sidebar of the content form for that model. Sidebar changes apply only to the model you are editing.

Under **Sidebar widgets**, you can see the widgets currently shown on the content form, in the order editors see them. Each widget shows a label, such as **System**. You can also add, remove, and reorder widgets.

System widgets are built into Hygraph, for example **Entry information**, **Schedule**, **Stages**, **Localizations**, **Versions**, **Agents**, and **Preview**. Custom widgets come from apps that include a [sidebar element](https://hygraph.com/docs/app-framework/sidebar-element/declaration).

### Add a widget

![Add sidebar widgets](https://hygraph.com/images/docs/user-guides/sidebar-widgets.png)

1. Navigate to the **Schema** builder and select the model.
2. Click the **Sidebar** tab.
3. Under **Add a sidebar widget**, click the widget you want to add.

Depending on the widget, you may need to enter additional information before saving. For example, the **Preview** widget needs a preview name and a URL template. They are most useful for models that represent a page and include a field such as a slug. See [Add a preview widget](https://hygraph.com/docs/developer-guides/visual-editing/live-preview#add-a-preview-widget).

### Remove a widget

[Video: Removing Widgets](https://eu-central-1-shared-euc1-02.graphassets.com/AvHQ3RDvFSousA8iwElOKz/cmnn9xvpkjbsq07w5eytzu2g4)

1. Navigate to the **Schema** builder and select the model.
2. Click the **Sidebar** tab.
3. Under **Sidebar widgets**, click the context menu for the widget, and then click **Remove**.

### Reorder widgets

[Video: Reordering Widgets](https://eu-central-1-shared-euc1-02.graphassets.com/AvHQ3RDvFSousA8iwElOKz/cmnn9xvrhhv5107vxqzc0ti48)

1. Navigate to the **Schema** builder and select the model.
2. Click the **Sidebar** tab.
3. Under **Sidebar widgets**, click and hold the widget handlebar, and then drop it in the new position.

### Reset the sidebar

To restore the sidebar to its default widgets, click **Reset to default** on the **Sidebar** tab.
