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

Rename file

PATCH /v1/files/:id

Renames a file on Bitrix24 Drive. The file location and its other fields do not change.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionFile ID. List: GET /v1/files with the required folderId

Request fields (body)

Field Type Required Description
Fieldname Typestring Requiredyes DescriptionNew file name with extension. The name must be available in the destination folder

Examples

curl — personal key

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/files/9251" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "doc-renamed.txt"
  }'

curl — OAuth application

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/files/9251" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "doc-renamed.txt"
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/9251', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'doc-renamed.txt',
  }),
})

const { success, data } = await res.json()

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/9251', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'doc-renamed.txt',
  }),
})

const { success, data } = await res.json()

Response fields

The field set matches the GET /v1/files/:id response.

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.id Typenumber DescriptionFile identifier
Fielddata.name Typestring DescriptionNew file name
Fielddata.code Typestring|null DescriptionSymbolic file code
Fielddata.storageId Typenumber DescriptionStorage ID
Fielddata.type Typestring DescriptionObject type — always "file"
Fielddata.folderId Typenumber DescriptionParent folder ID
Fielddata.deletedType Typenumber DescriptionDeletion status: 0 — active
Fielddata.globalContentVersion Typenumber DescriptionFile version counter
Fielddata.fileId Typenumber DescriptionInternal file ID in Bitrix24
Fielddata.size Typenumber DescriptionFile size in bytes
Fielddata.createdBy Typenumber DescriptionCreator user ID
Fielddata.updatedBy Typenumber DescriptionID of the user who performed the rename
Fielddata.deletedBy Typenumber|null DescriptionID of the user who deleted the file. null — not deleted
Fielddata.createdAt Typestring DescriptionCreation date and time (ISO 8601)
Fielddata.updatedAt Typestring DescriptionRename date and time (ISO 8601)
Fielddata.deletedAt Typestring|null DescriptionDeletion date. null — file not deleted
Fielddata.contentProvider Typestring DescriptionContent provider (may be absent)
Fielddata.realObjectId Typenumber DescriptionInternal object ID
Fielddata.downloadUrl Typestring DescriptionVibecode API address that downloads the file, GET /v1/files/:id/download. Send the X-Api-Key header when you follow it
Fielddata.detailUrl Typestring DescriptionLink to the file in the Bitrix24 interface

Response example

JSON
{
  "success": true,
  "data": {
    "id": 9251,
    "name": "doc-renamed.txt",
    "code": null,
    "storageId": 1,
    "type": "file",
    "folderId": 27,
    "deletedType": 0,
    "globalContentVersion": 1,
    "fileId": 34867,
    "size": 11,
    "createdBy": 1,
    "updatedBy": 1,
    "deletedBy": null,
    "createdAt": "2026-05-06T09:32:39.000Z",
    "updatedAt": "2026-05-26T07:08:50.000Z",
    "deletedAt": null,
    "downloadUrl": "https://vibecode.bitrix24.com/v1/files/9251/download",
    "detailUrl": "https://example.bitrix24.com/company/personal/user/1/disk/file/doc-renamed.txt/"
  }
}

Error response example

404 — file not found:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "diskFile 9251 not found"
  }
}

Errors

HTTP Code Description
HTTP404 CodeENTITY_NOT_FOUND DescriptionA file with the given id does not exist
HTTP400 CodeMISSING_FIELDS DescriptionThe request body does not contain the name field
HTTP400 CodeREADONLY_FIELD DescriptionThe body carries a read-only field, for example id or size
HTTP422 CodeBITRIX_ERROR DescriptionThe name is already taken in the destination folder. error.b24Code is DISK_OBJ_22000. Choose another name before retrying
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the disk scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only — see access rights
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no configured authorization tokens
HTTP401 CodeINVALID_API_KEY DescriptionThe key is not recognized — no such key exists on the platform

Full list of common API errors — Errors.

See also