> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: "upsertCMSItem"
sidebarTitle: "upsertCMSItem"
description: "Creates a new CMS item or updates an existing one. IMPORTANT: Call getCMSCollections first to get field IDs and see the field data format documentation. For creating a new item: - Provide slug and fie"
tag: "TOOL"
tagColor: "purple"
gridGap: 30
---

<Aside full>
  <RequestExample>
    ```json lines=false
    {
      "method": "tools/call",
      "params": {
        "name": "upsertCMSItem",
        "arguments": {
          "collectionId": "string",
          "itemId": "string",
          "slug": "string",
          "fieldData": {},
          "draft": true
        }
      }
    }
    ```
  </RequestExample>
</Aside>

<MCPTool {...{"name":"upsertCMSItem","description":"Creates a new CMS item or updates an existing one.\n\nIMPORTANT: Call getCMSCollections first to get field IDs and see the field data format documentation.\n\nFor creating a new item:\n- Provide slug and fieldData (itemId should be omitted)\n- The slug must be unique within the collection\n\nFor updating an existing item:\n- Provide itemId and any fields to update\n- Only included fields will be changed (partial updates supported)\n\nThe field structure must match the collection's field definitions from getCMSCollections.","inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"collectionId":{"type":"string","description":"The ID of the CMS collection"},"itemId":{"description":"ID of existing item to update (omit to create new)","type":"string"},"slug":{"description":"URL-friendly identifier (required for new items, optional for updates)","type":"string"},"fieldData":{"description":"Field values as an object where each key is a field ID and each value is a { type, value } entry","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"type":{"type":"string","description":"Field type (for example: string, image, formattedText, enum)"},"value":{"description":"Field value. Its shape depends on the field type."},"contentType":{"description":"Optional for formattedText fields. Use markdown or html.","type":"string","enum":["markdown","html"]}},"required":["type","value"],"additionalProperties":{}}},"draft":{"description":"Draft status (default: false for new items)","type":"boolean"}},"required":["collectionId"],"additionalProperties":false},"annotations":{"idempotentHint":true}}} />
