update_model
Update a data model by id or slug, changing its fields, labels, validation, unique constraints, product settings, or delivery access after the user agrees.
Instructions
Update a data model by id or slug: name, slug, description, icon, color, displayField, defaultSort, statusField, fields, product capability config, uniqueFields (replaces the whole list; refused while records already share a value), or deliveryAccess ("public" lets the user's app read the model through the delivery API; "none" is admin only). fields is a PATCH - listed fields are added or replaced by key, unlisted fields stay untouched; use removeFields to delete fields. product is also a PATCH of the commerce capability config (enabled, priceField, skuField, inventoryField, variantAxes) - omitted keys keep their stored values. Only call AFTER the user explicitly agreed to the change.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| icon | No | ||
| name | No | ||
| slug | No | ||
| color | No | ||
| fields | No | Fields to ADD or UPDATE, matched by key. A listed key replaces that field's whole definition; fields not listed are kept untouched. To remove a field use removeFields. | |
| 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. | |
| idOrSlug | No | The model's id or slug (from list_models) | |
| defaultSort | No | ||
| description | No | ||
| statusField | No | ||
| displayField | No | ||
| removeFields | No | Keys of existing fields to REMOVE. Removing a field abandons its data on existing records - only pass keys the user explicitly asked to remove. | |
| 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). |