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 Disk. Accepts only the name field — other file fields stay unchanged, and the file location does not change.
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | ✓ | New file name with extension |
Examples
curl — personal key
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 app
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
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 app
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
Returns the full file object with the updated name. The field set matches the GET /v1/files/:id response.
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.id |
number | File identifier |
data.name |
string | New file name |
data.code |
string|null | Symbolic file code |
data.storageId |
number | Storage ID |
data.type |
string | Object type — always "file" |
data.folderId |
number | Parent folder ID |
data.deletedType |
number | Deletion status: 0 — active |
data.globalContentVersion |
number | File version counter |
data.fileId |
number | Internal file ID in Bitrix24 |
data.size |
number | File size in bytes |
data.createdBy |
number | Creator user ID |
data.updatedBy |
number | ID of the user who performed the rename |
data.deletedBy |
number|null | ID of the user who deleted the file; null — not deleted |
data.createdAt |
string | Creation date and time (ISO 8601) |
data.updatedAt |
string | Rename date and time (ISO 8601) |
data.deletedAt |
string|null | Deletion date; null — file not deleted |
data.contentProvider |
string | Content provider (may be absent) |
data.realObjectId |
number | Internal object ID |
data.downloadUrl |
string | File download link |
data.detailUrl |
string | Link to the file in the Bitrix24 interface |
Response example
{
"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://example.bitrix24.com/disk/downloadFile/34867/?...",
"detailUrl": "https://example.bitrix24.com/company/personal/user/1/disk/file/doc-renamed.txt/"
}
}
Error response example
404 — file not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "diskFile 9251 not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 404 | ENTITY_NOT_FOUND |
File with the given id does not exist |
| 400 | MISSING_FIELDS |
Request body does not contain the name field |
| 403 | SCOPE_DENIED |
Key lacks the disk scope |
| 401 | TOKEN_MISSING |
Key has no configured authorization tokens |
| 401 | INVALID_API_KEY |
Invalid or expired API key |
Full list of common API errors — Error codes.