لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/pages/copy.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Copy a page

POST /v1/pages/:id/copy

Creates a copy of a page together with its blocks. A page in the trash can be copied too. A copy of an active page may be published right away, subject to the plan limits. The destination folder is checked before the copy is created.

Requires the landing scope.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionPage ID. List: GET /v1/pages
Parameterscope (query) Typestring Requiredno DescriptionSite type: KNOWLEDGE — knowledge base, GROUP — workgroup site, MAINPAGE — main page. Omit the parameter for pages of all other sites

Request fields (body)

Field Type Required Description
FieldtoSiteId Typenumber Requiredno DescriptionTarget site ID. List: GET /v1/sites
FieldtoFolderId Typenumber | null Requiredno DescriptionFolder ID on the target site, or on the page's own site when toSiteId is omitted. List: GET /v1/sites/:id/folders. null or 0 — site root
FieldskipSystem Typeboolean Requiredno DescriptionDo not copy the system page flag. Defaults to false

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/pages/2427/copy" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/pages/2427/copy" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

JavaScript — personal key

javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/2427/copy", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)

JavaScript — OAuth application

javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/2427/copy", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionThe page after the action
Fielddata.id Typenumber DescriptionPage ID
Fielddata.siteId Typenumber DescriptionID of the page's site
Fielddata.folderId Typenumber | null DescriptionFolder ID. null — the page is in the site root
Fielddata.title Typestring DescriptionPage title
Fielddata.code Typestring DescriptionPage code in the URL
Fielddata.active Typeboolean DescriptionWhether the page is published
Fielddata.deleted Typestring DescriptionY — the page is in the trash, N — it is not

Response example

Copy created, HTTP status 201 Created:

JSON
{
  "success": true,
  "data": {
    "id": 2429,
    "siteId": 3,
    "folderId": null,
    "title": "Empty page copy",
    "code": "empty-page-copy",
    "active": false,
    "deleted": "N"
  }
}

Error response example

404 — no page with this id:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Page not found."
  }
}

Errors

HTTP Code Description
HTTP404 CodeENTITY_NOT_FOUND DescriptionPage not found. — no page with this id
HTTP404 CodeENTITY_NOT_FOUND DescriptionSite not found. — site toSiteId does not exist
HTTP404 CodeENTITY_NOT_FOUND DescriptionFolder not found in the destination site. — folder toFolderId does not exist on the target site
HTTP404 CodeENTITY_NOT_FOUND DescriptionPage or folder not found. — Bitrix24 did not find the page or folder while performing the action
HTTP400 CodeINVALID_PAGE_ID Descriptionid must be a positive safe integer. — id is not a positive integer
HTTP400 CodeINVALID_PARAMS DescriptionBody must be a JSON object. — the body is not a JSON object
HTTP400 CodeINVALID_PARAMS DescriptionBody contains a field this operation does not accept. — the body contains a field that is not in the request fields table
HTTP400 CodeINVALID_PARAMS DescriptiontoSiteId must be a positive safe integer. — toSiteId is not a positive integer
HTTP400 CodeINVALID_PARAMS DescriptiontoFolderId must be a positive safe integer or null for the root. — toFolderId is not a positive integer, null or 0
HTTP400 CodeINVALID_PARAMS DescriptionskipSystem must be boolean. — skipSystem is not true or false
HTTP400 CodeINVALID_SCOPE Descriptionscope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted. — scope is not KNOWLEDGE, GROUP or MAINPAGE
HTTP422 CodeBITRIX_NO_EFFECT DescriptionBitrix24 did not confirm the page action. — Bitrix24 did not confirm the action
HTTP422 CodeBITRIX_NO_EFFECT DescriptionBitrix24 did not return the page after the action. — the page could not be read after the action
HTTP422 CodeBITRIX_NO_EFFECT DescriptionBitrix24 did not persist the requested page state. — the copy did not end up on the target site or in the target folder
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 rejected the action. The error text comes from Bitrix24
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the landing scope
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionThe Bitrix24 user the key was issued for has no permission for the page action
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only. The request is refused before any call to Bitrix24
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeINVALID_API_KEY DescriptionThe key in X-Api-Key was not found or has been revoked
HTTP409 CodeLANDING_MODULE_NOT_ENABLED DescriptionThe Sites module is unavailable on the Bitrix24 account. Returned when the body contains toSiteId
HTTP409 CodePORTAL_ADDRESS_CHANGED DescriptionThe on-premise Bitrix24 moved to a new address, but the key's webhook was issued for the old one. Reissue the key's webhook
HTTP429 CodeRATE_LIMITED DescriptionThe Bitrix24 request rate limit was exceeded. Retry the request in 1-2 seconds
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 did not respond or returned a server error
HTTP503 CodeBITRIX_TIMEOUT DescriptionBitrix24 did not respond within the allotted time

Full list of common API errors — Errors.

See also