Skip to main content

Command Palette

Search for a command to run...

Deep dive into Sitecore Authoring API - Item Related

Updated
6 min read

This post walks through every item-related mutation available in your Sitecore Authoring GraphQL schema, grouped by purpose. Each example is a copy-pasteable mutation with inline arguments and a concise example response. Replace IDs, paths, names, and template IDs to fit your environment.

Notes before you start

  • Prefer item IDs over paths when available (paths can change).

  • When changing fields, specify language and version explicitly to avoid affecting the wrong version

  • Field values are strings (including dates/numbers) unless your server auto-converts.

  • Keep mutations small and purposeful. One intent per call (e.g., update fields, then publish).

Core item operations

Create Item

Sample Query to Create an item

mutation {
  createItem(
    input: {
      database: "master"
      language: "en"
      parent: "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
      templateId: "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"
      name: "Sample Item"
      fields: [
        { name: "Title", value: "Sample Item Title" }
        { name: "Text", value: "<p>Hello world</p>" }
        { name: "__Owner", value: "sitecore/chandra" }
      ]
    }
  ) {
    item {
      itemId(format: D)
      name
      path
      language {
        name
      }
      version
      template {
        name
        templateId(format: D)
      }
      parent {
        itemId(format: D)
        path
        name
      }
      fields(ownFields: true, excludeStandardFields: true) {
        nodes {
          name
          value
        }
      }
    }
  }
}

Query Response

{
  "data": {
    "createItem": {
      "item": {
        "itemId": "353587a6-19ed-4c8b-bcc3-b8a743473817",
        "name": "Sample Item",
        "path": "/sitecore/content/Home/Sample Item",
        "language": {
          "name": "en"
        },
        "version": 1,
        "template": {
          "name": "Sample Item",
          "templateId": "76036f5e-cbce-46d1-af0a-4143f9b557aa"
        },
        "parent": {
          "itemId": "110d559f-dea5-42ea-9c1c-8a5df7e70ef9",
          "path": "/sitecore/content/Home",
          "name": "Home"
        },
        "fields": {
          "nodes": [
            {
              "name": "Text",
              "value": "<p>Hello world</p>"
            },
            {
              "name": "Title",
              "value": "Sample Item Title"
            }
          ]
        }
      }
    }
  },
  "extensions": {}
}

Screenshot from Sitecore

Fetch An Item

Sample Query

query {
  item(
    where: {
      database: "master"
      itemId: "{353587A6-19ED-4C8B-BCC3-B8A743473817}"
      language: "en"
      version: 2
    }
  ) {
    itemId
    name
    path

    fields(ownFields: true, excludeStandardFields: true) {
      nodes {
        name
        value
      }
    }
  }
}

Sample Response

{
  "data": {
    "item": {
      "itemId": "353587a619ed4c8bbcc3b8a743473817",
      "name": "Sample Item Renamed",
      "path": "/sitecore/content/Home/TestTemplate/Sample Item Renamed",
      "fields": {
        "nodes": [
          {
            "name": "Text",
            "value": ""
          },
          {
            "name": "Title",
            "value": "Updated Sample Item Title version 2"
          }
        ]
      }
    }
  },
  "extensions": {}
}

Update Item

Sample Query to Update an Item

mutation {
  updateItem(input: {
    database: "master"
    itemId: "{353587a6-19ed-4c8b-bcc3-b8a743473817}"
    language: "en"
    version: 1
    fields: [
      { name: "Title", value: "Updated Sample Item Title" }
      { name: "Text", reset: true }
    ]
  }) {
    item {
      itemId(format: D)
      name
      version
      fields(ownFields:true) { nodes { name value } }
    }
  }
}

Query Response

{
  "data": {
    "updateItem": {
      "item": {
        "itemId": "353587a6-19ed-4c8b-bcc3-b8a743473817",
        "name": "Sample Item",
        "version": 1,
        "fields": {
          "nodes": [
            {
              "name": "Text",
              "value": ""
            },
            {
              "name": "Title",
              "value": "Updated Sample Item Title"
            }
          ]
        }
      }
    }
  },
  "extensions": {}
}

Screenshot from Sitecore

Rename Item

Sample Query to Update an item

mutation {
  renameItem(input: {
    database: "master"
    itemId: "{353587a6-19ed-4c8b-bcc3-b8a743473817}"
    newName: "Sample Item Renamed"
  }) {
    item {
      itemId(format: D)
      name
      path
    }
  }
}

