FileVersions
Lists all available versions of a file stored in Box, enabling tracking of file history and access to prior revisions.
Table Specific Information
File Versions contains information about older versions of a file. This table supports only the SELECT operation.
Select
When selecting from the File Versions view, you must specify FileId, or FileId and Id in the WHERE clause.
SELECT * FROM FileVersions WHERE FileId = '1926408231807';
If you're authenticated as an administrator with user impersonation permissions, you can query file versions from multiple user accounts. For example:
SELECT * FROM FileVersions WHERE AsUserId IN (SELECT Id FROM Users);
Note: User impersonation has the following limitations:
- The authenticated user cannot be impersonated unless that user is a service account.
- If the authenticated user is a standard user account, they can only query file versions associated with their account.
- File versions shared with multiple users are only returned for one of the users.
Columns
| Name | Type | Description |
| Id [KEY] | String | The unique identifier of the file version, used to distinguish between different saved versions of the same file. |
| FileId | String | The unique identifier of the parent file that this version belongs to. |
| CreatedAt | Datetime | The timestamp when this version of the file was created. For example, '2023-01-15T10:45:00Z'. |
| ModifiedAt | Datetime | The timestamp when this version of the file was last modified. |
| ModifiedById | String | The Id of the user who last modified this file version. |
| ModifiedByName | String | The display name of the user who last modified this file version. |
| ModifiedByLogin | String | The login (usually email) of the user who last modified this file version. |
| ModifiedByType | String | The type of the user who last modified the file version, such as 'user' or 'service_account'. |
| Name | String | The name of the file associated with this version, including extension (for example, 'Report_Q1.pdf'). |
| PurgedAt | Datetime | The timestamp when this file version was permanently deleted (purged). |
| RestoredAt | Datetime | The timestamp when this version of the file was restored. |
| RestoredById | String | The Id of the user who restored this file version. |
| RestoredByLogin | String | The login (usually email) of the user who restored this file version. |
| RestoredByName | String | The display name of the user who restored this file version. |
| RestoredByType | String | The type of the user who restored the file version, such as 'user' or 'service_account'. |
| Sha1 | String | The SHA-1 checksum of the file version, used to verify file integrity. |
| Size | Int64 | The size of the file version in bytes. For example, '204800' represents a 200 KB file. |
| TrashedAt | Datetime | The timestamp when this file version was moved to the trash. |
| TrashedById | String | The Id of the user who moved this file version to the trash. |
| TrashedByLogin | String | The login (usually email) of the user who moved this file version to the trash. |
| TrashedByName | String | The display name of the user who moved this file version to the trash. |
| TrashedByType | String | The type of the user who moved the file version to the trash, such as 'user' or 'service_account'. |
| Type | String | The item type, which is always 'file_version'. |
| AsUserId | String | The Id of the user you want to impersonate. Only works with Admin, Co-Admin, and Service Accounts. |