# Hosting site page patch

`POST /hosting/sites/{id}/pages/{page}/patch` · Rivier · hosting

Apply operations (set, unset, insert, remove, move) to blocks by id against a version. Answers applied, preview, proposed (an AI edit of a live page), refused (locks), clash (choose ours or theirs per field) or invalid.

- Scope: hosting:write
- Mcp: rivier_site_page_patch
- Graphql: Mutation.hostingSitePagePatch
- Sdk: hosting.sitePage.patch
- Cli: hosting site page patch

## Parameters

- `id` (path, required), string
- `page` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "ops": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "op": {
                "type": "string",
                "const": "set"
              },
              "block": {
                "type": "string"
              },
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "value": {},
              "origin": {
                "type": "string",
                "enum": [
                  "human",
                  "ai",
                  "template"
                ]
              }
            },
            "required": [
              "op",
              "block",
              "path"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "op": {
                "type": "string",
                "const": "unset"
              },
              "block": {
                "type": "string"
              },
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "origin": {
                "type": "string",
                "enum": [
                  "human",
                  "ai",
                  "template"
                ]
              }
            },
            "required": [
              "op",
              "block",
              "path"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "op": {
                "type": "string",
                "const": "insert"
              },
              "block": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_-]{0,39}$"
                  },
                  "parent": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "default": null
                  },
                  "slot": {
                    "type": "string",
                    "maxLength": 24,
                    "default": "children"
                  },
                  "type": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "v": {
                    "type": "string"
                  },
                  "props": {
                    "type": "object",
                    "additionalProperties": {},
                    "default": {}
                  },
                  "bindings": {
                    "type": "object",
                    "additionalProperties": {},
                    "default": {}
                  },
                  "origin": {
                    "type": "string",
                    "enum": [
                      "human",
                      "ai",
                      "template"
                    ],
                    "default": "human"
                  },
                  "locked": {
                    "type": "boolean",
                    "default": false
                  },
                  "lockedProps": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "id",
                  "type"
                ],
                "additionalProperties": false
              },
              "index": {
                "type": "integer",
                "minimum": 0
              },
              "descendants": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_-]{0,39}$"
                    },
                    "parent": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "default": null
                    },
                    "slot": {
                      "type": "string",
                      "maxLength": 24,
                      "default": "children"
                    },
                    "type": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "v": {
                      "type": "string"
                    },
                    "props": {
                      "type": "object",
                      "additionalProperties": {},
                      "default": {}
                    },
                    "bindings": {
                      "type": "object",
                      "additionalProperties": {},
                      "default": {}
                    },
                    "origin": {
                      "type": "string",
                      "enum": [
                        "human",
                        "ai",
                        "template"
                      ],
                      "default": "human"
                    },
                    "locked": {
                      "type": "boolean",
                      "default": false
                    },
                    "lockedProps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "type"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 200
              },
              "origin": {
                "type": "string",
                "enum": [
                  "human",
                  "ai",
                  "template"
                ]
              }
            },
            "required": [
              "op",
              "block"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "op": {
                "type": "string",
                "const": "remove"
              },
              "block": {
                "type": "string"
              }
            },
            "required": [
              "op",
              "block"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "op": {
                "type": "string",
                "const": "move"
              },
              "block": {
                "type": "string"
              },
              "parent": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "slot": {
                "type": "string",
                "maxLength": 24
              },
              "index": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "op",
              "block",
              "parent"
            ],
            "additionalProperties": false
          }
        ]
      },
      "minItems": 1,
      "maxItems": 200
    },
    "base": {
      "type": "integer",
      "minimum": 0
    },
    "note": {
      "type": "string",
      "maxLength": 300
    },
    "resolve": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "enum": [
          "ours",
          "theirs"
        ]
      }
    },
    "dryRun": {
      "type": "boolean"
    }
  },
  "required": [
    "ops",
    "base"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/hosting/sites/{id}/pages/{page}/patch' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "ops": [
    {
      "op": "set",
      "block": "string",
      "path": "string"
    }
  ],
  "base": 0
}'
```
