[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fpages\u002Fblock-nodes":3,"docs-tabs-entities\u002Fpages\u002Fblock-nodes":6},{"content":4,"lastmod":5},"## Change block text and images\n\n`PATCH \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks\u002F:blockId\u002Fnodes`\n\nChanges the content of a page block's nodes: text, images and links.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `pageId` (path) | number | yes | Page ID. List: [`GET \u002Fv1\u002Fpages`](\u002Fdocs\u002Fentities\u002Fpages\u002Flist) |\n| `blockId` (path) | number | yes | ID of a block on this page. List: [`GET \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks`](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Flist) |\n| `scope` (query) | string | no | Site area: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup pages, `MAINPAGE` — main pages. Omit the parameter for pages of all other sites |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|----------|\n| `nodes` | object | yes | A \"selector → value\" object with at least one pair. A selector is `.class` or `.class@N`, where `N` is a zero-based index among the nodes with this class. Without `@N` the value is written to every node with this class. The available selectors and the type of each node are in the `nodes` field of the [`GET \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks\u002F:blockId\u002Fcontent`](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-content) response |\n| `nodes.\u003Cselector>` — text node | string \\| integer \\| object | — | A string, an integer, or an object `{\"text\": \"…\"}` with a string or an integer in `text`. A fractional number is rejected |\n| `nodes.\u003Cselector>` — image | object | — | `src` — image URL, `alt` — alternative text. The URL of your own image is returned in the `data.url` field of the [Upload an image to a block](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-files) method |\n| `nodes.\u003Cselector>` — link | object | — | `href` — link URL, `text` — link text, `target` — where to open the link, `_blank` opens a new tab |\n\nAn empty object or an empty array is not accepted as a value. The keys `attrs`, `dynamicState`, `dynamicBlock` and `dynamicParams` are accepted neither as a selector nor inside a value.\n\nValues for an image and for a link:\n\n```json\n{\n  \"nodes\": {\n    \".landing-block-node-img\": { \"src\": \"https:\u002F\u002Fcdn.example.com\u002Flanding\u002F2e8\u002Fpixel.png\", \"alt\": \"Cover\" },\n    \".landing-block-node-button\": { \"href\": \"https:\u002F\u002Fexample.com\u002Fsale\", \"text\": \"Buy now\", \"target\": \"_blank\" }\n  }\n}\n```\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F42\u002Fblocks\u002F7\u002Fnodes\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"nodes\": {\n      \".landing-block-node-title\": \"Spring sale\"\n    }\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F42\u002Fblocks\u002F7\u002Fnodes\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"nodes\": {\n      \".landing-block-node-title\": \"Spring sale\"\n    }\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F42\u002Fblocks\u002F7\u002Fnodes', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    nodes: {\n      '.landing-block-node-title': 'Spring sale',\n    },\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F42\u002Fblocks\u002F7\u002Fnodes', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    nodes: {\n      '.landing-block-node-title': 'Spring sale',\n    },\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | `true` on success |\n| `data.id` | number | Block ID |\n| `data.pageId` | number | Page ID |\n| `data.anchor` | string | Block anchor. An automatic anchor has the form `b\u003Cid>`, for example `b7` |\n| `data.content` | string | The full block HTML, read back after the change |\n| `data.nodes` | object | Empty object. The block state is in `content` |\n| `data.styles` | object | Empty object. The block state is in `content` |\n| `data.attrs` | object | Empty object. The block state is in `content` |\n| `data.cards` | object | Empty object. The block state is in `content` |\n| `data.active` | boolean | Whether the block is active |\n\n## Response example\n\nThe paragraph text in `content` is shortened with an ellipsis, and the markup is unchanged.\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 7,\n    \"pageId\": 42,\n    \"anchor\": \"b7\",\n    \"content\": \"\u003Cdiv id=\\\"block7\\\" data-id=\\\"7\\\" class=\\\"block-wrapper block-27-one-col-fix-title-and-text-2\\\">\u003Csection class=\\\"landing-block js-animation g-pt-30 g-pb-30\\\">\\r\\n\\t\u003Cdiv class=\\\"landing-block-node-text-container container g-max-width-container\\\">\\r\\n\\t\\t\u003Ch2 class=\\\"landing-block-node-title js-animation fadeIn g-mb-20 g-color\\\">Spring sale\u003C\u002Fh2>\\r\\n\\t\\t\u003Cdiv class=\\\"landing-block-node-text js-animation g-mb-20 g-pb-1 g-color\\\">\\r\\n\\t\\t\\tSed feugiat porttitor nunc, non dignissim ipsum vestibulum in. …\\r\\n\\t\\t\u003C\u002Fdiv>\\r\\n\\t\u003C\u002Fdiv>\\r\\n\u003C\u002Fsection>\u003C\u002Fdiv>\",\n    \"nodes\": {},\n    \"styles\": {},\n    \"attrs\": {},\n    \"cards\": {},\n    \"active\": true\n  }\n}\n```\n\n## Error response example\n\n400 — a text node received an object without a `text` field:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Text nodes require a string, integer or an object with text\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Marker in `error.message` | Description |\n|------|-----|--------------------------|----------|\n| 400 | `INVALID_PARAMS` | `pageId and blockId must be positive safe integers` | `pageId` or `blockId` is not a positive integer |\n| 400 | `INVALID_SCOPE` | `scope must be KNOWLEDGE, GROUP or MAINPAGE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |\n| 400 | `MISSING_REQUIRED_FIELDS` | `Required fields: nodes` | The body has no `nodes` field |\n| 400 | `MISSING_REQUIRED_FIELDS` | `A JSON object is required` | The body is not a JSON object |\n| 400 | `MISSING_REQUIRED_FIELDS` | `nodes must be a non-empty selector map` | `nodes` is an empty object or not an object |\n| 400 | `INVALID_PARAMS` | `Unexpected body field` | The body has a field other than `nodes` |\n| 400 | `INVALID_PARAMS` | `Selectors must be .class or .class@N` | A selector is not in the `.class` or `.class@N` format, including the service key `attrs` in place of a selector |\n| 400 | `INVALID_PARAMS` | `Service node fields are not accepted` | The value object has an `attrs`, `dynamicState`, `dynamicBlock` or `dynamicParams` key |\n| 400 | `INVALID_PARAMS` | `Node values must not be empty objects or arrays` | The value is an empty object or an empty array |\n| 400 | `INVALID_PARAMS` | `Each node value must be a string, integer, object or array` | The value is a fractional number, `null` or a boolean |\n| 400 | `INVALID_PARAMS` | `Text nodes require a string, integer or an object with text` | The text node value is neither a string, an integer, nor an object with a string or an integer in `text` |\n| 400 | `INVALID_PARAMS` | `Unknown selector or index. Available selectors: …` | The block has no such selector, or the `@N` index exceeds the number of nodes with this class. The message lists the available selectors |\n| 401 | `TOKEN_MISSING` | — | The API key has no Bitrix24 access tokens |\n| 403 | `SCOPE_DENIED` | — | The key has no `landing` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | — | The key is read-only. The request is rejected before the Bitrix24 account is called |\n| 404 | `ENTITY_NOT_FOUND` | `Page or block not found` | The page does not exist, the block does not exist, or the block belongs to another page |\n| 404 | `ENTITY_NOT_FOUND` | — | The change was accepted, but the block could not be read back after it |\n| 409 | `LANDING_MODULE_NOT_ENABLED` | — | The Sites module is not enabled on the Bitrix24 account |\n| 409 | `PORTAL_ADDRESS_CHANGED` | — | A self-hosted Bitrix24 portal moved to a new address, but the key's webhook was issued for the old one. Reissue the key's webhook |\n| 422 | `BITRIX_ERROR` | `Bitrix24 did not confirm the block operation` | Bitrix24 did not confirm the block change |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **Scripts and event handlers are neutralized without an error.** The string `Hi\u003Cscript>alert(1)\u003C\u002Fscript>\u003Cb onclick=\"x()\">bold\u003C\u002Fb>` gets a `200` response but is saved modified: `Hi\u003Csc ript=\"\">alert(1)\u003Cb oncl=\"\" ick=\"x()\">bold\u003C\u002Fb>\u003C\u002Fsc>`. `script` tags and `on*` attributes stop working, and the text stays on the page in modified form. Check what was actually saved in `data.content`.\n\n## See also\n\n- [Upload an image to a block](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-files)\n- [Change block styles](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-styles)\n- [Change block attributes](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-attrs)\n- [Change a block node tag](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-tags)\n- [Set a block anchor](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-anchor)\n- [Publish a block](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-publication)\n- [Read block content](\u002Fdocs\u002Fentities\u002Fpages\u002Fblock-content)\n- [List page blocks](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Flist)\n- [Pages](\u002Fdocs\u002Fentities\u002Fpages)\n","2026-10-20",{},1795415268270]