# Model/Block model

The way you define the kind of content you can edit inside a DatoCMS project passes through the concept of **models** and **block models**. For backward-compatibility reasons, the API refers to both as "item types".

## Models

Models are much like database tables — they define the structure of your main content types (e.g., blog posts, products, landing pages). Each model is composed of fields with custom validations. Records created from models exist independently and can be referenced by other records through link fields.

## Block Models

Block models define complex and repeatable structures that can be embedded inside records. They are the foundation behind features like [Modular Content](https://www.datocms.com/docs/content-modelling/modular-content.md) and [Structured Text](https://www.datocms.com/docs/content-modelling/structured-text.md).

### Key differences:

-   **Models** create standalone records that can be referenced and have independent value
-   **Block models** create blocks that only exist within parent records and cannot be referenced via link fields
-   Block models defined in the library can be reused across different models
-   When a record gets deleted, all the blocks it contains are deleted with it
-   Blocks do not count towards your plan's records limit

You can distinguish between models and block models using the `modular_block` attribute: `true` indicates a block model, `false` indicates a regular model.

## Object payload

**`id`**

- Type: string
- Example: `"DxMaW10UQiCmZcuuA-IkkA"`

RFC 4122 UUID of item type expressed in URL-safe base64 format

**`type`**

- Type: string

Must be exactly `"item_type"`.

**`name`**

- Type: string
- Example: `"Blog post"`

Name of the model/block model

**`api_key`**

- Type: string
- Example: `"post"`

API key of the model/block model

**`singleton`**

- Type: boolean

Whether the model is single-instance or not. This property only applies to models, not block models

**`sortable`**

- Type: boolean

Whether editors can sort records via drag & drop or not. Must be false for block models

**`modular_block`**

- Type: boolean

Whether this is a block model or not. Block models define structures that can be embedded inside records, while regular models create standalone records

**`tree`**

- Type: boolean

Whether editors can organize records in a tree or not. Must be false for block models

**`ordering_direction`**

- Type: enum, null

If an ordering field is set, this field specifies the sorting direction. This property does not apply to block models

<details>
<summary>Show enum values</summary>

**`asc`**

Ascending order

**`desc`**

Descending order

</details>

**`ordering_meta`**

- Type: enum, null
- Example: `"created_at"`

Specifies the model's sorting method. Cannot be set in concurrency with ordering_field. This property does not apply to block models

<details>
<summary>Show enum values</summary>

**`created_at`**

Order by date of creation

**`updated_at`**

Order by date of last update

**`first_published_at`**

Order by date of first publication

**`published_at`**

Order by date of last publication

</details>

**`draft_mode_active`**

- Type: boolean

Whether draft/published mode is active or not. Must be false for block models

**`all_locales_required`**

- Type: boolean

Whether we require all the project locales to be present for each localized field or not

**`collection_appearance`**

- Type: enum
- Example: `"compact"`

The way the model/block model collection should be presented to the editors

<details>
<summary>Show enum values</summary>

**`compact`**

Compact view

**`table`**

Tabular view

</details>

**`hint`**

- Type: string, null
- Example: `"Blog posts will be shown in our website under the Blog section"`

A hint shown to editors to help them understand the purpose of this model/block model

**`inverse_relationships_enabled`**

- Type: boolean

Whether inverse relationships fields are expressed in GraphQL or not. Must be false for block models

**`draft_saving_active`**

- Type: boolean

Whether draft records can be saved without satisfying the validations or not. Must be false for block models

**`meta.has_singleton_item`**

- Type: boolean

If this model is single-instance, this tells whether the single-instance record has already been created or not. This property only applies to models, not block models

**`singleton_item`**

- Type: [ResourceLinkage\<"item"\>](https://www-draft.datocms.com/docs/content-management-api/resources/item.md), null

The record instance related to this model. This relationship only applies to single-instance models, not block models

**`fields`**

- Type: Array<[ResourceLinkage\<"field"\>](https://www-draft.datocms.com/docs/content-management-api/resources/field.md)>

The list of fields for this model/block model

**`fieldsets`**

- Type: Array<[ResourceLinkage\<"fieldset"\>](https://www-draft.datocms.com/docs/content-management-api/resources/fieldset.md)>

The list of fieldsets for this model/block model

**`presentation_title_field`**

- Type: [ResourceLinkage\<"field"\>](https://www-draft.datocms.com/docs/content-management-api/resources/field.md), null

The field to use as presentation title

**`presentation_image_field`**

- Type: [ResourceLinkage\<"field"\>](https://www-draft.datocms.com/docs/content-management-api/resources/field.md), null

The field to use as presentation image

**`title_field`**

- Type: [ResourceLinkage\<"field"\>](https://www-draft.datocms.com/docs/content-management-api/resources/field.md), null

The field to use as fallback title for SEO purposes. This relationship does not apply to block models

**`image_preview_field`**

- Type: [ResourceLinkage\<"field"\>](https://www-draft.datocms.com/docs/content-management-api/resources/field.md), null

The field to use as fallback image for SEO purposes. This relationship does not apply to block models

**`excerpt_field`**

- Type: [ResourceLinkage\<"field"\>](https://www-draft.datocms.com/docs/content-management-api/resources/field.md), null

The field to use as fallback description for SEO purposes. This relationship does not apply to block models

**`ordering_field`**

- Type: [ResourceLinkage\<"field"\>](https://www-draft.datocms.com/docs/content-management-api/resources/field.md), null

The field upon which the collection is sorted. This relationship does not apply to block models

**`workflow`**

- Type: [ResourceLinkage\<"workflow"\>](https://www-draft.datocms.com/docs/content-management-api/resources/workflow.md), null

The workflow to enforce on records

<details>
<summary>Show deprecated</summary>

**`collection_appeareance`**

- Deprecated
- Type: enum
- Example: `"compact"`

The way the model collection should be presented to the editors

This field contains a typo and will be removed in future versions: use `collection_appearance` instead

<details>
<summary>Show enum values</summary>

**`compact`**

Compact view

**`table`**

Tabular view

</details>

**`has_singleton_item`**

- Deprecated
- Type: boolean

If this model is single-instance, this tells whether the single-instance record has already been created or not. This property only applies to models, not block models

This field will be removed in future versions: instead, use the equivalent `has_singleton_item` field in the meta collection

</details>

## Available endpoints

-   [Create a new model/block model](https://www.datocms.com/docs/content-management-api/resources/item_type/create.md)
-   [Update a model/block model](https://www.datocms.com/docs/content-management-api/resources/item_type/update.md)
-   [List all models/block models](https://www.datocms.com/docs/content-management-api/resources/item_type/instances.md)
-   [Retrieve a model/block model](https://www.datocms.com/docs/content-management-api/resources/item_type/self.md)
-   [Duplicate model/block model](https://www.datocms.com/docs/content-management-api/resources/item_type/duplicate.md)
-   [Delete a model/block model](https://www.datocms.com/docs/content-management-api/resources/item_type/destroy.md)
-   [List models referencing another model/block](https://www.datocms.com/docs/content-management-api/resources/item_type/referencing.md)

## Related content in "Content Management API"

- [Content Management API Overview](https://www.datocms.com/docs/content-management-api.md)
- [Using the JavaScript CMA client](https://www.datocms.com/docs/content-management-api/using-the-nodejs-clients.md)
- [API versioning](https://www.datocms.com/docs/content-management-api/api-versioning.md)
- [Authentication](https://www.datocms.com/docs/content-management-api/authentication.md)
- [Environments](https://www.datocms.com/docs/content-management-api/setting-the-environment.md)
- [Error codes & handling failures (CMA)](https://www.datocms.com/docs/content-management-api/errors.md)
- [Pagination](https://www.datocms.com/docs/content-management-api/pagination.md)
- [Asynchronous jobs](https://www.datocms.com/docs/content-management-api/async-jobs.md)
- [CMA Technical Limits & Rate Limits](https://www.datocms.com/docs/content-management-api/technical-limits.md)
- [Record](https://www.datocms.com/docs/content-management-api/resources/item.md)
- [Scheduled publication](https://www.datocms.com/docs/content-management-api/resources/scheduled-publication.md)
- [Scheduled unpublishing](https://www.datocms.com/docs/content-management-api/resources/scheduled-unpublishing.md)
- [Upload](https://www.datocms.com/docs/content-management-api/resources/upload.md)
- [Site](https://www.datocms.com/docs/content-management-api/resources/site.md)
- [Model/Block model](https://www.datocms.com/docs/content-management-api/resources/item-type.md)
- [Field](https://www.datocms.com/docs/content-management-api/resources/field.md)
- [Fieldset](https://www.datocms.com/docs/content-management-api/resources/fieldset.md)
- [Record version](https://www.datocms.com/docs/content-management-api/resources/item-version.md)
- [Upload permission](https://www.datocms.com/docs/content-management-api/resources/upload-request.md)
- [Upload track](https://www.datocms.com/docs/content-management-api/resources/upload-track.md)
- [Manual tags](https://www.datocms.com/docs/content-management-api/resources/upload-tag.md)
- [Smart tags](https://www.datocms.com/docs/content-management-api/resources/upload-smart-tag.md)
- [Upload Collection](https://www.datocms.com/docs/content-management-api/resources/upload-collection.md)
- [Search Index](https://www.datocms.com/docs/content-management-api/resources/search-index.md)
- [Search result](https://www.datocms.com/docs/content-management-api/resources/search-result.md)
- [Search indexing activity](https://www.datocms.com/docs/content-management-api/resources/search-index-event.md)
- [Environment](https://www.datocms.com/docs/content-management-api/resources/environment.md)
- [Maintenance mode](https://www.datocms.com/docs/content-management-api/resources/maintenance-mode.md)
- [Menu Item](https://www.datocms.com/docs/content-management-api/resources/menu-item.md)
- [Schema Menu Item](https://www.datocms.com/docs/content-management-api/resources/schema-menu-item.md)
- [Uploads filter](https://www.datocms.com/docs/content-management-api/resources/upload-filter.md)
- [Model filter](https://www.datocms.com/docs/content-management-api/resources/item-type-filter.md)
- [Plugin](https://www.datocms.com/docs/content-management-api/resources/plugin.md)
- [Workflow](https://www.datocms.com/docs/content-management-api/resources/workflow.md)
- [Asynchronous job](https://www.datocms.com/docs/content-management-api/resources/job.md)
- [Job result](https://www.datocms.com/docs/content-management-api/resources/job-result.md)
- [Account](https://www.datocms.com/docs/content-management-api/resources/account.md)
- [Organization](https://www.datocms.com/docs/content-management-api/resources/organization.md)
- [Invitation](https://www.datocms.com/docs/content-management-api/resources/site-invitation.md)
- [Collaborator](https://www.datocms.com/docs/content-management-api/resources/user.md)
- [Role](https://www.datocms.com/docs/content-management-api/resources/role.md)
- [API token](https://www.datocms.com/docs/content-management-api/resources/access-token.md)
- [Webhook](https://www.datocms.com/docs/content-management-api/resources/webhook.md)
- [Webhook call](https://www.datocms.com/docs/content-management-api/resources/webhook-call.md)
- [Build trigger](https://www.datocms.com/docs/content-management-api/resources/build-trigger.md)
- [Deploy activity](https://www.datocms.com/docs/content-management-api/resources/build-event.md)
- [Subscription limit](https://www.datocms.com/docs/content-management-api/resources/subscription-limit.md)
- [Subscription feature](https://www.datocms.com/docs/content-management-api/resources/subscription-feature.md)
- [SSO Settings](https://www.datocms.com/docs/content-management-api/resources/sso-settings.md)
- [SSO User](https://www.datocms.com/docs/content-management-api/resources/sso-user.md)
- [SSO Group](https://www.datocms.com/docs/content-management-api/resources/sso-group.md)
- [White-label settings](https://www.datocms.com/docs/content-management-api/resources/white-label-settings.md)
- [Audit log event](https://www.datocms.com/docs/content-management-api/resources/audit-log-event.md)