[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ffiles\u002Fupdate":3,"docs-tabs-entities\u002Ffiles\u002Fupdate":6},{"content":4,"lastmod":5},"## Rename file\n\n`PATCH \u002Fv1\u002Ffiles\u002F:id`\n\nRenames a file on Bitrix24 Drive. The file location and its other fields do not change.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `id` (path) | number | yes | File ID. List: [`GET \u002Fv1\u002Ffiles`](\u002Fdocs\u002Fentities\u002Ffiles\u002Flist) with the required `folderId` |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `name` | string | yes | New file name with extension. The name must be available in the destination folder |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F9251\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"name\": \"doc-renamed.txt\"\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F9251\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"name\": \"doc-renamed.txt\"\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F9251', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    name: 'doc-renamed.txt',\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F9251', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    name: 'doc-renamed.txt',\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\nThe field set matches the `GET \u002Fv1\u002Ffiles\u002F:id` response.\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.id` | number | File identifier |\n| `data.name` | string | New file name |\n| `data.code` | string\\|null | Symbolic file code |\n| `data.storageId` | number | Storage ID |\n| `data.type` | string | Object type — always `\"file\"` |\n| `data.folderId` | number | Parent folder ID |\n| `data.deletedType` | number | Deletion status: `0` — active |\n| `data.globalContentVersion` | number | File version counter |\n| `data.fileId` | number | Internal file ID in Bitrix24 |\n| `data.size` | number | File size in bytes |\n| `data.createdBy` | number | Creator user ID |\n| `data.updatedBy` | number | ID of the user who performed the rename |\n| `data.deletedBy` | number\\|null | ID of the user who deleted the file. `null` — not deleted |\n| `data.createdAt` | string | Creation date and time (ISO 8601) |\n| `data.updatedAt` | string | Rename date and time (ISO 8601) |\n| `data.deletedAt` | string\\|null | Deletion date. `null` — file not deleted |\n| `data.contentProvider` | string | Content provider (may be absent) |\n| `data.realObjectId` | number | Internal object ID |\n| `data.downloadUrl` | string | Vibecode API address that downloads the file, `GET \u002Fv1\u002Ffiles\u002F:id\u002Fdownload`. Send the `X-Api-Key` header when you follow it |\n| `data.detailUrl` | string | Link to the file in the Bitrix24 interface |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 9251,\n    \"name\": \"doc-renamed.txt\",\n    \"code\": null,\n    \"storageId\": 1,\n    \"type\": \"file\",\n    \"folderId\": 27,\n    \"deletedType\": 0,\n    \"globalContentVersion\": 1,\n    \"fileId\": 34867,\n    \"size\": 11,\n    \"createdBy\": 1,\n    \"updatedBy\": 1,\n    \"deletedBy\": null,\n    \"createdAt\": \"2026-05-06T09:32:39.000Z\",\n    \"updatedAt\": \"2026-05-26T07:08:50.000Z\",\n    \"deletedAt\": null,\n    \"downloadUrl\": \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F9251\u002Fdownload\",\n    \"detailUrl\": \"https:\u002F\u002Fexample.bitrix24.com\u002Fcompany\u002Fpersonal\u002Fuser\u002F1\u002Fdisk\u002Ffile\u002Fdoc-renamed.txt\u002F\"\n  }\n}\n```\n\n## Error response example\n\n404 — file not found:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"diskFile 9251 not found\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 404 | `ENTITY_NOT_FOUND` | A file with the given `id` does not exist |\n| 400 | `MISSING_FIELDS` | The request body does not contain the `name` field |\n| 400 | `READONLY_FIELD` | The body carries a read-only field, for example `id` or `size` |\n| 422 | `BITRIX_ERROR` | The name is already taken in the destination folder. `error.b24Code` is `DISK_OBJ_22000`. Choose another name before retrying |\n| 403 | `SCOPE_DENIED` | The key lacks the `disk` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 401 | `TOKEN_MISSING` | The key has no configured authorization tokens |\n| 401 | `INVALID_API_KEY` | The key is not recognized — no such key exists on the platform |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Get file](\u002Fdocs\u002Fentities\u002Ffiles\u002Fget)\n- [File fields](\u002Fdocs\u002Fentities\u002Ffiles\u002Ffields)\n- [Move file](\u002Fdocs\u002Fentities\u002Ffiles\u002Fmoveto)\n- [Delete file](\u002Fdocs\u002Fentities\u002Ffiles\u002Fdelete)\n- [Files](\u002Fdocs\u002Fentities\u002Ffiles)\n","2026-10-13",{},1794739377537]