Query Response

{
  "data": {
    "renameItem": {
      "item": {
        "itemId": "353587a6-19ed-4c8b-bcc3-b8a743473817",
        "name": "Sample Item Renamed",
        "path": "/sitecore/content/Home/Sample Item Renamed"
      }
    }
  },
  "extensions": {}
}

Screenshot from Sitecore

Move Item

Sample Query to Move an item

mutation {
  moveItem(input: {
    database: "master"
    itemId: "353587a6-19ed-4c8b-bcc3-b8a743473817"
    targetParentPath: "/sitecore/content/Home/TestTemplate"
    sortOrder: 50
  }) {
    item {
      itemId(format: D)
      name
      path
      parent { itemId(format: D) path name }
    }
  }
}

Sample Response

{
  "data": {
    "moveItem": {
      "item": {
        "itemId": "353587a6-19ed-4c8b-bcc3-b8a743473817",
        "name": "Sample Item Renamed",
        "path": "/sitecore/content/Home/TestTemplate/Sample Item Renamed",
        "parent": {
          "itemId": "e64b3d7e-b7ee-44f2-b16f-8e13a48e3d21",
          "path": "/sitecore/content/Home/TestTemplate",
          "name": "TestTemplate"
        }
      }
    }
  },
  "extensions": {}
}

Screenshot From Sitecore

Copy Item

Sample Query to Copy an Item

mutation {
  copyItem(input: {
    database: "master"
    itemId: "353587a6-19ed-4c8b-bcc3-b8a743473817"
    targetParentId: "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
    copyItemName: "Copied Sample Item"
    deepCopy: false
  }) {
    item {
      itemId(format: D)
      name
      path
      parent { itemId(format: D) path }
    }
  }
}

Sample Response

{
  "data": {
    "copyItem": {
      "item": {
        "itemId": "6da5b01e-115b-4593-b907-0170e580c811",
        "name": "Copied Sample Item",
        "path": "/sitecore/content/Home/Copied Sample Item",
        "parent": {
          "itemId": "110d559f-dea5-42ea-9c1c-8a5df7e70ef9",
          "path": "/sitecore/content/Home"
        }
      }
    }
  },
  "extensions": {}
}

Screenshot From Sitecore

Delete Item

Sample Query to delete an item

mutation {
  deleteItem(input: {
    database: "master"
    itemId: "{6da5b01e-115b-4593-b907-0170e580c811}"
    permanently: false #true would delete from recycle bin as well
  }) {
    successful
  }
}

Sample Response

{
  "data": {
    "deleteItem": {
      "successful": true
    }
  },
  "extensions": {}
}

Screenshot From Sitecore

Versioning

Add a New Version

Sample Query to add a version

mutation {
  addItemVersion(input: {
    database: "master"
    itemId: "{353587A6-19ED-4C8B-BCC3-B8A743473817}"
    language: "en"
    versionName: "Updated version"
  }) {
    item {
      itemId(format: D)
      name
      language { name }
      version
      versions { version }
    }
  }
}

Sample Response

{
  "data": {
    "addItemVersion": {
      "item": {
        "itemId": "353587a6-19ed-4c8b-bcc3-b8a743473817",
        "name": "Sample Item Renamed",
        "language": {
          "name": "en"
        },
        "version": 2,
        "versions": [
          {
            "version": 1
          },
          {
            "version": 2
          }
        ]
      }
    }
  },
  "extensions": {}
}

Screenshot from Sitecore

Delete a specific version

Sample Query to delete a specific version

mutation {
  deleteItemVersion(input: {
    database: "master"
    itemId: "353587a6-19ed-4c8b-bcc3-b8a743473817"
    language: "en"
    version: 2
  }) {
    item {
      itemId(format: D)
      name
      language { name }
      version
      versions { version }
    }
  }
}

Sample Response

{
  "data": {
    "deleteItemVersion": {
      "item": {
        "itemId": "353587a6-19ed-4c8b-bcc3-b8a743473817",
        "name": "Sample Item Renamed",
        "language": {
          "name": "en"
        },
        "version": 1,
        "versions": [
          {
            "version": 1
          }
        ]
      }
    }
  },
  "extensions": {}
}

Note: The deletion of version is a permanent delete and cannot be restored from recycle bin, you can use achieve item mutation if you would need to restore the version

