# 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/api-reference/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/api-reference/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/api-reference/schema/field-configuration#validations).
4. Click **Add**.

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

Useful field guides:

- [Field types](https://hygraph.com/docs/api-reference/schema/field-types) — available field types and what they store
- [Field configuration](https://hygraph.com/docs/api-reference/schema/field-configuration) — options, validations, and advanced settings
- [Slug field](https://hygraph.com/docs/developer-guides/schema/slug-field) — generate slugs from other field values
- [Conditional fields](https://hygraph.com/docs/developer-guides/schema/conditional-fields) — show or hide fields based on other values
- [References](https://hygraph.com/docs/developer-guides/schema/references) — relate entries across models
- [Components](https://hygraph.com/docs/developer-guides/schema/components) — reuse groups of fields inside a model

### System fields

Every model includes [system fields](https://hygraph.com/docs/api-reference/schema/system-fields) such as `id`, `createdAt`, `updatedAt`, and `publishedAt`. 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. Open the model settings (context menu) to update the display name, API IDs, description, or [preview URLs](#preview-urls).

Changing API IDs after content exists can 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.

## Preview URLs

Preview URLs let editors open a frontend preview of an entry from the Content editor. They are most useful for models that represent a page and include a field such as a slug.

Configure preview URLs in the model settings. You can use fields from the model in the URL template. For example, a `Post` model might use:

| Preview name | URL template |
| --- | --- |
| Production | `https://example.com/blog/{slug}` |
| Staging | `https://staging.example.com/blog/{slug}` |
| Next.js Preview | `https://example.com/api/preview?secret=abc&slug={slug}` |

For live preview and visual editing setup, see [Visual editing](https://hygraph.com/docs/developer-guides/schema/visual-editing-overview).

## Next steps

After your models are in place, you can:

- [Import schema elements from another project](https://hygraph.com/docs/developer-guides/schema/import-schema)
- Connect models with [references](https://hygraph.com/docs/developer-guides/schema/references)
- Reuse field groups with [components](https://hygraph.com/docs/developer-guides/schema/components)
- Add constrained options with [enumerations](https://hygraph.com/docs/developer-guides/schema/using-enumerations)
- Classify content with [taxonomies](https://hygraph.com/docs/developer-guides/schema/taxonomies)
- Follow a full modeling walkthrough in the [content models tutorial](https://hygraph.com/docs/getting-started/tutorial/tutorial-content-models-overview)
