Show examples in:
Create a new model

Query parameters

skip_menu_item_creation  Optional  boolean  Example: true

Skip the creation of a menu item linked to the model

menu_item_id  Optional  string  Example: "FF-P5of6Qp-DD2w0xoaa6Q"

Explicitely specify the ID of the menu item that will be linked to the model

schema_menu_item_id  Optional  string  Example: "FF-P5of6Qp-DD2w0xoaa6Q"

Explicitely specify the ID of the schema menu item that will be linked to the model

Body Parameters

id  string  Optional
RFC 4122 UUID of item type expressed in URL-safe base64 format
name  Required  string  Example: "Blog post"

Name of the model

api_key  Required  string  Example: "post"

API key of the model

singleton  Optional  boolean

Whether the model is single-instance or not

all_locales_required  Optional  boolean

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

sortable  Optional  boolean  Example: true

Whether editors can sort records via drag & drop or not

modular_block  Optional  boolean

Whether this model is a modular content block or not

draft_mode_active  Optional  boolean

Whether draft/published mode is active or not

tree  Optional  boolean

Whether editors can organize records in a tree or not

ordering_direction  Optional  enum, null

If an ordering field is set, this fields specify the sorting direction

ordering_meta  Optional  enum, null  Example: "created_at"

Specifies the model's sorting method. Cannot be set in concurrency with ordering_field

collection_appearance  Optional  enum  Example: "compact"

The way the model collection should be presented to the editors

hint  Optional  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

inverse_relationships_enabled  Optional  boolean

Whether inverse relationships fields are expressed in GraphQL or not

ordering_field  Optional  { type: "field", id: field.id }, null

The field upon which the collection is sorted

title_field  Optional  { type: "field", id: field.id }, null

The field to use as display title

image_preview_field  Optional  { type: "field", id: field.id }, null

The field to use as preview image

excerpt_field  Optional  { type: "field", id: field.id }, null

The field to use as fallback description for SEO purposes

workflow  Optional  { type: "workflow", id: workflow.id }, null

The workflow to enforce on records

Returns

Returns a item_type resource object.

Examples

Example Basic example
import { buildClient } from '@datocms/cma-client-node';
async function run() {
const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
const itemType = await client.itemTypes.create({
name: 'Blog post',
api_key: 'post'
});
console.log(itemType);
}
run();