Show examples in:
    Create a new model

    Query parameters

    skip_menu_item_creation  string  Optional

    Skip the creation of a menu item linked to the model

    Parameters

    name  string  Required

    Name of the model

    api_key  string  Required

    API key of the model

    singleton  boolean  Optional

    Whether the model is single-instance or not

    all_locales_required  boolean  Optional

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

    sortable  boolean  Optional

    Whether editors can sort records via drag & drop or not

    modular_block  boolean  Optional

    Whether this model is a modular content block or not

    draft_mode_active  boolean  Optional

    Whether draft/published mode is active or not

    tree  boolean  Optional

    Whether editors can organize records in a tree or not

    ordering_direction  enum, null  Optional

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

    ordering_meta  enum, null  Optional

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

    collection_appearance  enum  Optional

    The way the model collection should be presented to the editors

    hint  string, null  Optional

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

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

    The field upon which the collection is sorted

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

    The field to use as display title

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

    The field to use as preview image

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

    The field to use as fallback description for SEO purposes

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

    The workflow to enforce on records

    Returns

    Returns a item_type resource object.

    Examples

    Example code:
    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',
    singleton: false,
    all_locales_required: false,
    sortable: true,
    modular_block: false,
    draft_mode_active: false,
    tree: false,
    ordering_direction: null,
    ordering_meta: 'created_at',
    collection_appearance: 'compact',
    hint: 'Blog posts will be shown in our website under the Blog section',
    ordering_field: null,
    title_field: null,
    image_preview_field: null,
    excerpt_field: null,
    workflow: null
    }, {
    skip_menu_item_creation: 'true'
    });
    console.log(itemType);
    }
    run();
    Returned output:
    {
    id: '44',
    name: 'Blog post',
    api_key: 'post',
    collection_appearance: 'compact',
    singleton: false,
    all_locales_required: false,
    sortable: true,
    modular_block: false,
    draft_mode_active: false,
    tree: false,
    ordering_direction: null,
    ordering_meta: 'created_at',
    has_singleton_item: false,
    hint: 'Blog posts will be shown in our website under the Blog section',
    singleton_item: null,
    fields: [
    {
    type: 'field',
    id: '124'
    }
    ],
    fieldsets: [
    {
    type: 'fieldset',
    id: '124'
    }
    ],
    title_field: null,
    image_preview_field: null,
    excerpt_field: null,
    ordering_field: null,
    workflow: null
    }