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 remains unchanged. Copying between different storages is supported as well.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
Parameterid |
Inpath | Typenumber | Requiredyes | DescriptionSource folder ID. Obtain via GET /v1/folders |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
FieldtargetFolderId |
Typenumber | Requiredyes | DescriptionTarget folder ID. Obtain via GET /v1/folders |
Examples
curl — personal key
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
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
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
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 |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on a successful copy |
Fielddata.id |
Typenumber | DescriptionID of the new copied folder — differs from the source |
Fielddata.name |
Typestring | DescriptionName of the copied folder |
Fielddata.code |
Typestring | null | DescriptionSymbolic code of the folder |
Fielddata.parentId |
Typenumber | DescriptionParent folder ID — equals the passed targetFolderId |
Fielddata.storageId |
Typenumber | DescriptionStorage ID |
Fielddata.type |
Typestring | DescriptionObject type — always "folder" |
Fielddata.realObjectId |
Typenumber | DescriptionInternal object ID |
Fielddata.deletedType |
Typenumber | DescriptionDeletion status: 0 — active |
Fielddata.createdBy |
Typenumber | DescriptionID of the user who created the copy |
Fielddata.updatedBy |
Typenumber | DescriptionID of the user who performed the copy |
Fielddata.deletedBy |
Typenumber | DescriptionID of the user who deleted the folder. null — not deleted |
Fielddata.createdAt |
Typestring | DescriptionCopy creation date (ISO 8601) |
Fielddata.updatedAt |
Typestring | DescriptionLast modification date (ISO 8601) |
Fielddata.deletedAt |
Typestring | null | DescriptionDeletion date or null |
Fielddata.detailUrl |
Typestring | DescriptionURL of the copied folder card in Bitrix24 |
Response example
{
"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:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "A folder with this name already exists (DISK_OBJ_22000)."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeMISSING_PARAMS |
DescriptiontargetFolderId is missing |
| HTTP400 | CodeINVALID_PARAMS |
DescriptiontargetFolderId is not a positive integer |
| HTTP400 | CodeINVALID_ID |
DescriptionFolder id is not a positive integer |
| HTTP400 | CodeOPERATION_FAILED |
DescriptionBitrix24 returned an empty result — the copy was not performed |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionNo authorization tokens for the portal |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key is missing the disk scope |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo folder found with the given id |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionA folder with this name already exists in the target folder — rename it via PATCH /v1/folders/:id before copying |
| HTTP429 | CodeRATE_LIMITED |
DescriptionRequest 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 creating a duplicate within a single storage, use moveto.