[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fpages\u002Fblocks\u002Fcopy":3,"docs-tabs-entities\u002Fpages\u002Fblocks\u002Fcopy":6},{"content":4,"lastmod":5},"## Copy a block\n\n`POST \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks\u002F:blockId\u002Fcopy`\n\nCreates a copy of a block on the same page or on another page, leaving the source block unchanged. The copy gets a new ID.\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 in the draft of page `pageId`. List: [`GET \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks`](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Flist) without the `version` parameter. For a block from another page, a block in the trash or an ID from the published version, the response is `404` |\n| `scope` (query) | string | no | Site type: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup site, `MAINPAGE` — main page. Omit the parameter for pages of other sites |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|----------|\n| `toPageId` | number | no | ID of the page that receives the copy. List: [`GET \u002Fv1\u002Fpages`](\u002Fdocs\u002Fentities\u002Fpages\u002Flist). Without the field, the copy is placed on page `pageId` |\n| `afterBlockId` | number | no | ID of the block on page `toPageId`, or on page `pageId` when `toPageId` is omitted, after which the copy is placed. List: [`GET \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks`](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Flist). Without the field, the copy is placed last on the page |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F2417\u002Fblocks\u002F29451\u002Fcopy\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F2417\u002Fblocks\u002F29451\u002Fcopy\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst response = await fetch(\"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F2417\u002Fblocks\u002F29451\u002Fcopy\", {\n  method: \"POST\",\n  headers: {\"X-Api-Key\": \"YOUR_API_KEY\", \"Content-Type\": \"application\u002Fjson\"},\n  body: JSON.stringify({}),\n})\nconst result = await response.json()\nif (!response.ok) throw new Error(result.error.message)\nconsole.log(result.data)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst response = await fetch(\"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fpages\u002F2417\u002Fblocks\u002F29451\u002Fcopy\", {\n  method: \"POST\",\n  headers: {\"X-Api-Key\": \"YOUR_APP_KEY\", \"Authorization\": \"Bearer USER_SESSION_TOKEN\", \"Content-Type\": \"application\u002Fjson\"},\n  body: JSON.stringify({}),\n})\nconst result = await response.json()\nif (!response.ok) throw new Error(result.error.message)\nconsole.log(result.data)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | Always `true` on success. The HTTP status of the response is `201 Created` |\n| `data.blockId` | number | ID of the block copy |\n| `data.pageId` | number | ID of the page that holds the copy |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"blockId\": 29459,\n    \"pageId\": 2417\n  }\n}\n```\n\n## Error response example\n\n400 — block `afterBlockId` is not on page `toPageId`:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"afterBlockId must belong to the destination page.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_PARAMS` | `Destination ids must be positive safe integers.` — `toPageId` or `afterBlockId` is not a positive integer |\n| 400 | `INVALID_PARAMS` | `afterBlockId must belong to the destination page.` — block `afterBlockId` is not on the page that receives the block |\n| 400 | `INVALID_PARAMS` | `Path ids must be positive safe integers.` — `pageId` or `blockId` is not a positive integer |\n| 400 | `INVALID_PARAMS` | `Body must be a JSON object.` — the body is not a JSON object |\n| 400 | `INVALID_PARAMS` | `Unsupported body field.` — the body contains a field that is not in the Request fields (body) table |\n| 400 | `FST_ERR_CTP_EMPTY_JSON_BODY` | The `Content-Type: application\u002Fjson` header is sent with an empty body. Send a `{}` body or drop the header |\n| 400 | `INVALID_SCOPE` | `scope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted.` — `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |\n| 404 | `ENTITY_NOT_FOUND` | `Blocks not found on this page.` — the block is not in the draft of page `pageId`: it belongs to another page, is in the trash, was deleted, the ID comes from the published version, or page `pageId` does not exist. The IDs of such blocks are listed in `error.blockIds` |\n| 404 | `ENTITY_NOT_FOUND` | `Page or block not found.` — page `toPageId` does not exist |\n| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 returned an invalid block descriptor; the action cannot be confirmed.` — Bitrix24 returned a block descriptor that could not be parsed |\n| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 did not return the expected block id.` — Bitrix24 did not return the ID of the copy |\n| 422 | `BITRIX_NO_EFFECT` | `Block destination could not be confirmed.` — after the write, the copy was not found on page `toPageId` |\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the action. The error text comes from Bitrix24 |\n| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. The request is rejected before Bitrix24 is called |\n| 403 | `BITRIX_ACCESS_DENIED` | The Bitrix24 user the key is issued for has no permission to edit the page |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |\n| 401 | `INVALID_API_KEY` | The key in `X-Api-Key` is not found or has been revoked |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is not available on the Bitrix24 account |\n| 409 | `PORTAL_ADDRESS_CHANGED` | A self-hosted Bitrix24 moved to a new address, but the key's webhook was issued for the old one. Reissue the key's webhook |\n| 429 | `RATE_LIMITED` | The Bitrix24 request limit is exceeded. Retry the request in 1-2 seconds |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 did not respond, returned a server error, or sent a response larger than 8 MiB |\n| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **The copy inherits visibility.** A copy of a hidden block is hidden too. To show it, call [`POST \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks\u002F:blockId\u002Fshow`](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Fshow).\n- **A failure after the write does not cancel the copy.** Responses `422 BITRIX_NO_EFFECT`, `429`, `502` and `503` do not mean that no copy was created, and a retry creates another copy. Before retrying, re-read the page blocks with [`GET \u002Fv1\u002Fpages\u002F:pageId\u002Fblocks`](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Flist).\n- **The call changes the draft of the page that holds the copy.** Site visitors see the change after the page is published with `POST \u002Fv1\u002Fpages\u002F:id\u002Fpublication`. See [Pages](\u002Fdocs\u002Fentities\u002Fpages) for details.\n\n## See also\n\n- [Move a block](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Fmove)\n- [Hide a block](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Fhide)\n- [List page blocks](\u002Fdocs\u002Fentities\u002Fpages\u002Fblocks\u002Flist)\n- [Pages](\u002Fdocs\u002Fentities\u002Fpages)\n- [Errors](\u002Fdocs\u002Ferrors)\n","2026-10-20",{},1795376954638]