#Models
A model defines the structure of a content type in your project. The models you create and the fields 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.
For GraphQL operations generated from models and programmatic schema management, see the Models API Reference.
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. 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
-
Navigate to the Schema builder.
-
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.
-
Complete the model settings:
Property Example Description Display name PostThe name shown in Hygraph for content editors. API ID PostThe ID used to fetch a single entry through the API. Plural API ID PostsThe ID used to fetch multiple entries through the API. Description Blog postsOptional 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.
-
Click Add Model.
Your model appears in the Schema list. It has no custom fields yet. Next, add fields 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.
- Open the model in the Schema builder.
- From the Add fields sidebar, select a field type.
- Configure the field display name, API ID, and any options or validations.
- Click Add.
You can add fields to custom models and to the system Asset model.
Useful field guides:
- Field types — available field types and what they store
- Field configuration — options, validations, and advanced settings
- Slug field — generate slugs from other field values
- Conditional fields — show or hide fields based on other values
- References — relate entries across models
- Components — reuse groups of fields inside a model
#System fields
Every model includes 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
- Navigate to the Schema builder.
- Select the model you want to edit.
- Open the model settings (context menu) to update the display name, API IDs, description, or preview URLs.
Changing API IDs after content exists can break existing queries and integrations. Plan renames carefully.
#Delete a model
- Navigate to the Schema builder.
- Select the model you want to delete.
- 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.
#Next steps
After your models are in place, you can:
- Import schema elements from another project
- Connect models with references
- Reuse field groups with components
- Add constrained options with enumerations
- Classify content with taxonomies
- Follow a full modeling walkthrough in the content models tutorial