[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ffiles\u002Fversions":3,"docs-tabs-entities\u002Ffiles\u002Fversions":6},{"content":4,"lastmod":5},"## File version history\n\n`GET \u002Fv1\u002Ffiles\u002F:id\u002Fversions`\n\nReturns the version history of a file on Bitrix24 Drive, newest versions first. Any version from the list can be read, downloaded, or restored by its ID.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|----------|-----|:-----:|-----------|----------|\n| `id` (path) | number | yes | — | File ID. Get it: `GET \u002Fv1\u002Ffiles?folderId=X` |\n| `limit` (query) | number | no | `50` | Number of versions to return, from 1 to 50 |\n| `offset` (query) | number | no | `0` | Number of versions to skip from the start of the history |\n| `filter` (query) | object | no | — | Filtering by the `id`, `size`, `name`, `createdAt`, `createdBy` fields.\u003Cbr>[Filtering syntax](\u002Fdocs\u002Ffiltering). Example: `?filter[size][$gte]=1024` |\n\nPagination: one call returns at most 50 versions. To get the next page, repeat the request with `offset` set to `meta.nextOffset` from the previous response. When `meta.hasMore` is `false`, the whole history has been read.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F205\u002Fversions?limit=10\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F205\u002Fversions?limit=10\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F205\u002Fversions?limit=10', {\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n  },\n})\n\nconst { data, meta } = await res.json()\nfor (const version of data) {\n  console.log(version.id, version.createdAt, version.size, 'bytes')\n}\nconsole.log('More versions available:', meta.hasMore)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F205\u002Fversions?limit=10', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data, meta } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | Always `true` on success |\n| `data` | array | File versions, newest first |\n| `data[].id` | number | Version ID. Used by [`GET \u002Fv1\u002Ffiles\u002F:id\u002Fversions\u002F:versionId`](.\u002Fversion.md) |\n| `data[].fileId` | number | ID of the file the version belongs to |\n| `data[].size` | number | Size of the version content in bytes |\n| `data[].name` | string | File name at the moment the version entered the history. Renaming the file does not change it |\n| `data[].contentGeneration` | number | The file's `globalContentVersion` value at the moment the version was saved |\n| `data[].createdAt` | datetime\\|null | Date and time the version was saved (ISO 8601) |\n| `data[].createdBy` | number | ID of the version author. List: `GET \u002Fv1\u002Fusers` |\n| `data[].downloadUrl` | string | Version download path without the domain — [`GET \u002Fv1\u002Ffiles\u002F:id\u002Fversions\u002F:versionId\u002Fdownload`](.\u002Fversion-download.md). Send the `X-Api-Key` header when you follow it |\n| `meta.total` | number\\|null | Number of versions in the history that match the request |\n| `meta.limit` | number | Page size from the request |\n| `meta.offset` | number | Offset from the request |\n| `meta.hasMore` | boolean | Whether there are versions beyond this page |\n| `meta.nextOffset` | number\\|null | `offset` for the next page. `null` means there is no next page |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": [\n    {\n      \"id\": 412,\n      \"fileId\": 205,\n      \"size\": 10,\n      \"name\": \"report.txt\",\n      \"contentGeneration\": 4,\n      \"createdAt\": \"2026-10-15T17:11:25.000Z\",\n      \"createdBy\": 1,\n      \"downloadUrl\": \"\u002Fv1\u002Ffiles\u002F205\u002Fversions\u002F412\u002Fdownload\"\n    },\n    {\n      \"id\": 410,\n      \"fileId\": 205,\n      \"size\": 10,\n      \"name\": \"report.txt\",\n      \"contentGeneration\": 3,\n      \"createdAt\": \"2026-10-15T17:10:00.000Z\",\n      \"createdBy\": 1,\n      \"downloadUrl\": \"\u002Fv1\u002Ffiles\u002F205\u002Fversions\u002F410\u002Fdownload\"\n    }\n  ],\n  \"meta\": {\n    \"total\": 2,\n    \"limit\": 10,\n    \"offset\": 0,\n    \"hasMore\": false,\n    \"nextOffset\": null\n  }\n}\n```\n\n## Error response example\n\n400 — a filter on a field outside the list:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Use limit 1..50, a non-negative offset and an object filter over id, size, name, createdAt or createdBy.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_PARAMS` | `limit` is outside the 1–50 range, `offset` is below zero, the filter uses a field outside the list, or `filter` is not passed as an object |\n| 400 | `INVALID_PARAMS` | The filter condition key could not be parsed: the `=` sign inside the brackets is not encoded. Send the `filter[>=size]` key as `filter%5B%3E%3Dsize%5D` |\n| 400 | `INVALID_ID` | `id` is not a positive integer |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |\n| 401 | `TOKEN_MISSING` | Bitrix24 access tokens are unavailable |\n| 403 | `SCOPE_DENIED` | The key lacks the `disk` scope |\n| 403 | `DISK_HISTORY_UNAVAILABLE` | Version history is not available on the Bitrix24 account plan |\n| 404 | `ENTITY_NOT_FOUND` | No file with this `id` exists, or the key cannot access it |\n| 422 | `DISK_VERSION_REFUSED` | Bitrix24 did not return the file history |\n| 502 | `DISK_READ_UNAVAILABLE` | Bitrix24 returned versions of a different file in the history; the response was discarded |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **The first version appears when the file is created.** A freshly uploaded file already has one version in its history, holding the original content.\n- **An upload does not always add a version.** If the same user changed the file less than five minutes ago, the new content overwrites the latest version: its `id` stays the same, while `size`, `contentGeneration`, and `createdAt` are updated. The previous content of that version is lost from the history, so there can be fewer versions than uploads. Details — [`POST \u002Fv1\u002Ffiles\u002F:id\u002Fversions`](.\u002Fversion-upload.md).\n- **Versions are ordered by `createdAt` with one-second precision.** Versions saved within the same second may not appear in the order they were saved. `contentGeneration` gives the exact order: a version saved later has a higher value.\n- **History is limited.** How many versions are kept and for how long depends on the plan and settings of the Bitrix24 account. When a new version exceeds the limit, the oldest version is removed from the history.\n\n## See also\n\n- [Read a file version](\u002Fdocs\u002Fentities\u002Ffiles\u002Fversion)\n- [Download a file version](\u002Fdocs\u002Fentities\u002Ffiles\u002Fversion-download)\n- [Restore content from a version](\u002Fdocs\u002Fentities\u002Ffiles\u002Fversion-restore)\n- [Upload a new file version](\u002Fdocs\u002Fentities\u002Ffiles\u002Fversion-upload)\n- [Get file](\u002Fdocs\u002Fentities\u002Ffiles\u002Fget)\n- [Files](\u002Fdocs\u002Fentities\u002Ffiles)\n","2026-10-15",{},1795415250531]