create_model
Create a CMS data model with custom fields, relations, product config, and delivery access after the user explicitly approves the proposed structure.
Instructions
Create a data model in the workspace. Field types include select/multiselect (provide options), relation (link to another model via relationTo = the target model's slug + relationType), and object/list (nested fields/itemFields). Optional model-level config: slug, description, icon, color, displayField, defaultSort, statusField, product (commerce capability: enabled, priceField, skuField, inventoryField, variantAxes), uniqueFields (field keys whose value must be unique - lets import_records update by that key) and deliveryAccess - a model is "none" (admin only) by default, so pass "public" when the user's app must read it through the delivery API. Only call AFTER the user has explicitly agreed to a structure you proposed (e.g. replied yes / clicked 'Yes, create'). Never create without that explicit go-ahead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| icon | No | Lucide icon name, defaults to 'database' | |
| name | No | ||
| slug | No | URL-safe slug (lowercase). Derived from name when omitted. | |
| color | No | ||
| fields | No | ||
| product | No | Product capability config PATCH: omitted keys keep their stored values (defaults on first enable: skuField 'sku', priceField 'price', inventoryField 'inventory', variantAxes []). E.g. {variantAxes: []} clears the axes without touching anything else. | |
| defaultSort | No | ||
| description | No | ||
| statusField | No | Enable record lifecycle states with allowed transitions | |
| displayField | No | Field key used as the record's display label in UI | |
| uniqueFields | No | Keys of top-level text, email, url, phone or number fields whose value no two records may share (not translatable fields, not the product price/stock fields). Replaces the whole list; [] removes every constraint. Refused while existing records already share a value - the error lists them. | |
| deliveryAccess | No | Who can read this model through the delivery API: "public" (any app with the workspace endpoint - required for a content API), "members" (signed-in site members only), "none" (admin only, the default). |