{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "POST /v2/apply_component_changes request",
  "$comment": "Preview Automation API v2 parser contract, documented 2026-11-05. Runtime permissions, revisions, value rules and work limits are checked separately.",
  "type": "object",
  "properties": {
    "validateOnly": {
      "type": "boolean"
    },
    "changes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "action"
        ],
        "anyOf": [
          {
            "properties": {
              "action": {
                "const": "createFromLayers"
              },
              "clientId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "layerIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "placement": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "pageId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "index": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "x": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "y": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                },
                "additionalProperties": false
              }
            },
            "required": [
              "layerIds"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "updateDefinition"
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "patch": true
            },
            "required": [
              "component",
              "patch"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "rename"
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "component",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "delete"
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "policy": {
                "type": "string"
              }
            },
            "required": [
              "component"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "combineStates"
              },
              "clientId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "components": {
                "type": "array"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "components"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "createState"
              },
              "clientId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "component",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "renameState"
              },
              "state": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "state",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "deleteState"
              },
              "state": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "replacement": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "policy": {
                "type": "string"
              }
            },
            "required": [
              "state"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "moveToComponentsPage"
              },
              "components": {
                "type": "array"
              }
            },
            "required": [
              "components"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "createProperty"
              },
              "clientId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "property": {
                "type": "object",
                "required": [
                  "type"
                ],
                "anyOf": [
                  {
                    "properties": {
                      "type": {
                        "const": "bool"
                      },
                      "initialValue": {
                        "type": "boolean"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "initialValue",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "type": {
                        "const": "text"
                      },
                      "initialValue": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "initialValue",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "type": {
                        "const": "swap"
                      },
                      "initialValue": {
                        "type": "object",
                        "oneOf": [
                          {
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": [
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "properties": {
                              "clientRef": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": [
                              "clientRef"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "allowedValues": {
                        "type": "array"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "initialValue",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "type": {
                        "const": "slot"
                      },
                      "initialValue": {
                        "type": "object",
                        "oneOf": [
                          {
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": [
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "properties": {
                              "clientRef": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": [
                              "clientRef"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "allowedValues": {
                        "type": "array"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "initialValue",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "type": {
                        "const": "state"
                      },
                      "initialValue": {
                        "type": "string"
                      },
                      "allowedValues": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "initialValue",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "component",
              "property"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "updateProperty"
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "property": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "initialValue": {
                "type": [
                  "object",
                  "null"
                ],
                "required": [
                  "kind"
                ],
                "anyOf": [
                  {
                    "properties": {
                      "kind": {
                        "const": "bool"
                      },
                      "value": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "kind": {
                        "const": "text"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "kind": {
                        "const": "component"
                      },
                      "component": {
                        "type": "object",
                        "oneOf": [
                          {
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": [
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "properties": {
                              "clientRef": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": [
                              "clientRef"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "component"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "kind": {
                        "const": "state"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "value"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "allowedComponents": {
                "type": [
                  "array",
                  "null"
                ]
              },
              "allowedStates": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "component",
              "property"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "deleteProperty"
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "property": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "component",
              "property"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "createInstances"
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "instances": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "clientId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "placement": {
                      "type": "object",
                      "properties": {
                        "pageId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "parentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "index": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "x": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "y": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "component",
              "instances"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "swapInstances"
              },
              "instances": {
                "type": "array"
              },
              "component": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "properties": {
                      "clientRef": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "clientRef"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "instances",
              "component"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "setInstanceProperties"
              },
              "instances": {
                "type": "array"
              },
              "properties": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "property": {
                      "type": "object",
                      "oneOf": [
                        {
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": [
                            "id"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "properties": {
                            "clientRef": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": [
                            "clientRef"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "value": {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "anyOf": [
                        {
                          "properties": {
                            "kind": {
                              "const": "bool"
                            },
                            "value": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "properties": {
                            "kind": {
                              "const": "text"
                            },
                            "value": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "properties": {
                            "kind": {
                              "const": "component"
                            },
                            "component": {
                              "type": "object",
                              "oneOf": [
                                {
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 128
                                    }
                                  },
                                  "required": [
                                    "id"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "properties": {
                                    "clientRef": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 128
                                    }
                                  },
                                  "required": [
                                    "clientRef"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "component"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "properties": {
                            "kind": {
                              "const": "state"
                            },
                            "value": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "property",
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "instances",
              "properties"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "removeOverrides"
              },
              "instances": {
                "type": "array"
              },
              "properties": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "instances"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "detachInstances"
              },
              "instances": {
                "type": "array"
              }
            },
            "required": [
              "instances"
            ],
            "additionalProperties": false
          },
          {
            "properties": {
              "action": {
                "const": "deepDetachInstances"
              },
              "instances": {
                "type": "array"
              }
            },
            "required": [
              "instances"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "expectedRevision": {
      "type": "string"
    },
    "requestId": {
      "type": "string"
    },
    "documentHandle": {
      "type": "string"
    }
  },
  "required": [
    "changes",
    "expectedRevision",
    "requestId",
    "documentHandle"
  ],
  "additionalProperties": false
}
