For AI agents: markdown of this page — /docs-content-en/entities/folders/copyto.md documentation index — /llms.txt

Copy folder

POST /v1/folders/:id/copyto

Copies a folder with all its content into another parent folder. Returns a new folder with a new id. The source folder is not changed. Copying works between different storages as well.

Parameters

Parameter In Type Required Description
id path number yes Source folder ID. Obtain via GET /v1/folders

Request fields (body)

Field Type Required Description
targetFolderId number yes Target folder ID. Obtain via GET /v1/folders

Examples

curl — personal key

Terminal
curl -X POST \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"targetFolderId":649}' \
  https://vibecode.bitrix24.com/v1/folders/9297/copyto

curl — OAuth application

Terminal
curl -X POST \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"targetFolderId":649}' \
  https://vibecode.bitrix24.com/v1/folders/9297/copyto

JavaScript — personal key

javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/folders/9297/copyto',
  {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ targetFolderId: 649 }),
  }
)
const body = await res.json()
if (!body.success) throw new Error(body.error.code)
console.log('Copy created, new id:', body.data.id)

JavaScript — OAuth application

javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/folders/9297/copyto',
  {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ targetFolderId: 649 }),
  }
)
const body = await res.json()

Response fields

Field Type Description
success boolean true on a successful copy
data.id number ID of the new copied folder — differs from the source
data.name string Name of the copied folder
data.code string | null Symbolic code of the folder
data.parentId number Parent folder ID — equals the passed targetFolderId
data.storageId number Storage ID
data.type string Object type — always "folder"
data.realObjectId number Internal object ID
data.deletedType number Deletion status: 0 — active
data.createdBy number ID of the user who created the copy
data.updatedBy number ID of the user who performed the copy
data.deletedBy number ID of the user who deleted the folder. null — not deleted
data.createdAt string Copy creation date (ISO 8601)
data.updatedAt string Last modification date (ISO 8601)
data.deletedAt string | null Deletion date or null
data.detailUrl string URL of the copied folder card in Bitrix24

Response example

JSON
{
  "success": true,
  "data": {
    "id": 9301,
    "name": "Documents",
    "code": null,
    "storageId": 1,
    "type": "folder",
    "realObjectId": 9301,
    "parentId": 649,
    "deletedType": 0,
    "createdAt": "2026-06-25T12:50:10.000Z",
    "updatedAt": "2026-06-25T12:50:10.000Z",
    "deletedAt": null,
    "createdBy": 1,
    "updatedBy": 1,
    "deletedBy": null,
    "detailUrl": "https://<portal>.bitrix24.com/company/personal/user/1/disk/path/Archive/Documents"
  }
}

Error response example

422 — a folder with this name already exists in the target folder:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "A folder with this name already exists (DISK_OBJ_22000)."
  }
}

Errors

HTTP Code Description
400 MISSING_PARAMS targetFolderId was not passed
400 INVALID_PARAMS targetFolderId is not a positive integer
400 INVALID_ID Folder id is not a positive integer
400 OPERATION_FAILED Bitrix24 returned an empty result — the copy was not performed
401 TOKEN_MISSING No authorization tokens for the portal
403 SCOPE_DENIED The key is missing the disk scope
404 ENTITY_NOT_FOUND No folder found with the given id
422 BITRIX_ERROR A folder with this name already exists in the target folder — rename it via PATCH /v1/folders/:id before copying
429 RATE_LIMITED Request rate limit exceeded — wait 1-2 seconds and retry

For the full list of common API errors, see Errors.

Known specifics

The copy is an independent folder. The copy has its own id, createdAt, and createdBy. The source folder stays in place. The entire nested structure is copied. To move a folder without a duplicate within a single storage, use moveto.

See also