Publishing

Publish an Item

Sample Query to publish an item

mutation {
  publishItem(input: {
    displayName: "Publish Sample Item"
    languages: ["en"]
    publishItemMode: FULL
    publishRelatedItems: true
    publishSubItems: true
    rootItemId: "{353587A6-19ED-4C8B-BCC3-B8A743473817}"
    sourceDatabase: "master"
    targetDatabases: ["experienceedge"]
  }) {
    operationId
  }
}

Sample Response

{
  "data": {
    "publishItem": {
      "operationId": "fa318fd3-c300-40c9-967d-425c652a2a6a;xxxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
  },
  "extensions": {}
}

Screenshot From Sitecore

Publish Specific Items in Specific Languages

Sample Query

mutation {
  publishLanguageSpecificItems(
    input: {
      displayName: "Publish Specific Items in specific languages"
      publishItemMode: FULL
      publishRelatedItems: false
      publishSubItems: false
      sourceDatabase: "master"
      targetDatabases: ["experienceedge"]
      itemsToPublish: [
        { id: "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}", languages: ["en"] }
        { id: "{E64B3D7E-B7EE-44F2-B16F-8E13A48E3D21}", languages: ["en"] }
        { id: "{353587A6-19ED-4C8B-BCC3-B8A743473817}", languages: ["en"] }
      ]
    }
  ) {
    operationId
  }
}

Sample Response

{
  "data": {
    "publishLanguageSpecificItems": {
      "operationId": "8f97a9e2-4331-4b83-9c8a-3eb908d62137;xxxxxxxxxxxxxxxxxxx"
    }
  },
  "extensions": {}
}

Screenshot From Sitecore

Apply Different Publish Options

Sample Query

mutation {
  publishWithOptions(input: {
    options: [
      {
        language: "en"
        publishItemMode: FULL
        publishRelatedItems: false
        publishSubItems: false
        rootItemId: "{E64B3D7E-B7EE-44F2-B16F-8E13A48E3D21}"
        sourceDatabase: "master"
        targetDatabase: "experienceedge"
      }
      {
        language: "en"
        publishItemMode: SMART
        publishRelatedItems: true
        publishSubItems: false
        rootItemId: "{353587A6-19ED-4C8B-BCC3-B8A743473817}"
        sourceDatabase: "master"
        targetDatabase: "experienceedge"
      }
    ]
  }) {
    operationId
  }
}

Screenshot From Sitecore

Cancel Publishing Job

Sample Query

mutation {
  cancelPublishing(publishingOperationId: "d907a30a-4bc3-4a3c-87f2-cbfa4057c5e7") {
    success
    publishingOperationId
    message
  }
}

Sample Response

{
  "data": {
    "cancelPublishing": {
      "success": true,
      "publishingOperationId": "d907a30a-4bc3-4a3c-87f2-cbfa4057c5e7",
      "message": "Publish cancellation requested."
    }
  },
  "extensions": {}
}

Screenshot from Sitecore

Start Workflow

Starts the workflow for the specified item. When executed, it will set the state to the initial state and clear all workflow history

Sample Query

mutation {
  startWorkflow(input: {
    item: {
      database: "master"
      itemId: "{E64B3D7E-B7EE-44F2-B16F-8E13A48E3D21}"
      language: "en"
      version: 1
    }
  }) {
    successful
  }
}

Sample Response

{
  "data": {
    "startWorkflow": {
      "successful": true
    }
  },
  "extensions": {}
}

Screenshot From Sitecore

Execute Workflow Command

Sample Query

mutation {
  executeWorkflowCommand(input: {
    commandId: "{CF6A557D-0B86-4432-BF47-302A18238E74}"
    comments: "Approved for publishing"
    item: {
      database: "master"
      itemId: "{E64B3D7E-B7EE-44F2-B16F-8E13A48E3D21}"
      language: "en"
      version: 1
    }
  }) {
    successful
    completed
    nextStateId
    message
    error
  }
}

Sample Response

{
  "data": {
    "executeWorkflowCommand": {
      "successful": true,
      "completed": true,
      "nextStateId": "{46DA5376-10DC-4B66-B464-AFDAA29DE84F}",
      "message": "",
      "error": null
    }
  },
  "extensions": {}
}

Screenshot From Sitecore

More from this blog

Sitecore Pulse

15 posts