Change a Studio site: pages, sections, nodes, per-breakpoint styles and components, as a list of operations applied in order. This is the ONLY tool that writes to a design document, and it is all-or-nothing — if any operation is rejected, none of them are saved and you are told which one failed. Send a whole page as one call rather than one node at a time: the cost is the same. Pass baseVersion from get_site_context or get_page_context to be refused rather than overwrite an edit somebody made while you were working.
success, applied (how many operations), version, created (ids of new nodes), changes. All or nothing: if one operation is rejected, nothing is saved.
Input JSON Schema
{
"type": "object",
"properties": {
"siteId": {
"type": "string"
},
"operations": {
"minItems": 1,
"maxItems": 200,
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "create_page"
},
"name": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"404",
"page"
]
}
},
"required": [
"op",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "rename_page"
},
"pageId": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"op",
"pageId",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "duplicate_page"
},
"pageId": {
"type": "string"
}
},
"required": [
"op",
"pageId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "delete_page"
},
"pageId": {
"type": "string"
}
},
"required": [
"op",
"pageId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "move_page"
},
"pageId": {
"type": "string"
},
"toIndex": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"op",
"pageId",
"toIndex"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "set_homepage"
},
"pageId": {
"type": "string"
}
},
"required": [
"op",
"pageId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "set_page_meta"
},
"pageId": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"slug": {
"type": "string"
}
},
"required": [
"op",
"pageId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "insert_section"
},
"parentId": {
"type": "string",
"description": "Usually the page root's id"
},
"sectionId": {
"type": "string",
"description": "From list_section_templates"
}
},
"required": [
"op",
"parentId",
"sectionId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "insert_node"
},
"parentId": {
"type": "string"
},
"afterId": {
"description": "Insert after this sibling instead of appending",
"type": "string"
},
"type": {
"type": "string",
"enum": [
"section",
"container",
"heading",
"text",
"button",
"link",
"image",
"video"
]
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
"src": {
"type": "string"
},
"alt": {
"type": "string"
},
"href": {
"type": "string"
},
"styles": {
"description": "Desktop styles for the new node",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": [
"string",
"number"
]
}
}
},
"required": [
"op",
"parentId",
"type"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "update_node"
},
"nodeId": {
"type": "string"
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
"src": {
"type": "string"
},
"alt": {
"type": "string"
},
"href": {
"type": "string"
},
"htmlId": {
"type": "string"
}
},
"required": [
"op",
"nodeId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "delete_node"
},
"nodeId": {
"type": "string"
}
},
"required": [
"op",
"nodeId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "duplicate_node"
},
"nodeId": {
"type": "string"
}
},
"required": [
"op",
"nodeId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "move_node"
},
"nodeId": {
"type": "string"
},
"parentId": {
"type": "string",
"description": "New parent"
},
"index": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"op",
"nodeId",
"parentId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "set_style"
},
"nodeId": {
"type": "string"
},
"breakpoint": {
"description": "Default desktop. tablet/mobile layer OVER desktop — they do not replace it.",
"type": "string",
"enum": [
"desktop",
"tablet",
"mobile"
]
},
"styles": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": [
"string",
"number"
]
},
"description": "StyleProps keys — fontSize, paddingY, gap, display, gridTemplateColumns, color, background… See lib/design/types.ts."
},
"replace": {
"description": "Replace this breakpoint's styles instead of merging. Default false.",
"type": "boolean"
}
},
"required": [
"op",
"nodeId",
"styles"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "clear_style"
},
"nodeId": {
"type": "string"
},
"breakpoint": {
"type": "string",
"enum": [
"tablet",
"mobile"
],
"description": "Drop this breakpoint's overrides so it inherits desktop again"
},
"keys": {
"description": "Only these properties. Omit to clear the whole breakpoint.",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"op",
"nodeId",
"breakpoint"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "create_component"
},
"nodeId": {
"type": "string",
"description": "Node to turn into a component master"
},
"name": {
"type": "string"
}
},
"required": [
"op",
"nodeId",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "insert_component"
},
"parentId": {
"type": "string"
},
"componentId": {
"type": "string"
}
},
"required": [
"op",
"parentId",
"componentId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "detach_instance"
},
"nodeId": {
"type": "string"
}
},
"required": [
"op",
"nodeId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "rename_component"
},
"componentId": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"op",
"componentId",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "delete_component"
},
"componentId": {
"type": "string"
}
},
"required": [
"op",
"componentId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"op": {
"type": "string",
"const": "set_instance_prop"
},
"nodeId": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {
"type": [
"string",
"number",
"boolean"
]
}
},
"required": [
"op",
"nodeId",
"key",
"value"
],
"additionalProperties": false
}
]
}
},
"baseVersion": {
"description": "Version from get_page_context/get_site_context. Supply it to be refused rather than overwrite somebody else's concurrent edit.",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"siteId",
"operations"
]
}