## Read a file version

`GET /v1/files/:id/versions/:versionId`

Returns a single file version by its ID: size, author, save time, and the path to download its content.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | File ID. Get it: `GET /v1/files?folderId=X` |
| `versionId` (path) | number | yes | ID of a version of this file. List: [`GET /v1/files/:id/versions`](./versions.md) |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/files/205/versions/410" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/files/205/versions/410" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/205/versions/410', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { data } = await res.json()
console.log('Version', data.id, '—', data.size, 'bytes, saved', data.createdAt)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/205/versions/410', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data.id` | number | Version ID |
| `data.fileId` | number | ID of the file the version belongs to |
| `data.size` | number | Size of the version content in bytes |
| `data.name` | string | File name at the moment the version entered the history. Renaming the file does not change it |
| `data.contentGeneration` | number | The file's `globalContentVersion` value at the moment the version was saved |
| `data.createdAt` | datetime\|null | Date and time the version was saved (ISO 8601) |
| `data.createdBy` | number | ID of the version author. List: `GET /v1/users` |
| `data.downloadUrl` | string | Version download path without the domain — [`GET /v1/files/:id/versions/:versionId/download`](./version-download.md). Send the `X-Api-Key` header when you follow it |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 410,
    "fileId": 205,
    "size": 10,
    "name": "report.txt",
    "contentGeneration": 3,
    "createdAt": "2026-10-15T17:10:00.000Z",
    "createdBy": 1,
    "downloadUrl": "/v1/files/205/versions/410/download"
  }
}
```

## Error response example

404 — this file has no such version:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "File version not found."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `ENTITY_NOT_FOUND` | The version with this `versionId` does not exist, was removed from the history, or belongs to a different file |
| 400 | `INVALID_ID` | `id` or `versionId` is not a positive integer |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | Bitrix24 access tokens are unavailable |
| 403 | `SCOPE_DENIED` | The key lacks the `disk` scope |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **The content of the latest version can change while its ID stays the same.** If the same user changed the file less than five minutes ago, a new upload overwrites the latest version: `versionId` stays the same, while `size`, `contentGeneration`, and `createdAt` are updated. Details — [`POST /v1/files/:id/versions`](./version-upload.md).
- **A version can disappear from the history.** The number of versions is limited by the plan and settings of the Bitrix24 account; the oldest version over the limit is removed together with its `versionId`. Before using a previously saved `versionId`, check it against the [`GET /v1/files/:id/versions`](./versions.md) list.

## See also

- [File version history](/docs/entities/files/versions)
- [Download a file version](/docs/entities/files/version-download)
- [Restore content from a version](/docs/entities/files/version-restore)
- [Get file](/docs/entities/files/get)
